10

I got confused with whether or not I have to use \the.

  1. \the in \special{papersize=\the\paperwidth,\the\paperheight} is mandatory.
  2. But \the in neither \begin{pspicture}(\the\paperwidth,\the\paperheight) nor \psframe[linecolor=red](\the\paperwidth,\the\paperheight) is mandatory.
\documentclass{minimal}
\usepackage{pstricks}
\paperwidth=72.27pt
\paperheight=72.27pt

\hoffset=-72.27pt
\voffset=-72.27pt
\topskip=0sp
\parindent=0sp

% it works
\special{papersize=\the\paperwidth,\the\paperheight}

% it does not work
%\special{papersize=\paperwidth,\paperheight}


\begin{document}
% it works
\begin{pspicture}(\the\paperwidth,\the\paperheight)
\psframe[linecolor=red](\the\paperwidth,\the\paperheight)
\end{pspicture}
%
% it also works
%\begin{pspicture}(\paperwidth,\paperheight)
%\psframe[linecolor=red](\paperwidth,\paperheight)
%\end{pspicture}
\end{document}

What is the rule whether or not I have to use \the?

14

The TeX primitive \the returns the value of a length, counter or other register as text. You need to use it where you want to output strings, e.g. to external files (like the DVI in the case of \special) or to display it as part of the document.

For document internal macros which await a length or number expression you don't need to use \the but can use a length or counter register directly.

8

\the is used to convert TeX registers into their value, so for example \the\paperwidth expands to the paper width (in pt). Where TeX expects a dimension, it is possible to omit the \the. Thus for example in \begin{pspicture}(\the\paperwidth,\the\paperheight) the underlying code will be setting a dimen, which therefore expects a dimen value and therefore can use \paperwidth without the \the. In general, using \the is safe whether or not it is needed, so there is no problem with including it where it is not absolute required.

(The same approach applies to other register types, for example \count registers.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.