3

My setup: TL2014

I understand what pdftexmagfix.tex is for, I only don't understand how it works:

If we change

\begingroup
  \catcode`P=12
  \catcode`T=12
  \lowercase{%
\endgroup
\def\ppdfconvert@truept#1PT{#1truept}%
  }%

to

\def\ppdfconvert@truept#1pt{#1truept}%

we get this error:

! File ended while scanning use of \ppdfconvert@truept.

Why this error is produced and why to set catcode?

1 Answer 1

2

The macro is used in

\def\ppdfmag@fix#1{#1=\expandafter\ppdfconvert@truept\the#1\relax}

When \the\pdfhorigin is expanded, it returns something like 123.45pt (or whatever), with all characters of category code 12 (this is what always happens with TeX operations that return strings, only spaces receive category code 10).

So the argument to \ppdfconvert@truept must be delimited by characters with category code 12, which is what the code above does, exploiting the fact that \lowercase never changes the category code, but only the character code.

Note that the assignments of category codes are undone by \endgroup, but only after \lowercase has performed its duty.

The alternative road

\begingroup
\edef\otherpt{%
  \endgroup\def\noexpand\ppdfconvert@truept##1\string p\string t}%
\otherpt{#1truept}

is much clumsier.


If you proceed your way, the macro \ppdfconvert@truept expects to be followed by arbitrary tokens until finding pt, both with category code 11, which it can't find until the first \par or end-of-file, so TeX stops with a Runaway argument or File ended while scanning use of error.

When a macro with delimited arguments is defined, the arguments should be followed by the exact sequence of tokens in the delimiter: both character code and category code are taken into account for character tokens; symbolic tokens (that is, control sequences) in the delimiter need not be defined, but names must match.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .