I'd like to define a theorem environment called sol
in order to write solutions to exercises. I've done so through
\documentclass[a4paper]{article}
\usepackage{amsthm}
\newtheorem{ex}{Exercise}[subsection]
\newtheorem*{sol}{Solution}
\begin{document}
\renewcommand{\theenumi}{\alph{enumi}}
\renewcommand{\labelenumi}{\theenumi}
\begin{ex} Question
\end{ex}
\begin{sol} Solution
\end{sol}
\begin{ex} Question
\begin{enumerate}
\item First part
\item Second part
\end{enumerate}
\end{ex}
\begin{sol}
\begin{enumerate}
\item First part
\item Second part
\end{enumerate}
\end{sol}
\end{document}
This works fine with simple questions, but it looks a bit awkward with multipart questions (as illustrated by the previous mwe). I think it would look better if part a started in a newline rather than following the Solution tag. I've tried adding \\
right after \begin{sol}
or before or after \begin{enumerate}
. But I get errors ("There's no line here to end").
Is there a way of adding the newline after the Solution tag and the list number?
Best Answer
In this particular case, in which you defined solution as a
newtheorem
you can proceed as in section 2.1 of amsthm manual. One way is with\leavemode
command, but it has some problems explained in the manual.An alternative method is to define a theorem style to perform this breaks (also from the manual):