Ignoring pdftex primitives (Re: BOUNCE pdftex@tug.org:
Non-member submission from [Michael John Downes <mjd@ams.org>])
Sebastian Rahtz
s.rahtz at elsevier.co.uk
Fri Dec 11 09:24:30 CET 1998
From: Michael John Downes <mjd at ams.org>
> No, things like
> \pdfimage height 3 cm height 2 cm depth 1cm height 5cm picture.png
> are perfectly valid (as with \hrule and \vrule in ordinary TeX),
> the later ones overriding the earlier ones.
Following the hrule/vrule syntax is probably not a good idea in the
first place and when a file name follows I think that this is
definitely a design mistake, as Howlett's example demonstrates. The
two most likely alternatives (while still remaining close to TeX)
would be
\pdfimage filename <space> <width-height-depth spec> ... (repeatable)
I.e., put the file name first and require it to be terminated by a
space. Then the whole construct is syntactically similar to \vrule and
\font in the handling of trailing tokens (still not exactly a good
idea ...)
Or:
\pdfimage <width-height-depth spec> ... from filename <space>
I.e., introduce a new mandatory keyword "from". Compare to the
mandatory "to" in \read\x to\y.
Space must be accepted as a filename terminator if you want to follow
the example of \input. Better, however, would be to devise a different
filename syntax for all filename handling and leave \input etc as
deprecated but still working alternatives. I.e., make some new file
handling primitives:
1. \interject{File Name}
Same as \input, but argument is enclosed in braces. This allows file
names to include spaces. The main trouble here is deciding on the
command name. [... goes off to consult a dictionary ...]
\interleave, \interject, \incorporate, \interpolate, \intercalate,
\digress.
Inject, interject, or intercalate are semantically the best matches
for what TeX actually does when inputting a file. Intercalate is
rarely heard outside of academic contexts. The primary meaning for
inject in common usage is the medical meaning. So I would probably
choose "interject".
2. \openfile read 5{File Name}
\openfile write 8{File Name}
These are replacements for \openout and \openin with syntax similar to
\hbox to 5pt{...} or \write 16{...}. Naming: Maybe \fileopen instead
of \openfile. Maybe keywords "in" "out" instead of read/write.
3. \fontdef\foo{cmr10}
\fontdef\bar at 24pt{cmr17}
\fontdef\baj scaled 1200{cmbxti10}
Like \font but allows spaces in font file names.
Then probably, as was already suggested:
4. \pdfimage height 3cm {File Name}
with height/depth/width specs going before the open brace.
Speaking as a TeX macro writer with many years of experience, having
1-3 above would have saved me many puzzling moments and a lot of extra
work over the years to save users from unnecessary or unapropos error
messages.
Note that it is still possible to use unmatched { } characters in a
file name as long as you make sure they don't have catcode 1 or 2. For
example:
\interject{Foo\string{bar}
(File names must be processed with full expansion, like \special or
\edef; so this is similar to \edef\foo{Foo\string{bar} (a valid TeX
3.x assignment).)
Michael Downes
More information about the pdftex
mailing list