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.

Right now I have the following for a vertical addition problem but I would also like it to be numbered without messing everything else up.

\begin{array}{c@{\,}c}
  & 1 \\
+ & 1 \\
\hline
  & 2 \\
\end{array}
share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

You could also just use an enumerate type of environment. With that I would recommend you use the aligned environment which will allow specification of alignment of the numbers, but array can be used as well:

enter image description here

Note:

  • The addition problem used a macro only to improve readability in this example.

Code:

\documentclass{article}
\usepackage{amsmath}

\newcommand*{\ProblemInArray}{\quad%
    \begin{array}{c@{\,}c}
          & 1 \\
        + & 1 \\
        \hline
          & 2 \\
    \end{array}
}%

\newcommand*{\ProblemInAligned}{\quad%
    \begin{aligned}[t]% Choose alignement: t, b, or c
          & 1 \\
        + & 1 \\
        \hline
          & 2
    \end{aligned}
}%

\begin{document}\noindent
Using \texttt{array} environemnt
\begin{enumerate}
    \item $\ProblemInArray$
    \item $\ProblemInArray$
\end{enumerate}
%
Using \texttt{aligned} environemnt
\begin{enumerate}
    \item $\ProblemInAligned$
    \item $\ProblemInAligned$
\end{enumerate}
\end{document}
share|improve this answer
add comment

You can try,

\[
\begin{array}{@{}cr}
    & 1 \\
+  & 10 \\
\cline{2-2}
  & 11 
\end{array}
\]

You may want also to adjust the space between the columns by using

\setlength\arraycolsep{0.1em}

enter image description here

Edit: added numbering

There are many ways to number the equations, but for this type of problem, I would either use the multienum package or incorporate the numbering in the array manually, or create a counter to auto increment. Here is a rather longer example. Of course it will look better if the + sign was on the right like we do in my part of the world.

enter image description here

\documentclass[fleqn]{article}
\usepackage{amsmath,multienum,booktabs}
\renewcommand{\regularlisti}{\setcounter{multienumi}{0}%
  \renewcommand{\labelenumi}%
  {\addtocounter{multienumi}{1}\alph{multienumi})}}
\begin{document}

\[
\begin{array}{lrr}
\text{(i)}&   & 1  \\
&+  & 10 \\
\cmidrule(lr){3-3}
&  & 11  \\
\end{array}
\]

\[
\begin{array}{lrr}
\text{(ii)}&   & 1  \\
&+  & 10 \\
\cmidrule(lr){3-3}
&  & 11  \\
\end{array}
\]


\[
\begin{array}{crr@{}c@{}r@{}c@{}l}
\text{(iii)}   &237   &100a        &{}+{}&10b    &{}+{}&c\\
\addlinespace
\text{(iv)}  &732   &100c        &{}+{}&10b    &{}+{}&a\\
\cmidrule(lr){2-2}\cmidrule(lr){3-7}
\text{(v)} &495   &\multicolumn{1}{l@{}}{100(a-c-1)} &+&90     &+&(10+c-a)\\
\addlinespace
\text{(vi)}  &594   &\multicolumn{1}{l@{}}{100(10+c-a)} &+&90     &+&(a-c-1)\\
\cmidrule(lr){2-2}\cmidrule(lr){3-7}
\text{(vii)}   &1089  &\multicolumn{1}{c}{900}        &+&180    &+&9\\
\cmidrule(lr){2-2}\cmidrule(lr){3-7}
\specialrule{0pt}{-1pt}{-1pt} 
\cmidrule(lr){2-2}\cmidrule(lr){3-7}
\end{array}
\]
\end{document}
\end{document}
share|improve this answer
    
the op requested a numbered problem, so \begin{equation} ... \end{equation} would be more appropriate. –  barbara beeton Mar 17 '12 at 14:08
    
@barbarabeeton Thanks, did not see it. I have added a numbering scheme. –  Yiannis Lazarides Mar 18 '12 at 9:08
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.