[tex-live] A please for literate coding

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sat Dec 4 14:01:47 CET 2010


On Sat, Dec 04, 2010 at 12:37:27PM +0000, Philip Taylor (Webmaster, Ret'd) wrote:

> When you post code such as the following, you run the risk
> of it being either misunderstood or even incomprehensible
> to newer members of the TeX fraternity :
> 
> >\let\savedpdfmapline\pdfmapline
> >\def\pdfmapline{\begingroup\catcode`\ 10 \execpdfmapline}
> >\def\execpdfmapline#1{\endgroup\savedpdfmapline{#1}}
> 
> If you were to put in a few spaces and assignment operators,
> as in the following, it might be considerably more transparent
> to others :
> 
> \let \savedpdfmapline = \pdfmapline
> \def \pdfmapline {\begingroup \catcode `\ = 10 \execpdfmapline}

You have forgotten the space before the assignment operator,
the space here belongs to the control token before.

\def \pdfmapline {\begingroup \catcode `\  = 10 \execpdfmapline}

> \def \execpdfmapline #1{\endgroup \savedpdfmapline {#1}}

> What do you think ?

It's a matter of taste.
I would probably have formatted it as:

\let\savedpdfmapline\pdfmapline
\def\pdfmapline{%
  \begingroup
  \catcode`\ =10 %
  \execpdfmapline
}
\def\execpdfmapline#1{%
  \endgroup
  \savedpdfmapline{#1}%
}

Yours sincerely
  Heiko Oberdiek


More information about the tex-live mailing list