0

When using the \fillwithlines{\stretch{1}} command inside an \uplevel-esque environment, the lines do not appear. This issue does not happen when a length is specified to fillwithlines instead.

\documentclass{exam}
\usepackage[utf8]{inputenc}
\usepackage{showframe}

\begin{document}
\begin{questions}
\question The apples and oranges say it takes two to tangarine.

\begin{parts}
\part[5] The bananas have come to say hello!

\uplevel{
\fillwithlines{\stretch{1}}
}
\begin{EnvUplevel}
\fillwithlines{\stretch{1}}
\end{EnvUplevel}

\part[5] The bananas have come to say hello!

\begin{EnvUplevel}
\fillwithlines{10cm}
\end{EnvUplevel}
\end{parts}
\end{questions}
\end{document}

The compiled LaTeX code, showing that the first question does not have lines yet the second does.

1 Answer 1

1

It might by a bug. I made same changes to the \uplevel command to make it work.

b

Using Document Class: exam 2021/02/26 Version 2.7

\documentclass{exam}
\usepackage[utf8]{inputenc}
\usepackage{showframe}

\makeatletter

\long\def\uplevel#1{% changed <<<<<
    \saved@totalleftmargin=\leftskip
    \par\bigskip
    \leftskip=\@totalleftmargin
    \advance\leftskip-\leftmargin
    \advance\@totalleftmargin-\leftmargin
    \advance\linewidth\leftmargin   
    #1%
    \advance\linewidth-\leftmargin  
    \advance\@totalleftmargin+\leftmargin
    \leftskip=\saved@totalleftmargin
\nobreak
}

\renewenvironment{EnvUplevel}
{\saved@totalleftmargin=\@totalleftmargin
    \par\bigskip\bgroup%
    \leftskip=\@totalleftmargin
    \advance\leftskip-\leftmargin
    \advance\@totalleftmargin-\leftmargin
    \advance\linewidth\leftmargin
}
{\egroup\@totalleftmargin=\saved@totalleftmargin\nobreak}

\makeatother

\begin{document}
    
\begin{questions}
    \question The apples and oranges say it takes two to tangarine. 

    \begin{parts}
        
        
        \part[5] The \textbf{bananas} have come to say hello! \verb|\fillwithlines{\stretch{1}}|
        \uplevel{
            \fillwithlines{\stretch{1}}
        }
    
        \part[15] The \textbf{pears} have come to say hello! \verb|\fillwithlines{\stretch{1}}|
        
        \begin{EnvUplevel}
            \fillwithlines{\stretch{1}}
        \end{EnvUplevel}
    
        
        \part[25]  The \textbf{grapes} have come to say hello!  \verb|\fillwithlines{3cm}|  
            
        \begin{EnvUplevel}
            \fillwithlines{3cm}
        \end{EnvUplevel}
    
    
    \end{parts}

\end{questions}

\end{document}
1
  • I think this breaks uplevelling normal text, e.g. \uplevel{Some text} or the equivalent environment one. However, I can change one of them and use the other one for text, so works for me :P Commented Oct 27, 2021 at 7:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .