Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
A related question: What is the proper method of accessing a counter? –  Peter Grill Jul 17 '11 at 21:24
add comment

2 Answers

up vote 12 down vote accepted

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.

share|improve this answer
add comment

\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.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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