• Tidak ada hasil yang ditemukan

Dimensions, hyphenation, justification, and breaking

or scaling; and on printers, even at 600dpi, fine oblique lines or curves can still sometimes be seen to stagger the dots.

At the same time, many dimensions in LATEX’s preprogrammed formatting are specially set up to be flexible: so much space, plus or minus certain limits to allow the system to make its own adjust-ments to accommodate variations like overlong lines, unevenly-sized images, and non-uniform spacing around headings.

TEX uses a very sophisticated justification algorithm to achieve a smooth, even texture to normal paragraph text. The program-ming for this has been borrowed by a large number of other DTP systems, and users of these are often quite unaware that they are in fact using a significant part of TEX in their work. Occasionally, however, you will need to hand-correct an unusual word-break or line-break, and there are facilities for doing this on individual occasions as well as throughout a document.

2.8.1 Specifying size units

Most people in printing and publishing habitually use points and picas and ems. Some designers use cm and mm. Many English-language speakers still use inches. You can specify lengths in LATEX in any of these units, plus some others (see Table 2.2).

The em can cause beginners some puzzlement because it’s based on the ‘point size’ of the type, which is itself misleading.

The point size refers to the depth of the metal body on which foundry type was cast in the days of metal typesetting, not the printed height of the letters themselves. Thus the letter-size of 10pt type in one face can be radically different from 10pt type in another (look at the table on p. 150, where all the examples are 10pt). An em is the height of the type-body in a specific size, so 1em of 10pt type is 10pt and 1em of 24pt type is 24pt.

Another name for a 1em space is a ‘quad’, and LATEX has a command \quad for leaving exactly that much horizontal space. A special name is given to the 12pt em, a ‘pica’ em, as it has become a fixed measure in its own right.

2.8. DIMENSIONS, HYPHENATION, JUSTIFICATION, AND BREAKING

Table 2.2:Units in LATEX Unit Size

Printers’ fixed measures

pt Anglo-American standard points (72.27 to the inch) pc pica ems (12pt)

bp Adobe ‘big’ points (72 to the inch) sp TEX ‘scaled’ points (65,536 to the pt)

dd Didot (European standard) points (67.54 to the inch) cc Ciceros (European pica ems, 12dd)

Printers’ relative measures

em ems of the current point size (historically the width of a letter ‘M’ but see below)

ex x-height of the current font (height of letter ‘x’) Other measures

cm centimeters (2.54 to the inch) mm millimeters (25.4 to the inch) in inches

If you are working with other DTP users, watch out for those who think that Adobe points (bp) are the only ones. The difference is only .27pt per inch, but in 1000of text (a full page of A4) that’s 2.7pt, which is nearly 1mm, enough to be clearly visible if you’re trying to align one sample with another.

2.8.2 Hyphenation

LATEX hyphenates automatically according to the language you use (see § 2.8.6). To specify different breakpoints for an indi-vidual word, you can insert soft-hyphens (discretionary hyphens, done with \-) wherever you need them, for example:

Formatting information 

 

37



When in Mexico, we visited Popoca\-tépetl by helicopter.

To specify hyphenation points for all occurrences of a word, use the \hyphenation command in your preamble (see the panel

‘The Preamble’ on p. 54 ) with one or more words in its argu-ment, separated by spaces. This will even let you break ‘helico-pter’ correctly. In this command you use normal hyphens, not soft-hyphens.



\hyphenation{helico-pter Popoca-tépetl im-mer-sion}

If you have frequent hyphenation problems with long, unusual, or technical words, ask an expert about changing the value of

\spaceskip, which controls the flexibility of the space between words. This is not something you would normally want to do, as it can change the appearance of your document quite significantly.

If you are using a lot of unbreakable text (see next section and also § 6.6.1) it may also cause justification problems. One possible solution to this is shown in § 9.3.

2.8.3 Unbreakable text

To force LATEX to treat a word as unbreakable, use the \mbox com-mand: \mbox{pneumonoultramicroscopicsilicovolcanoconiosis}.

This may have undesirable results, however, if you change

mar-gins or the width of the text: pneumonoultramicroscopicsilicovolcanoconiosis…

To tie two words together with an unbreakable space (hard space), use a tilde (˜) instead of the space (see the list on p. 31 in

§ 2.5.1). This will print as a normal space but LATEX will never break the line at that point. You should make this standard typing practice for things like people’s initials followed by their surname, as in Prof. D. E. Knuth: Prof.\ D.˜E.˜Knuth.

2.8. DIMENSIONS, HYPHENATION, JUSTIFICATION, AND BREAKING

Note that a full point after a lowercase letter is treated as the end of a sentence, and creates more space before the next word. Here, after ‘Prof.’, it’s not the end of a sentence, and the backslash-space forces LATEX to insert just an ordinary word-space because it’s OK to break the line after ‘Prof.’, whereas it would look wrong to have initials separated with Prof. D.E. Knuth broken over a line-end.

2.8.4 Dashes

For a long dash — what printers call an ‘em rule’ like this — use three hyphens typed together, like˜--- this, and bind them to the preceding word with a tilde to avoid the line being broken before the dash. It’s also common to see the dash printed without spaces—like that: the difference is purely æsthetic. Never use a single hyphen for this purpose.

Between digits like page ranges (35–47), it is normal to use the short dash (what printers call an en-rule) which you get by typing two hyphens together, as in 35--47. If you want a minus sign, use math mode (§ 2.9).

2.8.5 Justification

The default mode for typesetting is justified (two parallel margins, with word-spacing adjusted automatically for the best optical fit).

In justifying, LATEX will never add space between letters, only between words. There is a special package called so (‘space-out’) if you need special effects like letter-spacing, but these are best left to the expert.

There are two commands \raggedright and \raggedleft which set ragged-right (ranged left) and ragged-left (ranged right). Use them inside a group (see the panel ‘Grouping’ on p. 154 ) to confine their action to a part of your text.

These modes also exist as ‘environments’ (see the last paragraph of § 3.2) called raggedright and raggedleft which are more convenient when applying this formatting to a whole paragraph or more, like this one.

Formatting information 

 

39



\begin{raggedleft}

These modes also exist as environments called raggedright and raggedleft which is more convenient when applying this formatting to a whole paragraph or more, like this one.

\end{raggedleft}

Ragged setting turns off hyphenation. There is a package ragged2e which retains hyphenation in ragged setting, useful when you have a lot of long words.

2.8.6 Languages

LATEX can typeset in the native manner for several dozen lan-guages. This affects hyphenation, word-spacing, indentation, and the names of the parts of documents used as headings (e.g. Table of Contents).

Most distributions of LATEX come with US English and one or more other languages installed by default, but it is easy to add the babel package and specify any of the supported languages or variants, for example:



\usepackage[frenchb]{babel}

...

\selectlanguage{frenchb}

Changing the language with babel automatically changes the names of the structural units and identifiers like ‘Abstract’, ‘In-dex’, etc. to their translated version. For example, using French as above, chapters will start with ‘Chapitre’.10

10Note that the babel package also sets the hyphenation patterns provided your version of LATEX has them precompiled (see the start of your log files for a list).

For other languages you need to set the hyphenation separately (outside the scope of this book).