New answers tagged

2

Ouch, just minutes after I posted the question, I think I’ve found the answer myself: line 13773ff. The next two parameters, |num| and |den|, are positive integers that define the units of measurement; they are the numerator and denominator of a fraction by which all dimensions in the \.{DVI} file could be multiplied in order to get lengths in units of $10^...


1

The (commented) source code is sold as a book: Volume B: TeX: The program. A documented listing of the source code of the TeX interpreter of Computers and Typesetting.


8

If you have tex.web, you can do weave tex.web and then tex tex.tex (or pdftex). This is the first page: The PDF is anyway already available on TeX Live by texdoc tex.


3

Some complements to wipet's good answer. The definitions in plain.tex are as follows (lines 575–578): \def\line{\hbox to\hsize} \def\leftline#1{\line{#1\hss}} \def\rightline#1{\line{\hss#1}} \def\centerline#1{\line{\hss#1\hss}} You can notice that \line is just shorthand for \hbox to\hsize, so the call \line{\hss"hello world\the\catcode`\ "\hss} ...


13

\centerline is defined by \def\centerline#1{\line{\hss#1\hss}} but \line is defined by \def\line{\hbox to\hsize}. It means that \line{next text} does not take the next text as parameter. The next text is processed inside \hbox primitive in main processor of TeX. If there is an assignment (like \catcode setting) then this is done immediately and then next ...


8

If you are willing to use a macro package for that, I can recommend the compact opmac macros. They provide access to a multitude of LaTeX's features in a simple manner. \input opmac \maketoc \sec Hello World \bye If you want to implement it on your own, you can just look at opmac.tex to get inspiration. The source is very readable and easy to ...


6

Joseph Wright's answer is to the point: conserving memory was Knuth's main concern when defining the primitives dealing with box registers. There are however some subtle points. A box register can be void or it can contain a horizontal box (from \hbox) or a vertical box (from \vbox or \vtop). If you do \box0 (zero can be any other valid register number) ...


4

The box in TeX is implemented (roughly speaking) as a pointer to the vertical/horizontal list of typesetting material included in such box and this data structure can be large and it resides in main TeX memory. When you say \box0 at some place of outer material then only the pointer is placed here and the pointer of box0 is newly set to NULL. The contents of ...


10

At the time TeX was written, conserving memory was important. Typically, when a box has been used the content is no longer needed in the original (i.e. it will be moved to some other box), so memory can conveniently be reclaimed with the behaviour that \box clears the box. When this is not the case, \copy is available. Notably, a box is not a fixed item, ...



Top 50 recent answers are included