1

I have noticed extra padding at top of my solution environment (using the exam class) especially if you use multicols inside of the solution environment:

![enter image description here

\documentclass[addpoints]{exam}
\usepackage[utf8]{inputenc}
\usepackage[margin=.75 in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amsfonts,amssymb,amsthm,color,srcltx,enumitem,bm,cancel}
\usepackage{multicol}

%Lengthens \fillin answer lines and raises text above the line so text isn't cut off by the answer line, see documentation http://mirror.utexas.edu/ctan/macros/latex/contrib/exam/examdoc.pdf and this question https://tex.stackexchange.com/questions/352246/vertical-spacing-between-fillin-in-exam \setlength\fillinlinelength{6.5cm} \setlength\answerclearance{1.25ex}

%Answerline to right of question, see https://tex.stackexchange.com/questions/82152/answerline-to-the-right-of-a-question \usepackage{letltxmacro}% http://ctan.org/pkg/letltxmacro \usepackage{xpatch}% http://ctan.org/pkg/etoolbox \xpatchcmd{\answerline}% <cmd> {\par\nobreak\vskip\answerskip}% <search> {\leaders\hbox{\hskip0.2em .\hskip0.2em}\hskip 0pt plus 1filll}% <replace> {}{}% <success><failure> \xpatchcmd{\answerline}{\fi \par}{\fi}{}{}% Remove line break after \answerline \makeatletter \LetLtxMacro{\oldanswerline}{\answerline} \RenewDocumentCommand{\answerline}{s o}{% \begingroup \IfBooleanTF{#1} {\def@queslevel{\relax}}% \answerline* {}% \answerline \IfNoValueTF{#2} {\oldanswerline[{}]}% \answerline {\oldanswerline[#2]}% \answerline[..] \endgroup }

\renewcommand{\baselinestretch}{1.5} \printanswers

\begin{document} \begin{questions} \question Show that $f(x)=x+8$ and $g(y)=y-8$ are inverses. \begin{solution} \begin{multicols}{2} \begin{align} f(g(y))&=(y-8)+8 \ &= y \end{align} \columnbreak \begin{align} g(f(x)) &= (x+8)-8 \ &=x \end{align} \end{multicols} \end{solution} \end{questions} \end{document}

Some notes:

  • I think \renewcommand{\baselinestretch}{1.5} makes the problem worse, but I don't want to remove this as I like the 1.5 spacing throughout the rest of the document.

  • Deleting the spaces / blank lines before and after \columnbreak helps, but then it causes the right column to be higher than the left column (why?)

Thanks!


Edit: Thanks to John Kormylo for the idea:

\begin{solution}
\abovedisplayskip=0pt
\belowdisplayskip=0pt
\multicolsep=0pt
...
\end{solution}

Is there a way to to take care of this globally in the preamble, or perhaps define a new solution environment (like solution*?), so I don't have to remember to write it for every solution environment?

EthanAlvaree
  • 1,367

0 Answers0