Is there a way to have a savebox spanning multiple pages?
In the following MWE, the text does not fit on a single page so it is pushed to the next page and the text is cut off.
\documentclass{article}
\usepackage{lipsum}
\newsavebox{\mybox}
\newcounter{test}
\begin{document}
\savebox{\mybox}{
\setcounter{test}{10}
\begin{minipage}{1.0\linewidth}
\lipsum[1-10]
\end{minipage}}
My counter is: \thetest.
\usebox{\mybox}
\end{document}
I know that I can define the command instead of using a savebox, however as the MWE shows, my usage of the savebox is necessary for my setup. In particular, I am using it as as a way to process the LaTex commands in the box (setcounter in this particular MWE), print some results, then output the content of the box.


minipagecreates a box; that doesn't break either (automatically). – frougon Feb 28 '20 at 23:54saveboxcan be split into smaller pieces, see https://tex.stackexchange.com/a/22836/194703. Yet, like @frougon, I do not really understand "however as the MWE shows, my usage of thesaveboxis necessary for my setup." Note also thattcolorboxhas a library for breaking boxes over several pages. – Feb 29 '20 at 01:29%) then a full width vbox from the minipage. neither the vbox nor hbox can split over a page, the simplest solution here is simply to use the\lipsumtext unboxed. You give no indication of why you want a box here. – David Carlisle Feb 29 '20 at 11:26totcountand I will use that instead. – Tohiko Feb 29 '20 at 12:08