The question is as asked. My intended use case for this would be to have something like minipage, but whose height can be set using glue, rather than only a dimen.

When the page is pretty easy to split up, I can just use \textheight to divide things, but sometimes there's extra text on the page, and what I really want to instruct TeX to do is just how to use the remaining space on the page, aside from the stuff I've already typed. I figure the way to do this is to put glue between boxes where content would've gone, and once the glue's been set, replace the glue with a box of the same dimensions.

1 Answer 1


Not directly but using etex you can measure where the glue went and make a box of the same size on the next run:

enter image description here






 \zzA sp - \zzB sp -2\fboxrule-2\fboxsep\fi\relax]%
zzz zzz

zz\zz{\zzB} zzzz 
\item zzzz
  • I think I saw an answer like this somewhere else, and I kinda didn't like it. Is there a way to do this without two passes, and without writing the dimension to an output file? Like, perhaps I could save a box in a box register, set it's glue while it's still in the register, and then programatically manipulate the contents of the box later? Dec 15, 2018 at 9:50
  • @Beelzebielsk basically, no.:-) Dec 15, 2018 at 9:50
  • Well... shucks. I'm gonna hold out hope, though. Maybe another answer will come through. Who knows. I'm not sure how familiar you are with LuaTeX, but if you are, would it expose some functionality that could help me create a command to do this? Dec 15, 2018 at 9:52
  • @Beelzebielsk ah now luatex that's a rather different beast. In luatex you could hook in to the output routine and add the box into the middle of the box being shipped out rather than write the coordinates and add it next time. (although doing \(pdf)savepos version as here is likely to be easier.) Dec 15, 2018 at 9:55
  • In the arguments to your minipage, what is sp? Is that a unit of some kind? Dec 15, 2018 at 10:06

You must log in to answer this question.

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