# Whitespace around characters

I need to wrap some of the characters with whitespace so that the terms align correctly

\begin{align*} x = 1 + 2 + 3 + 4 + \cdots + n \\ x = n + (n-1) + (n-2) + (n-3)+\cdots+ 1\\ \cline{1-2} 2x = (1+n) + (1+n) + (1+n) + (1+n) + \cdots (1+n) \end{align*}

• You need to remove the \$ here. align* on itself starts math-mode. If you want to use align* (or align), you need to use & as an alignment point, in your case probably right before the = signs. – Qrrbrbirlbel Oct 13 '13 at 4:32
• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Sean Allred Oct 13 '13 at 4:48

The following might be in line with what you're after:

\documentclass{article}
\usepackage{amsmath,array}% http://ctan.org/pkg/{amsmath,array}
\newcolumntype{C}{>{{}}c<{{}}}
\begin{document}
\begin{align*}
x = 1 + 2 + 3 + 4 + \cdots + n \\
x = n + (n-1) + (n-2) + (n-3)+\cdots+ 1\\
\cline{1-2}
2x = (1+n) + (1+n) + (1+n) + (1+n) + \cdots (1+n)
\end{align*}

$\renewcommand{\arraystretch}{1.2} \begin{array}{r*{12}{@{}C}} x & = & 1 & + & 2 & + & 3 & + & 4 & + & \cdots & + & n \\ x & = & n & + & (n-1) & + & (n-2) & + & (n-3) & + & \cdots & + & 1 \\ \hline 2x & = & (1 + n) & + & (1 + n) & + & (1 + n) & + & (1 + n) & + & \cdots & + & (1+n) \end{array}$
\end{document}


The entire structure is set in an array with a column type that provides the appropriate spacing around binary operators and relations (by inserting an empty group {} on the left/right of every cell, thanks to the array package's \newcolumntype). Some extra padding on the left and right (default of \arraycolsep or 5pt) can be changed, if needed.

Do you mean something like this?

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{align*}
x &= 1 &&+ 2 &&+ 3 &&+ 4 &&+ \cdots &&+ n \\
x &= n &&+ (n-1) &&+ (n-2) &&+ (n-3)&&+\cdots&&+ 1\\
\cline{1-12}
2x &= (1+n) &&+ (1+n) &&+ (1+n) &&+ (1+n) &&+ \cdots &&+(1+n)
\end{align*}
\end{document}


• I wanted to add whitespace so that, for example, 2 and (n-1) have the same width – Tae Hyung Kim Oct 13 '13 at 4:50