12.07.2015 Views

The memoir class - The UK TeX Archive

The memoir class - The UK TeX Archive

The memoir class - The UK TeX Archive

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

E.2. La<strong>TeX</strong> filesto get the values of the arguments, and then the macro name is replaced by the definition.<strong>The</strong> expansion processor then looks at the first token in the replacement, and if thatis expandible it expands that, and so on.Nominally, the eventual output from the expansion processor is a stream of nonexpandibletokens. <strong>The</strong>re are ways, however of controlling whether or not the expansionprocessor will actually expand an expandible token, and to control the order in whichthings get expanded, but that is where things get rapidly complicated.<strong>The</strong> layout processor works something like this. Ignoring maths, <strong>TeX</strong> stores what youtype in two kinds of lists, vertical and horizontal. As it reads your words it puts them oneafter another in a horizontal list. At the end of a paragraph it stops the horizontal list andadds it to the vertical list. At the beginning of the next paragraph it starts a new horizontallist and adds the paragraph’s words to it. And so on. This results in a vertical list ofhorizontal lists of words, where each horizontal list contains the words of a paragraph.It then goes through each horizontal list in turn, breaking it up into shorter horizontallists, one for each line in the paragraph. <strong>The</strong>se are put into another vertical list, so conceptuallythere is a vertical list of paragraphs, and each paragraph is a vertical list of lines,and each line is a horizontal list of words, or alternatively one vertical list of lines. Lastlyit chops up the vertical list of lines into page sized chunks and outputs them a page at atime.<strong>TeX</strong> is designed to handle arbitrary sized inserts, like those for maths, tables, sectionaldivisions and so forth, in an elegant manner. It does this by allowing vertical spaces on apage to stretch and shrink a little so that the actual height of the typeblock is constant. Ifa page consists only of text with no widow or orphan then the vertical spacing is regular,otherwise it is likely to vary to some extent. Generally speaking, <strong>TeX</strong> is not designed totypeset on a fixed grid, but against this other systems are not designed to produce highquality typeset mathematics. Attempts have been made to tweak La<strong>TeX</strong> to typeset on afixed grid but as far as I know nobody has been completely successful.<strong>TeX</strong> works somewhat more efficiently than I have described. Instead of reading thewhole document before breaking paragraphs into lines, it does the line breaking at the endof each paragraph. After each paragraph it checks to see if it has enough material for apage, and outputs a page whenever it is full. However, <strong>TeX</strong> is also a bit lazy. Once it hasbroken a paragraph into lines it never looks at the paragraph again, except perhaps to splitit at a page break. If you want to change, say, the width of the typeblock on a particularpage, any paragraph that spills over from a previous page will not be reset to match thenew measure. This asynchronous page breaking also has an unfortunate effect if you aretrying to put a note in say, the outside margin, as the outside is unknown until after theparagraph has been set, and so the note may end up in the wrong margin.E.2 LATEX FILES<strong>The</strong> aux file is the way La<strong>TeX</strong> transfers information from one run to the next and theprocess works roughly like this.• <strong>The</strong> aux file is read at the start of the document environment. If \nofiles hasnot been specified a new empty aux file is then created which has the side effect ofdestroying the original aux file.431

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!