8

Does \end command issue a \vfill command? I notice that in plain TeX, you have a \bye that issues it but after some experimentation I think \end also issues a \vfill, which is rather confusing.

Example:

Case 1:
Hello World\vfil
Hello World\end

Case 2:
Hello World\vfill
Hello World\end

Comparing the above two cases, we note that Case 1 place both lines of texts normally while in Case 2 TeX placed the second line of text in the middle. Now, if \end did not come with a \vfill, the first case would have also place the second line of text in the middle. This is where I am confused.

  • 4
    According to tex by topic "The \end command – which is only allowed in external vertical mode – terminates a TEX job, but only if the main vertical list is empty and \deadcycles = 0. If this is not the case the combination \hbox{}\vfill\penalty−2^30 is appended, which forces the output routine to act." – Ulrike Fischer May 7 '16 at 21:18
2

Here's David Carlisle's answer in Don knuth words (The TeXbook, page 264)

When TeX sees an \end command, it terminates the job only if the main vertical list has been entirely output and if \deadcycles=0. Otherwise it inserts the equivalent of

              \line{} \vfill \penalty-'10000000000 

into the main vertical list, and prepares to read the `\end' token again. This has the effect of invoking the output routine repeatedly until everything has been shipped out. In particular, the last column of two-column format will not be lost.

6

in tex.web you find

@<Declare act...@>=
function its_all_over:boolean; {do this when \.{\\end} or \.{\\dump} occurs}
label exit;
begin if privileged then
  begin if (page_head=page_tail)and(head=tail)and(dead_cycles=0) then
    begin its_all_over:=true; return;
    end;
  back_input; {we will try to end again after ejecting residual material}
  tail_append(new_null_box);
  width(tail):=hsize;
  tail_append(new_glue(fill_glue));
  tail_append(new_penalty(-@'10000000000));@/
  build_page; {append \.{\\hbox to \\hsize\{\}\\vfill\\penalty-'10000000000}}
  end;
its_all_over:=false;
exit:end;

where

      tail_append(new_glue(fill_glue));

implies, as you suspected, that fill glue is added by the primitive.

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.