Skip to main content
main-content

Über dieses Buch

"Why is 'lEX so hard to use?" is the most frequent comment/complaint made by (frustrated) 'lEX users. The answer: Because it is programmable (has many features commonly found in programming languages), because it pays attention to detail, and because its creator has developed it for his own use (perhaps also his administrative assistant's) and not for general use. The material presented here is a direct result of this complaint and is an attempt to make it easier for inexperienced users to get the kind of high-quality typesetting that is possible with 'lEX. The material is based on classes taught since 1985, and on the author's personal experience with 'lEX, which includes writing three books and numerous articles, handouts, and letters. Both introductory and advanced material is included here. There are many examples as well as a detailed discussion of topics, such as \ valign and \emergencystretch, that are only briefly touched upon in The TpJXbook. Chapter 20 describes the macros used to typeset this book; it also lists the METAFONT programs for the special characters used.

Inhaltsverzeichnis

Frontmatter

1. Introduction

Abstract
TEX is not written TEX, it is not spelled ‘T’ ‘E’ ‘X’, and it is not pronounced “tex”. It is written TEX (a trademark of the AMS), it is spelled with the Greek letters Tau Epsilon Chi, and it is pronounced “tech” or rather “teck”.
David Salomon

2. Advanced Introduction

Abstract
This chapter is an advanced introduction to TEX, stressing the main parts, main operations, and certain advanced concepts. As with most other presentations of this type, some terms have to be mentioned before they are fully introduced, so the best way to benefit from this material is to read it twice.
David Salomon

3. Boxes and Glue

Abstract
Boxes and glue are two of the main tools used by TEX. A box is an indivisible rectangular structure that can hold text and other items. Glue is simply spacing. It can be horizontal or vertical spacing, and it can be made as rigid or as flexible as desired.
David Salomon

4. Paragraphs

Abstract
To understand paragraphs, the reader should be familiar with the following short summary of TEX’s main operations and modes (see [Ch. 13] for a more detailed discussion of modes).
David Salomon

5. Macros

Abstract
A command starting with a ‘\’ is called a control sequence. If it consists of letters only (catcode 11), it is called a control word; if it consists of a nonletter (any catcode ≠ 11), it is called a control symbol. New control sequences can be defined by the user by means of \def and are called macros. A macro is thus either a control word or a control symbol defined by the user.
David Salomon

6. Conditionals

Abstract
As a general rule, people with little or no experience in computer programming find it hard to use TEX to its full potential. They prefer to use it on a higher level, with the aid of LaTEX or a similar macro package. The reason for this is that TEX is, in a sense, a programming language, and writing a TEX source file is like writing a computer program. Conditionals are an important part of any programming language, since they are the key to making decisions, and to performing loops. This is why conditionals have been included in TEX, and they are an important part of every nontrivial TEX job.
David Salomon

7. Examples of Macros

Abstract
Computer programming is best studied by practicing it, and writing macros is computer programming. The examples presented here have been carefully selected. They are simple to understand; each illustrates an important point, a useful technique, or a common pitfall in macro writing; and most either are useful in practice or can easily be modified to make them useful. They are not arranged in any special order. They range from the simple (such as the slanted lines) to the complex (verbatim listing), and from the useful (dropshadow) to the esoteric (the grid macros).
David Salomon

8. Tokens and File I/O

Abstract
It has been mentioned elsewhere (page v) that TEX is programmable. It has features that are found in most programming languages, and three such features are discussed in this chapter.
David Salomon

9. Multipass Jobs

Abstract
Certain typesetting problems, mostly those having to do with cross-referencing in a document, can be solved with a multipass job. Normally, two or three passes are necessary. The basic idea is to write a TEX program with macros for all passes and to run it as many times as necessary. In the first pass, certain macros are expanded, and they write the necessary cross-reference data on an auxiliary file. In the second pass, the file is input, and other macros are expanded, based on the information read. Another auxiliary file is written by the second pass, either to be read by the third pass (if one is necessary) or to be ignored.
David Salomon

