# Aligning equations in an exam document

i got an document with the documentclass exam. I want to create a worksheet with simple equations, each as a \part in an \question environment. However I want the = signs of the equations aligned. I tried doing this.

\documentclass[12pt,oneside]{exam}
\usepackage{amsmath, amsthm, amssymb}
\begin{document}
\begin{questions}
\question This is the question
\begin{parts}
\part 1234
\part 5678
\begin{align*}
\intertext{\part\hspace{1pt}}\frac{12}{7}+\frac{7}{7}=&
%\intertext{\item\hspace{1pt}}
\intertext{\part\hspace{1pt}}\frac{2}{5}+22225+\frac{4}{5}= &
\end{align*}
\end{parts}
\end{questions}
\end{document}


However, this doesn't work. It gives me the following error: !

Package amsmath Error: Multiple \label's: label 'part@1@4' will be lost.

• Welcome to TeX.SE. Please don't post such fragments only. Provide the document you're trying to compile – user31729 Mar 19 '17 at 10:28
• You forgot a \\  after the first &. – Bernard Mar 19 '17 at 12:46

There are several ways to align things. The easiest is to put them into \makeboxes of the same width. The actual width doesn't matter as long as it is big enough. Note the \linewidth is the maximum amount of space left. The \raisebox is optional and purely esthetic.

\documentclass[12pt,oneside]{exam}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{showframe}% MWE only

\newlength{\samewidth}

\begin{document}
\begin{questions}
\setlength{\samewidth}{1.5in}% local to environment
\question This is the question
\begin{parts}
\part \rule{\samewidth}{1ex}
\part \rule{\linewidth}{1ex}
\part \raisebox{-\height}{\makebox[\samewidth][r]%
{$\displaystyle\frac{12}{7}+\frac{7}{7}=$}}
\part \raisebox{-\height}{\makebox[\samewidth][r]%
{$\displaystyle\frac{2}{5}+22225+\frac{4}{5}=$}}
\end{parts}
\end{questions}
\end{document}


• Just for my understanding: the [r] in the \makebox tag actually defines, that they are aligned right? – FriedrichP Mar 19 '17 at 15:27
• Yes, since that is where the = is. If you want something after the =, add it after the end of the \makebox. (You may need to use =\strut to get the spacing even.) – John Kormylo Mar 19 '17 at 15:37
• Nice thank you very much. You saved me several hours... – FriedrichP Mar 19 '17 at 15:47
• If you click the check symbol it will close the question (he said innocently). – John Kormylo Mar 19 '17 at 16:22