Chapter 2 Typesetting Text should know abo the asic stuff of cture you 2.1 The Structure of Text and Language The main point of writing a text is to convey ide or knowl feel this etext bet n ch h ure of the conte is different from other typesetting systems in that you just have to tell it the logical and semantic structure of a text.It then derives the typographical form of the text according to the'rules"given in the document class file and in various style files. The most important text unit in ITEX(and in typography)is the para d cal text un oapagapheToa ical form Oandpmragrap thought begins. ph should beein and if not,only line breaks should be used.If in doubt about paragraph breaks.think about your text as a conveyor of ideas and thoughts.If you have a paragraph break,but the old thought continues.it should be removed.If some totally new line of thought occurs in the same paragraph,then it should be broken. completely underestimate the importance o paragraph Many people do no the the folo and figure of
Chapter 2 Typesetting Text After reading the previous chapter, you should know about the basic stuff of which a LATEX 2ε document is made. In this chapter I will fill in the remaining structure you will need to know in order to produce real world material. 2.1 The Structure of Text and Language By Hanspeter Schmid <hanspi@schmid-werren.ch> The main point of writing a text, is to convey ideas, information, or knowledge to the reader. The reader will understand the text better if these ideas are well-structured, and will see and feel this structure much better if the typographical form reflects the logical and semantic structure of the content. LATEX is different from other typesetting systems in that you just have to tell it the logical and semantic structure of a text. It then derives the typographical form of the text according to the “rules” given in the document class file and in various style files. The most important text unit in LATEX (and in typography) is the paragraph. We call it “text unit” because a paragraph is the typographical form that should reflect one coherent thought, or one idea. You will learn in the following sections how to force line breaks with e.g. \\, and paragraph breaks with e.g. leaving an empty line in the source code. Therefore, if a new thought begins, a new paragraph should begin, and if not, only line breaks should be used. If in doubt about paragraph breaks, think about your text as a conveyor of ideas and thoughts. If you have a paragraph break, but the old thought continues, it should be removed. If some totally new line of thought occurs in the same paragraph, then it should be broken. Most people completely underestimate the importance of well-placed paragraph breaks. Many people do not even know what the meaning of a paragraph break is, or, especially in LATEX, introduce paragraph breaks without knowing it. The latter mistake is especially easy to make if equations are used in the text. Look at the following examples, and figure out
16 Typesetting Text why sometimes empty lines(paragraph breaks)are used before and after the equation,and sometimes not.(If you don't yet understand all commands Evamnla 1 \ldots when Einstein introduced his formula \beginfequation} e =m \cdot c-2 \ \end{equation} atd8eteonnsreroaportuga2gc Example 2 from which follows Kirchhoff's current law \8um-{k=1}m}I_k=0\;. \end{equation} Kirchhoff's voltage law can be derived \ldots ID-I_F I_R \end{equation} is the core of a very different transistor model.\ldots The In English texts there is a han alter c nds an ant.This is in this chapter explained ater The structuring of text even extends to parts of sentences.Most lan guages have very complicated punctuation rules,but in many languages (including German and English),you will get almost every comma right if you remember what it represents:a short stop in the flow of language.I you are not sure about where to put a comma,read the sentence aloud and hort breath at every comma.If this plac you fee e a short stop)a comma
16 Typesetting Text why sometimes empty lines (paragraph breaks) are used before and after the equation, and sometimes not. (If you don’t yet understand all commands well enough to understand these examples, please read this and the following chapter, and then read this section again.) % Example 1 \ldots when Einstein introduced his formula \begin{equation} e = m \cdot c^2 \; , \end{equation} which is at the same time the most widely known and the least well understood physical formula. % Example 2 \ldots from which follows Kirchhoff's current law: \begin{equation} \sum_{k=1}^{n} I_k = 0 \; . \end{equation} Kirchhoff's voltage law can be derived \ldots % Example 3 \ldots which has several advantages. \begin{equation} I_D = I_F - I_R \end{equation} is the core of a very different transistor model. \ldots The next smaller text unit is a sentence. In English texts, there is a larger space after a period that ends a sentence than after one that ends an abbreviation. LATEX tries to figure out which one you wanted to have. If LATEX gets it wrong, you must tell it what you want. This is explained later in this chapter. The structuring of text even extends to parts of sentences. Most languages have very complicated punctuation rules, but in many languages (including German and English), you will get almost every comma right if you remember what it represents: a short stop in the flow of language. If you are not sure about where to put a comma, read the sentence aloud and take a short breath at every comma. If this feels awkward at some place, delete that comma; if you feel the urge to breathe (or make a short stop) at some other place, insert a comma
2.2 Line Breaking and Page Breaking Finally,the paragraphs of a text should also be structured logically at a eherleoel by putting them i nto chapters,sections,subsections,and so on ever,th typograp ect otinefeactoaestacte s should be 2.2 Line Breaking and Page Breaking 2.2.1 Justified Paragraphs Books are often typeset with each line having the same length.LXTX inserts the necessary line breaks and spaces between words by optimizing the con- tents of a whole paragraph.If necessary,it also hyphenates words that would not fit comfortably on a line.How the paragraphs are typeset depends on the documen ere is no \or \newline starts a new line without starting a new paragraph w additionally prohibits a page break after the forced line break \newpage starts a new page \linebreak[n],\nolinebreak[n].\pagebreak[n],\nopagebreak[n] suggest places where a break may (or may not)happen.They enable the author to influence their actions with the optional argument n which can be set to a number between zero and four.By setting n to a value below 4,you leave IATEX the option of ignoring your command if the result would look very bad.Do not confuse these"break"commands with the"new"commands. Even when you give a "break com nand,DIEX still tries to even out the right bord he line and the total length of the page,as describ in th next section;thi can lead to unp gaps I you rea
2.2 Line Breaking and Page Breaking 17 Finally, the paragraphs of a text should also be structured logically at a higher level, by putting them into chapters, sections, subsections, and so on. However, the typographical effect of writing e.g. \section{The Structure of Text and Language} is so obvious that it is almost self-evident how these high-level structures should be used. 2.2 Line Breaking and Page Breaking 2.2.1 Justified Paragraphs Books are often typeset with each line having the same length. LATEX inserts the necessary line breaks and spaces between words by optimizing the contents of a whole paragraph. If necessary, it also hyphenates words that would not fit comfortably on a line. How the paragraphs are typeset depends on the document class. Normally the first line of a paragraph is indented, and there is no additional space between two paragraphs. Refer to section 6.3.2 for more information. In special cases it might be necessary to order LATEX to break a line: \\ or \newline starts a new line without starting a new paragraph. \\* additionally prohibits a page break after the forced line break. \newpage starts a new page. \linebreak[n], \nolinebreak[n], \pagebreak[n], \nopagebreak[n] suggest places where a break may (or may not) happen. They enable the author to influence their actions with the optional argument n, which can be set to a number between zero and four. By setting n to a value below 4, you leave LATEX the option of ignoring your command if the result would look very bad. Do not confuse these “break” commands with the “new” commands. Even when you give a “break” command, LATEX still tries to even out the right border of the line and the total length of the page, as described in the next section; this can lead to unpleasant gaps in your text. If you really want to start a “new line” or a “new page”, then use the corresponding command. Guess their names!
18 Typesetting Text IXTEX always tries to produce the best line breaks possible.If it cannot find a way to break the lines in a manner that meets its high standards,it ets oe i on the right of the par IXTEX then complains proce ng the inpu 1 its standard mand vents such over-long lines by increasing the inter-wor the final output is not optimal.In this case a warning ("underfull hbox")is given to the user.In most such cases the result doesn't look very good.The command \fussy brings lATEX back to its default behaviour. 2.2.2 Hyphenation EXTEX hyphenates words whenever necessary.If the hyphenation algorithm does not find the correct hyphenation points,remedy the situation by using the following commands to tell TEX about the exception. The command causes the words listed in the argument to be hyphenated only at the points marked by"".The argument of the command should only contain words built from normal letters,or rather signs that are considered to be normal letters by IyTEX. The hyphenation hints are stored for the language that is active when the hyphenation command occurs This means that if you the y you p comman ive in the lang The example below will allow"yphenation"to be hyphenated as well as Hyphenation",and it prevents"FORTRAN","Fortran"and "fortran"from being hyphenated at all.No special characters or symbols are allowed in the argument Example \hyphenation{FORTRAN Hy-phen-a-tion} The command \-inserts a discretionary hyphen into a word.This alsc becomes the only point hyphenation is allowed in this word.This command is especially useful for words containing special characters (e.g.accented
18 Typesetting Text LATEX always tries to produce the best line breaks possible. If it cannot find a way to break the lines in a manner that meets its high standards, it lets one line stick out on the right of the paragraph. LATEX then complains (“overfull hbox”) while processing the input file. This happens most often when LATEX cannot find a suitable place to hyphenate a word.1 Instruct LATEX to lower its standards a little by giving the \sloppy command. It prevents such over-long lines by increasing the inter-word spacing—even if the final output is not optimal. In this case a warning (“underfull hbox”) is given to the user. In most such cases the result doesn’t look very good. The command \fussy brings LATEX back to its default behaviour. 2.2.2 Hyphenation LATEX hyphenates words whenever necessary. If the hyphenation algorithm does not find the correct hyphenation points, remedy the situation by using the following commands to tell TEX about the exception. The command \hyphenation{word list} causes the words listed in the argument to be hyphenated only at the points marked by “-”. The argument of the command should only contain words built from normal letters, or rather signs that are considered to be normal letters by LATEX. The hyphenation hints are stored for the language that is active when the hyphenation command occurs. This means that if you place a hyphenation command into the preamble of your document it will influence the English language hyphenation. If you place the command after the \begin{document} and you are using some package for national language support like polyglossia, then the hyphenation hints will be active in the language activated through polyglossia. The example below will allow “hyphenation” to be hyphenated as well as “Hyphenation”, and it prevents “FORTRAN”, “Fortran” and “fortran” from being hyphenated at all. No special characters or symbols are allowed in the argument. Example: \hyphenation{FORTRAN Hy-phen-a-tion} The command \- inserts a discretionary hyphen into a word. This also becomes the only point hyphenation is allowed in this word. This command is especially useful for words containing special characters (e.g. accented 1Although LATEX gives you a warning when that happens (Overfull \hbox) and displays the offending line, such lines are not always easy to find. If you use the option draft in the \documentclass command, these lines will be marked with a thick black line on the right margin
2.3 Ready-Made Strings 19 characters),because TEX does not automatically hyphenate words con- taining special characters. I think this is docious al\-i\-do\-cious Several words can be kept together on one line with the command \mbox{tert} It causes its argument to be kept together under all circumstances. ph(filename}}should contain the name of the file \fbox is similar to \mbox,but in addition there will be a visible box drawn around the content. 2.3 Ready-Made Strings In some of the examples on the previous pages,you have seen some very simple ITEX commands for typesetting special text strings: Command Example Descrintion \today March 9,2021 Current date \TeX TEX Your favorite typesetter \LaTeX The Name of the Game \LaTeXe TEX 2e The current incarnation 2.4 Special Characters and Symbols 2.4.1 Quotation Marks use the"for quotation mark there are spec gga 8q1 DIEA,us cent ope and two(ver ng quotation mark of each. otes you use just Please press the 'x'key. "Please press thex'key
2.3 Ready-Made Strings 19 characters), because LATEX does not automatically hyphenate words containing special characters. I think this is: su\-per\-cal\-% i\-frag\-i\-lis\-tic\-ex\-pi\-% al\-i\-do\-cious I think this is: supercalifragilisticexpialidocious Several words can be kept together on one line with the command \mbox{text} It causes its argument to be kept together under all circumstances. My phone number will change soon. It will be \mbox{0116 291 2319}. The parameter \mbox{\emph{filename}} should contain the name of the file. My phone number will change soon. It will be 0116 291 2319. The parameter filename should contain the name of the file. \fbox is similar to \mbox, but in addition there will be a visible box drawn around the content. 2.3 Ready-Made Strings In some of the examples on the previous pages, you have seen some very simple LATEX commands for typesetting special text strings: Command Example Description \today March 9, 2021 Current date \TeX TEX Your favorite typesetter \LaTeX LATEX The Name of the Game \LaTeXe LATEX 2ε The current incarnation 2.4 Special Characters and Symbols 2.4.1 Quotation Marks You should not use the " for quotation marks as you would on a typewriter. In publishing there are special opening and closing quotation marks. In LATEX, use two ` (grave accent) for opening quotation marks and two ' (vertical quote) for closing quotation marks. For single quotes you use just one of each. ``Please press the `x' key.'' “Please press the ‘x’ key