# Getting Started with LaTeX on unix

## 1. What you'll find here

This document attempts to provide simple practical directions for linguists at Penn who want to use LaTeX on our unix machines (babel, unagi, linc, etc.). In the interests of simplicity it does not go into complications or alternative possibilities. (See the LaTeX for Linguists page for more complete information).

## 2. How to use LaTeX

Here are the commands you should use to format LaTeX files from the unix prompt. But emacs actually provides a special tex-mode'' with commands tailored to editing LaTeX files. Some of these commands are also given here.

• Using emacs, create a file containing the text of your document. (See below for a sample). Give the file a name that ends in .tex'', for example first.tex. Save your file (with control-X control-S, or quit emacs) before going on to the next step.
• To format your document:
latex first.tex
This creates a file called first.dvi, which is a binary file containing the formated version of your document. (It also creates some other files of no immediate interest). In emacs, you can cause this command to be run by typing control-C control-F.
• To view your document on an X terminal:
xdvi first.dvi
(From emacs: type control-C control-V).
• To convert your document to a PostScript file:
dvips first.dvi
This creates a file called first.ps.
• To print your document:
lpr first.ps
(Use lpr -Paries first.ps if necessary). If you can print without explicitly specifying a printer, you can use control-C control-P to print from inside emacs.
• Alternately, you can print your document in one step, without creating a postscript file:
dvips -f first.dvi | lpr
• If you make changes your document (the .tex file), you must do all the above steps again.
• HINT: You don't need to type the file suffix for any of the above commands, except emacs; for example, you can view your file just by typing
xdvi first
I included the suffixes above to indicate which file each command operates on.

## 3. A test file

Type the following file exactly as it appears (or, you may prefer to cut-and paste it if you have the capability). Do not confuse forward with backward slashes, or capital with lowercase letters. (It is ok to have additional spaces where there are some, or to start a new line anywhere you see a space). If you can get it to format, display on the screen, and print, you have mastered the process of formatting a LaTeX document.

\documentclass{article}

\begin{document}

This is a test \LaTeX\ document.
\end{document}


## 4. Customize your environment

Next, you need to get ready to reate your own documents. The first and all-important step is to prepare a place for definition (style'') files that you will be using over and over. These extend the capabilities of LaTeX and adapt it to linguistic (or other) style conventions. You must also tell TeX/LaTeX where you put them, as follows:

• Create a subdirectory in your home directory, named something like texstyles. You can do this with the command mkdir texstyles.
• Copy some useful style and documentation files into it, as follows:
cp /mnt/unagi/home/alexis/usr/tex/* ~/texstyles
• Use emacs to edit your .cshrc file, and add the following line:
setenv TEXINPUTS .:$HOME/texstyles: • Log off and log back on for the settings to take effect. Once you've done all this, you can create your own LaTeX documents in any directory, and use your style files with them. So don't put your documents in the same directory as the style files! ## 5. A real sample file In order to learn what to put in your LaTeX documents, I recommend that you read through the beginning of some book on LaTeX, and especially that you look at the documentation for the linguistics example package gb4e and the tree package qtree. But you're probably going to go ahead and just copy someone's paper and use it as an example anyway-and fortunately, that's not a bad way to figure out LaTeX. The following just might be enough to get you started (but I doubt it). % Anything on a line after a %' gets ignored by TeX % Curly braces {, } are used for grouping \documentclass[11pt]{article} % This line requests non-standard packages (which you must make available) \usepackage{gb4e,qtree} \begin{document} \begin{center} {\large \bf Your title, large and bold. } \\ % use \\ to end centered lines {\large Your name (not bold). } \end{center} All your text goes down here.\footnote{Footnote text goes here}. Leaving a blank line starts a paragraph. Otherwise newlines are ignored. Plain text (not containing certain characters that have special meaning to TeX) appears more or less as it is typed, but lines are collected into paragraphs. \emph{italics,} {\bf bold,} {\large larger} or {\small smaller} type. Subscripts$_i$and superscripts$^{i, j}\$.

\section{Linguistics-style examples}

The commands in this section are defined by the packages
\emph{gb4e} and \emph{qtree.}

\begin{exe}
\ex\label{rem1} Example.
\ex \Tree [.S [.NP the dog ] \qroof{etc.}.VP ]
\end{exe}

You can refer to the example number (\ref{rem1}).
\end{document}


## 6. Some things you will need soon

LATEX can do all sorts of fancy stuff. Here's some of the stuff that's actually worth the trouble, and that you'll probably want to do pretty soon.

• the gb4e package provides a way to do word-aligned glosses.
• There are commands that control the size of the margins.
• There are specialized fonts, like IPA and Cyrillic.
• The `verbatim'' mode is easy to use, and it the quickest (and dirtiest) way to line up things in columns.
• You've probably heard about BibTeX, the bibliography support facility.
• TEX's greatest strength is that it's easy to extend by defining custom commands. If you find yourself typing (almost) the same thing over and over again, it's time to look into this.

To learn how to do these, consult a good book on LaTeX, and/or take a look at the LaTeX for Linguists webpage for further pointers.

[ up: LaTeX for Linguists | Computer Help | Linguistics Home Page ]

alexis@ling.upenn.edu