plain TeX: different margins for odd and even pages

Philip Taylor (Hellenic Institute) elliniko.institouto at gmail.com
Fri Oct 24 11:04:11 CEST 2025


On 24/10/2025 08:54, Rodolfo Medina wrote:
> [S]uppose I want to set different margins for [o]dd and even pages, say 5mm
> left and 10mm right for odd pages and the opposite for even pages: please
> suggest whoever can a proper way to do it.

Adjust \hoffset in your output routine, not in mainline code. For 
example (untested, /caveat lector/) —

\newdimen \oddpageoffset \oddpageoffset = \dimexpr 5 mm -1 true in \relax
\newdimen \evenpageoffset \oddpageoffset = \dimexpr 10 mm - 1 true in \relax

\newtoks \Knuthput
\Knuthput = \output
\output = {\ifodd \pageno \advance \hoffset by \oddpageoffset \else 
\advance \hoffset by \evenpageoffset \fi \the \Knuthput}

Page 1\eject
Page 2\eject
Page 3\eject

\end

-- 
/Philip Taylor/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20251024/21667782/attachment.htm>


More information about the texhax mailing list.