artemmavrin/latex-homework

Including solution after part leading to large blank spaces

lpdx opened this issue · 2 comments

lpdx commented

It's a really nice class but I'm having an issue that I can't solve by myself.

When I try to put the solution right after the part of the problem I'm getting a large white space.
I'm using Overleaf to compile.

Here is the screen capture.

image

And the minimal example:

\documentclass{homework}
\name{Leonhard Euler}
\course{Math 101}
\term{Fall 1737}
\hwnum{1}
\begin{problem}
Problem description
\begin{parts}
\part
\label{1.a}
$log_22 = x$
\begin{solution}
solution
\end{solution}
\part
\label{1.b}
Problem b
\begin{solution}
solution
\end{solution}
\end{problem}
\end{document}

Your minimal example is missing a \begin{document} and an \end{parts}, but that isn't the problem.

Your usage (putting solutions in between problem parts) isn't the intended way to use the class, but I think it may still work how you want if you make the following changes:

\documentclass{homework}
\name{Leonhard Euler}
\course{Math 101}
\term{Fall 1737}
\hwnum{1}
\begin{document}
\begin{problem}
Problem description
\begin{parts}
\part
\label{1.a}
$log_22 = x$
\end{parts} % End the parts environment before the solution environment
\begin{solution}
solution
\end{solution}
\begin{parts} % Start a new parts environment after the solution
\part
\label{1.b}
Problem b
\end{parts} % End of the parts environment before the solution environment
\begin{solution}
solution
\end{solution}
\end{problem}
\end{document}

This works for me on Overleaf, producing the following:
capture

Hope this helps!

lpdx commented

Works really well!
Thank you a lot!