[NTG-pdftex] Extensions: \pdf$foo or \$foo?

Heiko Oberdiek oberdiek at uni-freiburg.de
Thu Jun 30 17:34:24 CEST 2005


On Thu, Jun 30, 2005 at 01:01:38PM +0200, Hans Hagen wrote:

> Martin Schröder wrote:
> >Hi,
> >at LinuxTag in Karlsruhe I met with Heiko and Hartmut and we
> >talked about pdfTeX. One point discussed was namespace: Till
> >lately most new primitives of pdfTeX startet with \pdf (\efcode,
> >\lpcode and \rpcode are the only exceptions), but now we have
> >some patches that add primitives that don't start with \pdf
> >(\leftmarginkern, \rightmarginkern, \elapsedtime, \resettime,
> >\random). I'm reluctant to use the non-\pdf-namespace and think
> >it better to stay in \pdf.
> >
> >Comments?
> 
> this is why i wrote a while ago that we need a different prefix, something
> 
> \etxelapsedtime
> 
> on the other hand thereis hardly any chance for a clash, e.g. if a macro 
> package defines \elapsedtime it will still work ok; of course when one in 
> such a macro package wants access to the original primitive, one can save 
> its meaning; this is what i normally do.
> 
>   \let\normalelapsedtime\elapsedtime
>   \def\elapsedtime{.... \normalelapsedtime ...}

The problem is that one package may want to use the primitive
\elapsedtime, but another package has defined \elapsedtime for
other purpose, not knowing that this is a primitive.

A "namespace" prefix helps to avoid random name clashes.
However, it does not cure this problem entirely.
But a "namespace" allows us to say:
  Hey, package or macro author, command names that start
  with \pdf are reserved, if you are using pdfTeX.
And we can then add new primitives in this namespace
without worrying about name clashes.

> personally i think that we should move forward and not clobber extensions 
> with funny prefixes as in \pdfleftmarginkern and such; as said, if a macro 
> package wants to use that features, it has to be pdftex aware and as such 
> can take measures to save the original meaning

It doesn't work in practice. :-((
Some TeX distributions are now using pdfTeX instead of TeX as
compiler for "latex". Despite the availability of ifpdf.sty since 2001,
there are many, many problems in the newsgroups (de.)comp.text.tex
about using the wrong code:
  \ifx\pdfoutput\undefined
    ... latex setup
  \else
    ... pdflatex setup, assuming pdfTeX in pdf mode
  \fi
\pdfoutput is available since the beginnning of pdfTeX?
But many people haven't understood yet that pdfTeX can be used
for DVI mode.

> (so we could also argue for removing all \pdf prefixes)

One argument against "\pdf" is that this might confuse users
that they think, it is available for/in pdf mode only.
This could be cured at the cost of a different namespace:
  \pdf for pdf mode stuff
  \ptex for mode independent stuff

> (when etex came available, it introduced primitives that clashed with low 
> level context ones; it never was a real problem; one simply cannot extend 
> tex and take all packages into account)

As active author of conTeXt you can react fast on changes in the
underlying TeX compilers. But there are many packages where the
authors get lost and are unmaintained. And many authors react
slowly (like me sometimes).
  I do want to solve faqs, but I don't want to generate new
ones. For example, a quick search in TeXLive 2003 shows
collisions for \\match:
  chess.sty
  chessmg.sty
  eclbip.sty
sverb.sty defines \matcher and texshade.sty defines \match at case.
Thus if we add \match, then the newsgroups are full of \match
isn't working if I use chess and pdflatex ... And the people
would remember, pdfTeX causes problems.

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>
-- 


More information about the ntg-pdftex mailing list