LaTeX for the Slightly Timid

Are you used to the simplicity of your old DOS word processor, and afraid of the complexity of LaTeX? This article tells you how to write a beautiful letter—and gets you started using LaTeX.
Outputting Your Document

Now, suppose that you want to see what your letter really looks like—you certainly don't want to send it as it appears in your letter.tex file. So, after saving the file and exiting the editor (or just popping over to another virtual console), from within the directory where letter.tex is, type latex letter.tex. LaTeX will format your file it in a way that can be displayed and printed. The formatted file will be called letter.dvi; DVI stands for “device independent”, which means that your file can be displayed or printed using a number of programs. If you are using X-Windows, type xdvi letter.dvi to see what you have written. If you are not running X-Windows, you may be able to use dvgt, which comes with some distributions and is also available from sunsite.unc.edu in the /pub/Linux/apps/tex/dvi/ directory. However, its user interface is not the best possible for a novice, and xdvi is certainly easier to use.

Special Formatting Commands

“The text looks great!” you say, “But I didn't just want to type plain text in, I wanted to add italics and underlining and mathematical equations and footnotes and...” (If you didn't get past the command latex letter.tex, I'll give some hints for debugging your letter later.) Most of these commands are easy enough and very similar to the commands used so far.

For example, to create a footnote, type footnote{This is the text of the footnote.} wherever you want the footnote to appear. Note that you will have to be careful with spacing—put the footnote command after any punctuation, but before any trailing space. LaTeX will make a complete list of the footnotes and number them correctly. However, if you want to number them yourself, use footnote[num]{text} instead. Remember that brackets contain optional things, so you don't need to number the footnotes yourself unless automatic numbering won't do what you want.

Creating italic and bold text is very similar, except the bold and italic commands are actually inside the braces instead of outside. This is so that more than one command can apply to a region. Here are some examples: I can make some words {\bf bold}, {em italic}, {em\bf bold-italic}, or {em have a {\bf bold} word in a group of italic words}. (em stands for emphasized text; it, which stands for italic, works as well.) LaTeX has many other type styles which work the same as bold and italic; they are documented in all LaTeX reference books.

Another method used in LaTeX for text formatting is similar to the one you used for the letter environment with the \begin and end commands. For example, here is how to center text:

\begin{center}
Here is my centered text,\\
here are two\\
more lines of centered text.
end{center}

Again, as in the letter, the double backslashes signal a new line. The \begin and end commands, along with {table}, {quotation} and many other options, are documented in the reference manuals.

To sum up, when dealing with some text which is to be put in a separate place on the page, as in footnote and opening, the text goes after the command in braces. When dealing with a few words in the flow of the main text, the command (like em and \bf) goes within the brackets along with the text, to set it off from the text around it. And finally, when dealing with larger blocks of text within the document which need to be displayed specially, such as centered text or a table, commands such as \begin{center} and end{center} are used around the text.

A note about line breaks and spacing: When LaTeX sees a line break in your typed-in text, it just assumes that your line got too long and you went to the next line to keep entering text for the same paragraph. LaTeX knows better than you do how many words fit on a line, so one line break just doesn't register with LaTeX. Two or more line breaks (one or more blank lines), on the other hand, are interpreted as a “new paragraph”, so LaTeX will skip a line and/or indent, whatever is appropriate in your document style, and will not put that extra new line in the output. If you want to force LaTeX to break a line without a new paragraph, you must use a \\, a double backslash.

LaTeX also interprets extra spaces and extra empty lines just as it would one space or one empty line. You probably won't know exactly how many lines to leave blank; just leave it up to LaTeX. As in the letter above, LaTeX knows where on the page to put everything so it looks good, so let it do the work. On the other hand, if LaTeX does not know how to make things look right, you do have some control. As above, use \\ (or equivalently, linebreak) to specify a line break, and pagebreak to begin a new page. If this doesn't work, see one of the books about it, or else ask your local “TeXnician” (TeX-speak for “TeX guru”).

Finally, you can add horizontal and vertical space with hspace{width} and vspace{height} respectively, where width and height refer to the amount of space you want added. For example, hspace{.25in} would make the current line be at least a quarter inch high; it's the equivalent of an infinitely thin letter a quarter of an inch high. This may not work at the beginnings of paragraphs, the end of lines, the end of pages, and various other spots. Again, see the book if you can't get it to work the way you want!

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix