Sentences and paragraphs

Let's create our very first LATEX document, which will consist of just a few paragraphs.

As mentioned above, paragraph input is free-form. You type the words and separate them by spaces so that LATEX can distinguish between words. For these purposes, pressing Return is equivalent to inserting a space—it does not indicate the end of a line, but the end of a word. You tell LATEX that a sentence has ended by typing a period followed by a space. LATEX ignores extra spaces; typing three or three thousand will get you no more space between the words that these spaces separate than typing just one space. Finally, you tell LATEX that a paragraph has ended by leaving one or more blank lines. In summary: LATEX concerns itself only with the logical concepts end-of-word, end-of-sentence, and end-of-paragraph. Sounds complicated? An example should clear things up:

0.1

\documentstyle{article}
\begin{document}
Words within a sentence are ended by spaces.  One space
between words  is     equivalent      to any number. We are only
interested in separating      one    word      from        the
next, not in formatting       the space between them.
For these purposes, pressing Return
at the end of a line
and starting a new word on the next line
just serves to separate
words, not to cut a line short.
The end of a sentence is indicated by a period
followed by one or more spaces.

The end of a paragraph is indicated by leaving a blank line.
All this
means that we can type without too much regard for layout, and
the typesetter will sort things out for us.
\end{document}
produces the result

0.10.8Words within a sentence are ended by spaces. One space between words is equivalent to any number. We are only interested in separating one word from the next, not in formatting the space between them. For these purposes, pressing Return at the end of a line and starting a new word on the next line just serves to separate words, not to cut a line short. The end of a sentence is indicated by a period followed by one or more spaces.

The end of a paragraph is indicated by leaving a blank line. All this means that we can type without too much regard for layout, and the typesetter will sort things out for us.

Perhaps you would like to try running LATEX on the above input. Consult your local guide for details.

Note that we have learned more than just how LATEX recognises words, sentences and paragraphs. We've also seen how to specify our choice of document style and how to tell LATEX where our document begins and ends. Any material that is to be printed must lie somewhere between the declaration of \begin{document} and that of \end{document}. Definitions that are to apply to the entire document can be made before the declaration of the document beginning. The specification of document style must precede all other material.

In future examples we won't explicitly display the commands that select document style and delimit the start and end of the document. But if you wish to try any of the examples, don't forget to include those commands. The article document style will do for most of our examples. Of course, the preceding example looks not at all like an article because it is so short and because we specified no title or author information.

Most of what you need to know to type regular text is contained in the example above. When you consider that by far the majority of any document consists of straight text, it is obvious that LATEX makes this fabulously straightforward. LATEX will do all the routine work of formatting, and we simply get on with the business of composing.

LATEX does more than simply choose pleasing line breaks and provide natural spacing when setting a paragraph. Remember we said that TEX has inherited the knowledge of generations of professional printers—well part of that knowledge includes being on the look-out for ligatures. These are combinations of letters within words which should be typeset as a single special symbol because they will ``clash'' with each if this is not done. Have a look at these words

flight, flagstaff, chaff, fixation
and compare them with these
flight, flagstaff, chaff, fixation
See the difference? In the first set I let LATEX run as it usually does. In the second I overruled it somewhat, and stopped it from creating ligatures. Notice how the `fl', `ff', and `fi' combinations are different in the two sets—in the former they form a single symbol (a ligature) and in the latter they are comprised of two disjoint symbols. There are other combinations that yields ligatures, but we don't have to bother remembering any of them because LATEX will take care of these, too.

Notice, too, that LATEX has been taught how to hyphenate the majority of words. It will hyphenate a word if it feels that the overall quality of the paragraph will be improved. For long words it has been taught several potential hyphenation positions.

LATEX also goes to a lot of trouble to try to choose pleasing page breaks. It avoids ``widows'', which are single lines of a paragraph occurring by themselves at either the bottom of a page (where it would have to be the first line of a paragraph) or at the top of a page (where it would have to be the last). It also ``vertically justifies'' your page so that all pages have exactly the same height, no matter what appears on them. As testimony to the success of the pagebreaking algorithm, I have (to this point) not once chosen a page break in this document.