3

I need to provide my students with an answer sheet to write down their answers. When there is a page break I would like the new page to show the question's full nested number, not just the deepest nested number.

To illustrate with the working example below: the second page shows simply "ii." Because it is a new page, I'd like it to show: "2. (b) ii." I've searched the forums and looked at the enumitem documentation but could not find a solution. Ideally, I would only want to show the full nested number in new pages.

\documentclass[12pt]{article}
\usepackage{fullpage}
\begin{document}

\begin{enumerate}
\item
    \begin{enumerate}
    \item \rule{0pt}{0.0mm} \vspace{8em}
    \item \rule{0pt}{0.0mm} \vspace{16em}
    \end{enumerate}
\item
    \begin{enumerate}
    \item \rule{0pt}{0.0mm} \vspace{12em}
    \item
        \begin{enumerate}
        \item \rule{0pt}{0.0mm} \vspace{8em}
        \newpage{}
        \item \rule{0pt}{0.0mm} \vspace{8em}
        \end{enumerate}

    \end{enumerate}
\end{enumerate}

end{document}
2

A possible approach could be to use \AtBeginShipout from the atbegshi package. This macro executes code at page shipout, i.e., when LaTeX has completed rendering a page and is ready to send the page to the output file. You can use this hook to temporarily change the enumerate label(s) and immediately change them back after use.

MWE:

\documentclass[12pt]{article}
\usepackage{fullpage}
\usepackage{atbegshi}
\begin{document}

\AtBeginShipout{%
\gdef\labelenumiii{\arabic{enumi}(\alph{enumii})\roman{enumiii}.\gdef\labelenumiii{\roman{enumiii}.}}%
}
\begin{enumerate}
\item
    \begin{enumerate}
    \item \rule{0pt}{0.0mm} \vspace{8em}
    \item \rule{0pt}{0.0mm} \vspace{16em}
    \end{enumerate}
\item
    \begin{enumerate}
    \item \rule{0pt}{0.0mm} \vspace{12em}
    \item
        \begin{enumerate}
        \item \rule{0pt}{0.0mm} \vspace{8em}
        \newpage{}
        \item\label{first} xyz
        \item abc
        \end{enumerate}

    \end{enumerate}
\end{enumerate}

ref: \ref{first}
\end{document}

Result:

enter image description here

It seems to work ok with references. Note that you should add redefinitions for other levels (\labelenumi and \labelenumii etc) if you want to print such labels in full as well.

  • Thanks for your response. This is certainly a provisional solution. However, if one wants to be picky, one would complain about the format of this new label: it is not properly aligned with other (higher) items, and the relevant spacing between the different nested letters in 2 (b) ii is not the same as it is in any of the other items. – Santiago Mejia Apr 25 at 15:56
  • I found a not elegant solution to this problem: add \hspace to separate the items. \gdef\labelenumiii{\arabic{enumi}\hspace{1.2em}(\alph{enumii})\hspace{1em}\roman{enumiii}.\gdef\labelenumiii{\roman{enumiii}.}} It would be nice to find a more elegant solution that does not independently define the spacing between the items in the nested items but which simply used the spacing used by the system – Santiago Mejia Apr 25 at 16:21
  • @SantiagoMejia for the first issue you can try to modify the redefinition to include some spacing commands. However, given that the full numbering is intended to be some sort of reminder (instead of the start of a new list) it might be defendable or even desirable to have different spacing. For the second issue I'm not really sure what the problem is, if you add a second MWE that shows the problem I (or somebody else) could have a look later. – Marijn Apr 25 at 16:23
  • Thanks Marjin. As you point out, this can be solved with \hspacing. As to the second issue... I eliminated the comment since I think it was an issue I came across as I tinkered with your solution. But this was not a problem with your solution. – Santiago Mejia Apr 25 at 16:25
  • I've now identified the problem I was discussing above. It occurred when I tried to define \labelenumii. I am unsure, however, how to provide a MWE in the comments... (the MWE It is too long to post) – Santiago Mejia Apr 25 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.