\documentclass[12pt]{article} \usepackage{lingmacros} \usepackage{rtrees} \usepackage{avm} \usepackage{robbib} \usepackage{fullpage} %Not important: Just using this so I can get the %nifty BibTeX logo. \usepackage{doc} \newcommand{\es}{\enumsentence} \newcommand{\ees}{\eenumsentence} \title{\LaTeX\ tutorial} \author{Emily M.~Bender} \date{January 20, 1997\\ updated January 20, 2005} \begin{document} \maketitle \section{Some basic stuff} \LaTeX\ doesn't pay very much attention to the way you line things up on the screen. One space between words is the same as many. Two carriage returns will tell \LaTeX\ to start a new paragraph. The \% sign comments things out. %Like this. %and this. \subsection{Special characters} The following are special characters in \LaTeX, so you have to do something special to get them to actually appear: \begin{quote} \$ \& \% \# \_ \{ \} \end{quote} \begin{quote} \begin{verbatim} \ ~ ^ \end{verbatim} \end{quote} The characters $|$, $<$, and $>$ only come out in math mode. \subsection{Quotes} `single quotes' ``double quote'' ''backwards quotes`` Notice that the normal quote character (shift-') doesn't get used. \subsection{Type styles} {\sc Small caps} {\bf bold face} {\em italics} \subsection{Accents and subscripts} \={a} \'{a} \v{a} \`{a} \^{a} \~{n} \c{c} \u{o} \i\ \'{\i} \noindent themselves$_{i}$ \section{Some sort of fancy stuff} \subsection{Numbering things and referring to them} The sentence in (\ref{ex1}) is a numbered sentence. \es{ \label{ex1} This is a numbered sentence. } I can also refer to other sections, such as \S\ref{othersection}. It is also possible to have examples formatted like: \ees{\label{ees} \item \label{2ndlabel} First sentence fragment. \item Another sentence fragment. } In this case, you can do some of the reference by hand, as in (\ref{ees}a). Or you can have it done automatically: (\ref{2ndlabel}). \subsection{Quotation, description, itemize, enumerate} The quotation and description environments may also be useful. \subsection{Quotation} \begin{quotation} A little acolyte on Mount Hiei, fresh from the country, arrived when the cherry trees were in full bloom. When a cruel wind sent the petals flying, the boy burst into tears. ``What makes you cry so, my dear?'' a monk gently comforted him. ``Are you sorry to see the flowers fall? But flowers never last, you know. They always fall. You shouldn't cry!'' ``Who cares whether they fall or not!'' the boy sobbed. ``Not me! But if the barley flowers in Daddy's fields blow away there'll be no crop and that'd be {\em awful}!'' He bawled all the harder. So much for {\em that} sweet child's sensitive feelings. [Royall Tyler, {\em Japanese Tales}, p.224] \end{quotation} \subsection{Description} \begin{description} \item[$\bullet$] Point one. \item[(2)] Point two. \item[\textnormal{(2)}] Point two again. \end{description} \subsection{Itemize} \begin{itemize} \item Item one \item Item two \item[*] etc. \end{itemize} \subsection{Enumerate} \begin{enumerate} \item Uno \item Due \item Tre \end{enumerate} \subsection{Footnotes} \label{othersection} \LaTeX\ does footnotes.\footnote{Like this one.} Sometimes the regular \verb+ \footnote + command won't work inside of other commands. In those cases, use \verb+ \footnotemark + and \verb+ \footnotetext+: \es{An example with a footnote\footnotemark} \footnotetext{This is another footnote.} \section{Fancy things that are useful to linguists} \subsection{Your basic table} \es{ \begin{tabular}[t]{|l||l|c|c|} \hline &\multicolumn{1}{c|}{Numeral} & Number of $\sigma$ & Alphabetical?\\ \hline \hline French & deux & 1 & Yes\\ \hline English & two & 1 & No\\ \hline Japanese & hutatu & 3 & No\\ \hline \end{tabular} } \subsection{Glossed examples} \verb+ \shortex + and related macros are defined in lingmacros.sty. \es{ \shortex{4} {Kore-wa & omosirokuna-i & reibun & desu.} {This-{\sc top} & interesting.{\sc neg}-{\sc nonpst} & example.sentence & cop} {`This is an uninteresting example sentence.'} } \subsection{Trees} These trees are produced using Rob Malouf's rtrees.sty package. \begin{tree} \br{S}{ \br{NP}{\tlf{The cat}} \br{VP}{ \br{V}{\lf{is}} \br{PP}{ \br{P}{\lf{on}} \br{NP}{\tlf{the mat}}}}} \end{tree} \subsection{AVMs} Using avm.sty: \begin{avm} \[ {\it word}\\ HEAD & \[ {\it verb}\\ AGR & \@1{\it 3sing} \]\\ VAL & \[ SPR & \q<\ \ \q>\\ COMPS & \< \[ HEAD & \[ {\it noun}\\ AGR & \@1 \] \] \> \] \] \end{avm} \subsection{Trees with avms} \begin{avmtree} \br{\[ HEAD & {\it verb} \]}{ \br{\[ HEAD & {\it noun} \]}{\lf{cats}} \br{\[ HEAD & {\it verb} \]}{\lf{sleep}}} \end{avmtree} \section{A note on style files} Some of the commands you'll want to use come as part of the standard \LaTeX\ distribution. Others are defined in style files (.sty files). If you want to use style files like avm.sty or rtrees.sty, you'll need to put them in an appropriate directory so that \LaTeX\ can find them. In a linux/unix environment, one way to do this is to make a directory called TEX in your home directory. Then add the line: \begin{quote} setenv TEXINPUTS /user/$<$yourlogin$>$/TEX/: \end{quote} \noindent to your .bashrc (if you're running bash) or equivalent. \LaTeX\ will be able to access any .sty or .bst files you put there. \section{Bibliographies} Imagine never having to enter the bibliographical information for a particular work more than once, or having the computer make sure that every work you refer to in the text shows up in the bibliography, or not having to keep track of which of two things by the same author in the same year you called `a' and which `b'\ldots\ Such are the luxuries of \BibTeX. \BibTeX\ comes with the standard commands \verb+\cite+ and \verb+\nocite+. There are several packages extending those commands, including robbib.bst/robbib.sty, which I recommend. In order to use these, you need to save a copy of each in your TEX directory. Here are some examples: \begin{quote} \citeboth{Lamport94} is a very approachable beginner's guide to \LaTeX. \citeboth{Goossens*94} is a companion text to \citeboth{Lamport94} that has more advanced stuff. It's a little harder to read because it leaves out everything that is in \citeboth{Lamport94}. Another text is \citeboth{Kopka*95}. This one has both beginning and advanced stuff in the same text. It is less approachable than \citeboth{Lamport94} but more approachable than \citeboth{Goossens*94}. Dai (\citeyear{Dai92b,Dai92a}) provides interesting insight into Chinese syntax. Also, there are some other interesting works that I'm not going to say anything explicit about in the text. \nocite{Choi96} \end{quote} \section{Debugging} When you run latex over your .tex file, it will try interpret all of your commands. If there's an error in your latex, the program will complain. Sometimes it will tell you something useful, like: \begin{quote} \begin{verbatim} ! Undefined control sequence. l.212 \latex \end{verbatim} \end{quote} If you get an error like this, you've probably either mispelled the name of the command (in this case, it should have been \LaTeX), or else you're using a command without including the style file which defines it. The `l.212' indicates that the offending command is on line 212 of your file. If you're using emacs as your text editor, you can get to line 212 like this: \begin{quote} {\tt M-x goto-line 212} \end{quote} Other times, the errors can be much less helpful, such as this one, caused by unbalanced square brackets in an avm: \begin{quote} \begin{verbatim} ! Missing \cr inserted. \cr l.199 \end{avm} \end{verbatim} \end{quote} In this case, the actual problem was on line 198. If the particular line where \LaTeX\ is complaining looks okay, try scanning upwards. Missing or unbalanced brackets, either the curly brackets of general \LaTeX\ commands, or the \verb+\[+-style brackets used in avm formatting are common culprits. When latex reports an error, you can tell it to try to keep going by just hitting return. You may have to do this several times. If you're really impatient, try capital `R', which means ``don't stop to tell me about any more errors, just do your best.'' Sometimes, even when there are errors, you can still see something informative in the typeset file. This can be helpful in debugging. \bibliography{examplebib} \bibliographystyle{robbib} \end{document}