



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to latex, a typesetting system, focusing on topics such as typing text, units, space, lines and boxes, margins, tables, figures, homemade commands, and citations. It covers the use of reserved characters, creating spaces, making lines and boxes, setting margins, and creating tables and figures. It also explains how to create homemade commands and manage citations and references.
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Since LATEX is a markup language, any text we type appears on the page, unless it contains one of the nine reserved characters of LATEX, listed below.
\ { } & _ ^ % ~ #
If we want those characters to appear on the page, we must precede them by a backslash, or, in the special case of the backslash itself, we must use the command \verb. In math mode, we can use the command \backslash. Note that there are three kinds of dash-objects. Hyphens are very short, and are typed the way you would expect, using ”-”. Dashes, as in the range 1–2, are wider, and are typed using --. If you feel a need for a wide—dash, you can use ---.
Lengths in LATEX can be given in a number of Units. cm Centimeters em The width of the letter M in the current font ex The height of the letter x in the current font in Inches pc Picas (1pc = 12pt) pt Points (1in = 72pt) mm Millimeters
3 Space
The most direct way to make spaces is simply to use the \hspace and \vspace commands, for horizontal and vertical space, respectively. Each takes one argument: a distance specification for the size of the space. The width or height of the space can be positive or negative. Note that \vspace can only be used in vertical mode; that is, when you are starting a new para- graph or starting a float or doing something else that shifts text vertically. It will not work in a line. LATEX also has a number of predefined spaces. To produce a space with fixed width, and which cannot be used as a line break, you may use the ~ character. This would typically be used to separate initials of an author, or in other situations where we don’t want to have a single letter or initial ending a line. More often, we don’t mind a line break, and want the space to shrink or grow according to the justification requirements on the line. In that case we make a standard space using \ ; backslash-space. There are wider stretchy spaces available to us: \quad and \qquad. There is also a “thin space”: ,. The following words are separated by a thin space, a standard space, a quad, and a qquad, respectively.
space space space space space
There are also predefined vertical spaces: \smallskip \medskip, and \bigskip, that behave as their names imply. There are also some exceptionally stretchy spaces that we can use to push text around. For example, the following line is set using the command text\hfill text. The line below it was set using text\hfill text\hfill text. text text text text text You get the idea: \hfill makes enough space to fill the line in question com- pletely. If more than one \hfill appears on a line, then the two negotiate over how much space they each get.
4 Lines and Boxes
There are a variety of ways to make lines and boxes in LATEX. The most basic is to make a horizontal rule using \hrule.
Table 1: Results from a poll that probably never happened. What is your favorite animal? Animal Percentage of respondents Dog 43% Cat 44% Schwarzenegger 9% We kill animals 4%
but must be converted to encapsulated postscript before it can be included in this document.
8 Homemade commands
It was the best of ideas. It was the worst of ideas. LATEX was conceived as a programming language. This is what makes it harder to process using a wysiwyg interface, but it also allows us to make our own shortcuts. If you know that a particular expression will appear repeatedly in your document, you can make an abbreviation for it, or even a command that allows you to specify arguments. In our case, the sequence “It was the best of fill in the blank. It was the worst of fill in the blank.” is to appear many times in this section, so we created a command as follows:
\newcommand{\dickens}[1]{It was the best of #1. It was the worst of #1.}
This command takes one argument, which appears wherever a #1 appears in the text for the command. Thus, to typeset “It was the best of examples. It was the worst of examples.”, we need only to type \dickens{examples}.
9 Citations and References
In technical documents there are many references to typographical objects from the document, and citations of materials from outside the document. TEX [1] and LATEX [2] lets us keep track of those citations by name, rather than number. Using the “thebibliography” environment gives us automatic
Figure 1: Cats take vengeance on 4% of respondents [3].
numbering of our references, while associating those numbers with names, so that we can refer to the references using the \cite command. Likewise, for internal references, such as those to Figure 1, we can assign labels to a counter using the \label command, and refer to them using the \ref command.
References
[1] Knuth, D., The TEXbook, Addison-Wesley, Reading, 1984.
[2] Lamport, L., LATEX: A Document Preparation System, Addison- Wesley, Reading, 1986.
[3] Watterson, B., Homicidal Psycho Jungle Cat, Andrews McMeel, New Jersey, 1994.