10. Special Topics

Abstract
Certain features of TEX—notably registers, macros, recursion, token strings and conditionals—make it into a programming language. As a result, it can do more than typesetting. Here we show how TEX can be used for calculations, and how it can interface with other applications.
David Salomon

11. Leaders

Abstract
A leader is a very common device used by typesetters to lead the eye of the reader across the page. Here is a typical example from a table of contents:
David Salomon

12. Tables

Abstract
“TEX is intended for the creation of beautiful books—and especially for books that contain a lot of mathematics.” The purpose of this chapter is to convince the reader that the above quote (from [v]) remains valid after the word “mathematics” is replaced by the word “tables.”
David Salomon

13. Advanced Math

Abstract
In general, mathematical typesetting with TEX is easy to learn, and the results far surpass anything created by commercial word processors or page layout software. As a result, this chapter treats only those topics that may present problems to the average user or that are not treated in detail in The TEXbook.
David Salomon

14. Line & Page Breaks

Abstract
The concepts of badness and penalties are central to these algorithms, which themselves are of interest to the advanced user. The concept of badness was described in section 3.16. Penalties were discussed in the Introduction (page 5. The reader should review these before reading any further, but here is a short recap.
David Salomon

15. Handling Errors

Abstract
The novice user should become familiar with [Ch. 6, Ch. 27] before reading any farther. The notation [§xxx] is heavily used here, for the benefit of advanced readers who want a more detailed understanding of error handling. However, there is no need to consult the actual WEB code in order to understand error messages and respond to them.
David Salomon

16. Output Routines

Abstract
The notation OTR is used for output routine. It is the subject of the next several chapters.
David Salomon

17. OTR Techniques: I

Abstract
The following techniques are discussed in this chapter and are applied to practical situations:
  • ■ Breaking up \box255 in the OTR into individual lines by means of the \lastxx commands.
  • ■ Identifying individual lines or paragraphs to the OTR by means of \rightskip, \parshape, or the depth of \box255.
  • ■ Attaching very small amounts of \kern to certain lines of text, to identify those lines to the OTR as special.
  • ■ Placing large negative penalties at certain points in the document. This has the effect of invoking the OTR at those points. The OTR does not have to ship out anything.
  • ■ Attaching very small vboxes below certain lines, to identify them to the OTR as special lines that require special treatment.
  • ■ Using marks. This is a common OTR technique.
  • ■ Using a 2-pass technique where, in the first pass, certain information is written on a file, to be read by the second pass. Certain complex problems may even call for a multipass job.
David Salomon

18. OTR Techniques: II

Abstract
Certain typesetting problems can only be handled by the OTR. Many times, such a problem is solved by communicating with the OTR. Chapter 17 discusses communication from V mode, where certain clues (such as a small piece of glue or kern, or a box with small dimensions) are placed between lines of text. The OTR searches \box255 for clues and, on finding them, modifies the document in the desired way in the vicinity of the clue.
David Salomon

19. Insertions

Abstract
Insertions are considered one of the most complex topics in TEX. Many users master topics such as tokens, file I/O, macros, and even OTRs before they dare tackle insertions. The reason is that insertions are complex, and although The TEXbook does cover all the relevant material, it is somewhat cryptic regarding insertions and lacks simple examples. The main discussion of insertions takes place on [115–125], where TEX’s registers are also discussed. Examples of insertions are shown, mostly without explanations, on [363–364, 423–424]. Therefore, this chapter is definitely needed. It tries to explain insertions in detail and shows specific, simple examples. Concepts are developed gradually, and the ultimate truth is revealed in steps.
David Salomon

20. Example Format

Abstract
As a last example of an advanced application of TEX, the macros used to typeset this book are presented and discussed. As an extra bonus, the METAFONT programs for the special characters used here are also listed, but without any discussion.
David Salomon

Backmatter

Weitere Informationen