0

Why does the following work

\documentclass[answers]{exam}
\begin{document}
    \begin{center}
        \Large\textbf{
            \shortstack{
                Assignment 1
                \ifprintanswers\\ (Answer)\fi
            }           
        }
    \end{center}
\end{document}

while this (after replacing the parenthesis with square brackets in the second printed line) doesn't?

\documentclass[answers]{exam}
\begin{document}
    \begin{center}
        \Large\textbf{
            \shortstack{
                Assignment 1
                \ifprintanswers\\ [Answer]\fi
            }           
        }
    \end{center}
\end{document}
Diaa
  • 9,599
  • 3
    \\[3pt] adds 3pt after the linebreak and \\[answer] isn't a length, use \\{} [answer] (or anything else to hide the [ from the \\) – David Carlisle Feb 16 '22 at 00:00
  • Possible duplicate: https://tex.stackexchange.com/q/187356/ (that has a detailed answer already) – marquinho Feb 16 '22 at 00:10

0 Answers0