Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The line

\[ \textcolor{green}{\sum}_{k=0}^n \]

makes the k=0 and n parts go to the right of Sigma instead of at the top and bottom, as it should be. Can we retain k=0 and n at the top and bottom?

share|improve this question
2  
If you often use color in math-mode you may be interested in \mathcolor (avoids problems with spacing): Colored symbols –  Qrrbrbirlbel Mar 2 '13 at 21:50
add comment

2 Answers 2

up vote 10 down vote accepted

The \textcolor macro will undo the operator status of \sum so that both subscript and superscript are placed like they would at an ordinary symbol.

The macro \mathop makes the whole sequence (the green sum symbol) an operator again.

When you often use colored operator symbols, define a new macro, say

\newcommand*{\opcolor}[2]{\mathop{\textcolor{#1}{#2}}}

and use it as \opcolor{green}{\sum}.

I have also defined a \csum macro based on \opcolor.

Code

\documentclass{article}
\usepackage{xcolor}
\newcommand*{\opcolor}[2]{\mathop{\textcolor{#1}{#2}}}
\newcommand*{\csum}[1]{\opcolor{#1}\sum}

\begin{document}
\[ \mathop{\textcolor{green}{\sum}}_{k=0}^n \]

\[ \csum{green}_{k=0}^n \]

\[ \opcolor{green}{\sum}_{k=0}^n \]
\end{document}

Output

enter image description here

share|improve this answer
add comment

Declare the green symbol as an operator via \mathop.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xcolor}
\begin{document}
\[ \mathop{\textcolor{green}{\sum}}_{k=0}^n \]
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.