
Some Suggestions for Typesetting Mathematical Formulae in LATEX Risi Kondor September 22, 2003 Some people hack LATEX like they hack computer code: as long as the syntax and the semantics are correct, they assume the document will be acceptable. Whilst LATEX generally does an excellent job of typesetting mathematics, we cannot expect a rule-based system to fully replace a professional typesetter. In various circumstances, manual adjustments are called for to improve the readability and aesthetic appeal of the ¯nal result. Delimiters In most cases, pairing with \left and \right producers delimiters of the ap- propriate size. Ocasionally, manual intervention is called for. 1. Limits above and below large operators such as \sum, \prod and \int often force the delimiters to be too large: 2 1=2 N \left(\sum_{i=1}^{N^2} x_i \right)^{1/2} x2 : 0 i 1 i=1 X This might not look so egregious by itself, but enclosing@ severalAsuch terms in an even larger set of delimiters or putting them under a square root sign can eventually produce absurd looking displays. The only way I know to avoid this problem is to control the size of the delimiters manually: 2 N 1=2 \Biggl(\sum_{i=1}^{N^2} x_i \Biggr)^{1/2} 2 xi : Ãi=1 ! X 2. The opposite problem occurs when the semantics or readability would require delimiters to grow, but they don't: 0 0 1=2 (· (σ (x x0) + σ (y y0)) + · (z z0)) x ¡ y ¡ ¡ 1 Setting the size of the outer pairs of parentheses to \big and \Big, re- spectively, brings out the natural rhythm of this formula: 1 2 0 0 = · σ (x x0) + σ (y y0) + · (z z0) : x ¡ y ¡ ¡ ³ ¡ ¢ ´ Spacing Mathematical formulae are spaced in units determined by the surrounding font. An em is usually about the width of a the letter \M". LATEX uses the following spaces in formulae: \, thin space (normally 3=18 of an em) \: medium space (normally 4=18 of an em) \; thick space (normally 5=18 of an em). The elementary constituents of formulae, called atoms, are grouped into eight categories, such as: ordinary, large operator, binary operator, relation, etc.. The default spacing is determined solely by the categories of the atoms on either side. To ¯ne tune spacing I de¯ne my own smaller spaces: 2 \ts tiny space, 18 em \newcommand{\ts}{\hspace{.11111em}} 1 \ts teeny-weeny space, 18 em \newcommand{\tts}{\hspace{.05555em}}. It also helps to de¯ne \newcommand{\<}[1]{\hspace{-0.11111em}#1\hspace{-0.11111em}}. 1 Typing \< before an operator will then reduce the space on both sides by 18 of an em. 1. Most books on TEX and LATEX mention that in¯nitesimals need to be separated by thin spaces (or less) as in b \int_a^b f(x)\,dx f(x) dx Za and dx\tts dy=r\tts dr\tts d\theta dxdy = rdrdθ: Otherwise, the function of d and what it refers to often become ambiguous, reducing the whole expression to a blur. 2. Binary operators such as +, , , etc. are usually surrounded by medium space on either side. This is great¡ 2 for clearly separating complicated terms in an equation, but is far too big for \micro-formulae" such as x , especially when embedded in dense text. 2 X 2 1 The soultion is to shave o® space on both sides. In most cases 9 em of negative space is su±cient, but for really short expressions I tend to take o® a full thinspace, as in x instead of x . 2X 2 X The same problem appears in displays, typically with + and operators connecting very simple terms. ¡ 3. The spacing of simple quanti¯ed formulae, such as n N, is illogical. Usually, it is best to take o® space on the two sides of8 , 2occasionally also 2 adding space after the quanti¯er, giving the more pleasing n N. 8 2 4. It is almost always necessary to add space between displayed fractions and a proceeding ordinary atom: 1 1 t ib g(x) = f(x) F = ¡ eiat dt: 2 a t2 + b2 Z0 Inserting a thin space and medium space, respectively, makes these dis- plays look much better: 1 1 t ib g(x) = f(x) F = ¡ eiat dt: 2 a t2 + b2 Z0 5. It is sometimes desirable to o®set the exponent by a thin space, as in ¤ ¡ ¤> ¡1 ¤ ¤ ¡ ¤> ¡1 ¤ p(y ) e y K y instead of p(y ) e y K y ; / / 1 where 2 18em space was added before the sign, but this might be a matter of personal taste. ¡ 6. Spacing is woefully inadequate in the intricate probability expressions that are the hallmark of Bayesian Statistics: p(x1; x2; : : : ; x θ); p(Y1 = y1; : : : ; Y = y θ1; θ2; : : : ; θ ) nj n nj m The judicious use of thin spaces and medium spaces around the paren- theses and the vertical separator combined with shrinking space around relation symbols in the argument makes these expressions much more read- able: p ( x1; x2; : : : ; x θ ); p ( Y1 = y1; : : : ; Y = y θ1; θ2; : : : ; θ ) n j n n j m 7. Sometimes when formulae start getting crowded it is even necessary to add space between factors. Writing Bayes' law as p(y x) p(x) p(x y) = j j p(y x) p(x) x j looks much better than P p(y x)p(x) p(x y) = j : (1) j p(y x)p(x) x j P 3 8. When a sentence ends with a displayed equation, a full stop right after the last mathematical symbol is easy to overlook, especially, when the formula ends with a busy fraction. Without a separating thin space, (1) would look like p(y x)p(x) p(x y) = j : j p(y x)p(x) j 9. In math mode there is no kearning,P so sometimes spacing needs to be adjusted simply to accomodate the varying shapes of di®erent symbols. The following are examples from [1] of cases when adding a thin space improves appearance: p2x p2 x plog x p log x ! [0; 1) [ 0; 1) Here are some formulae, also from [1] that bene¯t from removing a thin space: x2=2 x2=2 n= log n n=log n ! ¡2 ¡2 References [1] Donald E. Knuth. The TEXbook. Addison-Wesley, 1984. 4.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-