# How to get for to stand separate in an equation?

I have the following equation:

$$C_k = \frac{1}{N}\sum\limits_{n=1}^N k_n for k \in {1,\dots,K}$$


How can I get the for, and everything after it, to stand 'separate' from the equation?

You can use \quad to add a space (or \qquad if you want it bigger) and \text{} to insert some text in your equation in a way that it is not typeset in displaymath style. Remember also to insert a space right after the text with\ or to add it inside the text like \text{for }.

$$C_k = \frac{1}{N}\sum\limits_{n=1}^N k_n \quad \text{for}\ k \in \{1,\dots,K\}$$


• I'd go “all the way”: \text{for $k\in\{1,\dots,K\}$} so you don't risk forgetting spaces. I'd also add a comma after the main part of the formula (but this is only personal preference). I'd also suppress “for”, probably. – egreg Sep 24 '13 at 11:06
• @egreg never thought of using this solution.. nice! – Red Sep 24 '13 at 11:08
• In this case it's not so important, as there is only one space to take care of. In other cases it can be much handier. – egreg Sep 24 '13 at 11:09
• I would use \qquad to get a more visual separation. See my answer below. – daleif Sep 24 '13 at 11:38

I tend to do this

\newcommand\qqtext{\qquad\text}
$$C_k = \frac{1}{N}\sum\limits_{n=1}^N k_n \qqtext{for k \in {1,\dots,K}}$$


Note that I include the entire for... part inside the \qqtext{...}, because semantically this is where it belongs.

This way I ensure I always have the same distance for the conditions. I also tend to use the following macros

\newcommand\qtextq[1]{\quad\text{#1}\quad} % for 'and' between eqs
\newcommand\qtext{\quad\text}  % when there is not enough space for \qqtext


Plus possibly e versions using \enspace instead of \quad.

I tend to hide these spacings inside macros in order to make the general text easier to read (less typographic noise).

I usually use the align environment for this, this is especially useful if there's more than one line and you want all of them to be aligned the same way. The & specifies where to align.

\begin{align}
C_k &= \frac{1}{N}\sum\limits_{n=1}^N k_n & &\text{for}\ k \in {1,\dots,K}
\end{align}


• Using an align structure for the purpose at hand is borderline overkill. Using align for a single-line equation can also create inferior vertical spacing compared with an environment such as equation. – Mico Sep 24 '13 at 11:43