3

My setup: web2cTeX (TeX Live).
Consider these two files, which are supposed to produce the same output.
--- file1.tex ---

\centerline{ab}\ %

cd
\bye

--- file2.tex ---

\centerline{ab} %

cd
\bye

Here is how 'dvitype' output for both files differ:


...
 [ab]
 134: pop 
 level 1:(h=0,v=655360,w=0,x=0,y=0,z=0,hh=0,vv=42) 
-135: y3 786432 v:=655360+786432=1441792, vv:=91 
-139: y0 786432 v:=1441792+786432=2228224, vv:=141 
-140: push 
-level 1:(h=0,v=2228224,w=0,x=0,y=786432,z=0,hh=0,vv=141) 
-141: right3 1310720 h:=0+1310720=1310720, hh:=83 
-145: setchar99 h:=1310720+291271=1601991, hh:=101 
-146: setchar100 h:=1601991+364090=1966081, hh:=124 
+135: down3 786432 v:=655360+786432=1441792, vv:=91 
+139: push 
+level 1:(h=0,v=1441792,w=0,x=0,y=0,z=0,hh=0,vv=91) 
+140: right3 1310720 h:=0+1310720=1310720, hh:=83 
+144: setchar99 h:=1310720+291271=1601991, hh:=101 
+145: setchar100 h:=1601991+364090=1966081, hh:=124 
 [ cd]
...

Both dvi files have the same size - 224 bytes.

AFAIK, space should not be ignored after a block, but apparently it is (in this specific case). And I don't understand why.

3

The two inputs are surely not supposed to produce the same result.

Since \centerline{ab} expands to \hbox to \hsize{\hss #1\hss} it doesn't take you out of vertical mode (after ab has been typeset in restricted horizontal mode).

The command \⍽ (control space) is a horizontal command, so it starts a paragraph that's immediately ended by the blank line; the glue will be removed by \par.

So we have (finer details ignored)

<centered box with ab>
<parskip glue>
<indent box>
<parskip glue>
<indent box>cd

In the second example, the space token after \centerline{ab} appears in vertical mode, and space tokens in vertical mode are ignored. So we have

<centered box with ab>
<parskip glue>
<indent box>cd

because it's just the c that starts a paragraph.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.