Latex Example program
Latex Example program
\documentclass{article}
\begin{document} example for a very \tiny{tiny} \normalsize \LaTeX \ document
\end{document}
\documentclass[12pt,twoside,a4paper]{article}
\begin{document}
a small \LaTeX document
\end{document}
Class options
12pt Character size 12 points
twoside Reciprocally front and back
a4paper DIN A4 format
book
report
article
letter (normally American format)
Each document use exactly one document class.
so
\documentclass{article} or \documentclass{report}
Not
\documentclass{article, report}
Tables in Latex
\documentclass[12pt,twoside,a4paper]{article}
\begin{document}
\begin{tabular}{|c|c|c|}
\hline
A & B & C \\
\hline
1 & 2 & 3 \\
\hline
4&5&6
\\
\hline
\end{tabular}
\end{document}
\documentclass[12pt,twoside,a4paper]{article}
\begin{document}
\begin{tabular}{c|c|c}
A & B & C \\
\hline
1 & 2 & 3 \\
\hline
4 & 5 & 6 \\
\end{tabular}
\end{document}
A third table
\documentclass[12pt,twoside,a4paper]{article}
\begin{document}
\begin{tabular}{|c|c|c|l|r|}
\hline
\multicolumn{3}{|l|}{test} & A & B \\
\hline
1 & 2 & 3 & 4 & 5 \\
\hline
\end{tabular}
\end{document}
Here's a brief explanation of what some of the commands in the file above do:
\documentclass[12pt]{article}
This says to use 12pt type, which is a large readable size (10 and 11 are also used a lot). It
also specifies that the article style be used, which is what you will use for linguistics
papers.
\usepackage{lingmacros}
\usepackage{tree-dvips}
lingmacros and tree-dvips are style files that have been written by people to help you do
example sentences and draw trees.
\section*{Notes for My Paper}
This says to make a section heading consisting of what is between the curly brackets, and
the * says not to number it. Without the * you would get a numbered heading which
would increment with each following section heading.
\subsection*{How to handle topicalization}
This says to make a subsection heading, which is smaller sized than the section heading.
You can even do \subsubsection headings!
\enumsentence, \ex and \shortex{7}
These are control commands for numbering example sentences and giving examples with
glosses and translation lines. You separate each word by & in the \shortex environment,
and tell it the number of words you plan to enter (in curly brackets). \ex allows you to
refer to numbered examples with a number relative to the current point in the file (rather
than with an absolute number).
\begin{tabular}[t]{cccc}
This is how the tree was drawn.
\emph{Irrealis}
This says to make what is in curly brackets into italics. You can also do \textbf{Hi
There} to get bold Hi There and \textsc{Hi There} to get HI THERE.
\small
This makes the type size smaller. The braces delimit the range of text over which this
command has an effect.
\begin{document} and \end{document}
These must be put around the text of your paper.
Note that everything that comes after a % symbol is treated as comment and ignored when the
code is compiled.
\textbf{Hello World!} Today I am learning \LaTeX. %notice how the command will end at the first
non-alphabet charecter such as the . after \LaTeX
\LaTeX{} is a great program for writing math. I can write in line math such as $a^2+b^2=c^2$ %$
tells LaTexX to compile as math
. I can also give equations their own space:
\begin{equation} % Creates an equation environment and is compiled as math
\gamma^2+\theta^2=\omega^2
\end{equation}
If I do not leave any blank lines \LaTeX{} will continue this text without making it into a new
paragraph. Notice how there was no indentation in the text after equation (1).
Also notice how even though I hit enter after that sentence and here $\downarrow$
\LaTeX{} formats the sentence without any break. Also look how it doesn't matter
how many spaces I put between my words.
For a new paragraph I can leave a blank space in my code.