I have declared several lengths in my document: \bottomMargin
\topMargin
and \initialPaperHeight
.
Right now, I am doing this
\AtEndDocument{%
\global\paperheight\dimexpr\pagetotal + \bottomMargin + \topMargin \relax
}
But, instead of setting \paperheight
to \pagetotal + \bottomMargin + \topMargin
, I would like to set \paperheight
to the minimum of this value and of \initialPaperHeight
. In pseudo-code, I would like to do
\paperheight = min(\initialPaperHeight, \pagetotal + \bottomMargin + \topMargin)
So, my question is: How should I do?