Re: Setting papersize in reference cards

Ulrike Fischer <[email protected]> Thu, 7 Aug 2025 17:55:53 +0200
Newsgroups gmane.comp.tex.texhax
Message-ID <[email protected]>
Am Thu, 7 Aug 2025 12:26:00 +0200 schrieb Vincent Lefevre:

> \ifx\pdfoutput\undefined\else   % check if we are using pdfTeX
>   \pdfpagewidth=\totalwidth     % width of paper in pdf output
>   \pdfpageheight=\totalheight   % height of paper in pdf output
> \fi

\pdfoutput is normally nowaday always defined. You need to check its
value to see if you are outputting dvi or pdf

So you need something like

\ifnum\pdfoutput<1
  \special{papersize=\the\totalwidth,\the\totalheight}%
\else 
  \pdfpagewidth=\totalwidth
  \pdfpageheight=\totalheight
\fi  

Be aware that a \special must be issued on a page, you can't do that
in the preamble. In LaTeX the special is in \AtBeginDvi.

It you want to support also xetex and luatex you need a few more
tests. 



-- 
Ulrike Fischer 
http://www.troubleshooting-tex.de/