depthcharge was: Ignoring pdftex primitives

Taco Hoekwater taco.hoekwater at wkap.nl
Fri Dec 11 11:31:40 CET 1998


Hans Hagen wrote:
> Taco Hoekwater wrote:
> 
> > you need three \noexpands because TeX is looking for three keywords in
> > a loop that does not end until all three keyword searches return
> > "false". You won't need more \noexpands until TeX can do typesetting
> > in 3-d or colored rules, I guess. But for other images you need less:
> > 
> > "widthcharge.png" needs only 1 \noexpand, "heightcharge.png" needs 2
> > (but more \noexpands don't do any harm). "./heightcharge.png" needs
> > none, of course, but that's not portable across filesystems.
> 
> Hm, but how come then that one can give 10 depth specs in a row? So how
> about? 
> 
> \pdfimage width 1cm height 1cm width 1cm width 3cm depthfile.png

TeX uses the following logic:


reswitch:
if "width" then  <parse and goto reswitch> else
  if "height" then <parse and goto reswitch> else
    if "depth" then  <parse and goto reswitch> else
                       <do nothing>;
<rest of program follows below this point>
 

As you can see, you need three failures before this loop is broken,
but only one success to restart. What the \noexpands do: each of them
makes one of the tests fail. 

"widthcharge" needs only one \noexpand, for the first test ("width"), 
              since the other two will fail themselves. 
"heightcharge" needs two \noexpands. The first of those makes the test 
              for "width" fail, the second the test for "height". 
"depthcharge" needs three \noexpands (using the same logic).

For the latter two, if the spec was 
	\pdfimage width 0pt \noexpand\empty heightcharge.png 

you would be in the error case, because the succesful "width" goes back
into the loop, using the \noexpand in the second pass. (Knuth is very
good at making pascal behave like assembly :-).

Greetings, Taco




More information about the pdftex mailing list