TransWikia.com

Exam class: Sectioning command spacing when used within questions environment

TeX - LaTeX Asked on August 31, 2021

I have the following MWE:

documentclass[a4paper]{exam}

% renewcommand{questionshook}{
%     setlength{itemsep}{30pt}
% }


begin{document}
section{leet}
someleet. 
section{moreleet}
somemoreleet.
begin{questions}
    question something here.
    begin{EnvFullwidth}
        section{blah}
    end{EnvFullwidth}
    question blahblah.
end{questions}
end{document}

Compiling this code returns the following results, with the renewcommand block commented on the left, and uncommented on the right (open the images in new tabs, ideally):

enter image description here
enter image description here

Notice two things:

  1. The spacing above the blah section is equal in both cases, but clearly more than the normal sectioning space.

  2. The spacing below the same section is massively expanded when the question spacing is changed.

Another thing I noted, is that commands such as clearpage or newpage do nothing to eliminate the space above the sectioning command, when placed in a questions environment.

My goal is as such, for the sectioning commands within the questions environment (i.e. not just section, but subsection, etc too):

  1. The spacing above the sectioning command should be equal to the itemsep{} set in the newcommand.

  2. The spacing below the sectioning command should be equal to the usual spacing below a sectioning command not within the questions environment.

  3. If a sectioning command begins on a new page, or clearpage/newpage is explicitly specified, then there should be no additional space above the sectioning text, i.e. a new page nullifies the space mentioned in 1.

Can this be achieved with some wrangling?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP