Introduction To LaTeX
Introduction To LaTeX
Overleaf.com
1
What is LaTeX?
• LaTeX is pronounced “lay-tech” or “lah-tech,”
not “la-teks.”
• LaTeX is a document preparation system for
high-quality typesetting.
• LaTeX is most often used to produce technical
or scientific documents, but it can be used for
almost any form of publishing.
2
Why Use LaTeX?
• Designed by academics and easily accommodates academic
use.
• Professionally crafted predefined layouts make a document
really look as if “printed.”
• Mathematical symbols and equations are easily integrated.
• Even complex structures such as footnotes, references, table
of contents, and bibliographies can be generated easily.
• Forces author to focus on logical instead of aesthetic
structure of a document.
• Creates more beautiful documents.
• Portable, compatible, flexible, versatile, and cheap (or free)!
Images from Dario Taraborelli’s Blog
3
4
Installing LaTeX
• In Windows
• MiKTeX 2.9
– MiKTeX is a typesetting system for the Windows.
– Download from www.miktex.org for free
– It is generally recommended to install MiKTeX first,
then WinEdt.
• TeXnicCenter
– TeXnicCenter is a text editor.
– TeXnicCenter creates the source file (.tex and others).
– Download from https://www.texniccenter.org/ for free.
5
Installing LaTeX
• Other text editors
– There are other text editors.
– Winshell for free (http://www.winshell.de/)
– Scientific Workplace
• Combination of LaTeX and Mathematics program
• Does a good job of calculating and graphing, very user friendly,
but expensive
• In Mac
• TexShop
– Download for free
http://www.uoregon.edu/~koch/texshop/
– Includes everything!
6
DIY
7
Basic Document Structure
• The format of a document is pretty simple.
– In the preamble
• Documentclass
• Packages
– In the front matter
• Title/author
– In the body
• Contents
– In the back matter
• bibliography
8
In the Preamble
• You specify your document class.
– Document classes: letter, article, report, book,
slides(beamer, prosper)
• \documentclass[12pt]{article}
• Backslash – at the beginning of text markup command
– Packages: numerous packages are available
• \usepackage[margin=1in]{geometry}
• \usepackage{setspace}
• \usepackage{harvard}
9
10
In the Front Matter
• \begin{document}
• \title{}
• \author{}
• \maketitle
• \begin{abstract}
• \end{abstract}
• \pagebreak
11
12
In the Body
• To begin a new section
• \section{}
– Similarly, \subsection{}, \subsubsection{}, \
subsubsubsection{}
– LaTeX does automatic numbering. If you don’t like it,
use section*{}
• \emph{}, \textbf{}
• \singlespacing, \doublespacing, \onehalfspacing
• \centering or \begin{centering} & \end{centering}
13
Footnotes/Quotes/Equations
• \footnote{}
• \begin{quote} & \end{quote}
• ` ’, `` ’’ for quatations
• Mathematical Equations
– Math always in between $ & $
• Alternatively, \begin{equation} & \end{equation}
– $ 1+4=5 $
– \frac{}{}, \sqrt{}, \sum_{k=1}^{n}
– ^{}, _{}
– \greek letters (e.g. \alpha or \Alpha)
– WinEdt also provides click and type functions.
14
Citations
• \cite{bibtexkey}, citeyear{bibtexkey}
• It is more convenient to create a bibliography
file, called bibtex file(.bib) and use it as
needed.
• WinEdt is capable of creating a bib file, but
there are more convenient tools out there.
• JabRef (http://jabref.sourceforge.net/)
15
16
17
18
Creating a Table
• Add numbered table
– \begin{table} \caption{}
• Creating a table
• Simple tables can be produced by
– \begin{tabular}[pos]{tablespec}
– Within the {tablespec} section, one details the number of columns,
the alignment, and the number of vertical lines of the table.
• {lrc}, {|l|r|c}
– Then type in from left to right, the values for each cell with & in
between.
– Put “\\” at the end of each row, then input another row of values if
needed.
– \hline
– For STATA users, after downloading the “outtex” package online, one
can simply type “outtex” after any estimation and STATA will spit out
LaTeX code for the results table presented.
19
Creating a 4*3 Table
• \begin{table}[h]
• \caption{Summary of Conclusions from Diagnostic Tests}
• \begin{tabular}{llll}
• \hline
• \hline
• & Macropartisanship & Consumer Sentiment & Presidential
Approval\\
• \hline
• Joint F test & $d=1$ & $d=1$ & $d=0$\\
• VR test & $0<d\leq1$ & $d=1$ & $0<d\leq1$ \\
• \hline
• \end{tabular}
• \end{table}
20
In the Back Matter
• Don’t forget bibliography{filename}
– Make sure that the bibtex file is saved in the same
location where the main tex file is saved.
• Don’t forget end{document}
21
Seeing the Document
22
Common Mistakes
• Often times, you make a mistake when
creating a document. You will notice the log
file reporting a problem.
• There are some common mistakes:
– “end” doesn’t follow “begin”
– $ doesn’t follow $
– Using commands from packages lot defined in the
preamble
– Don’t forget “\”s.
23
Other Resources
• Books
– Leslie Lampert. 1994. LaTeX: A Document Preparation
System.
– Helmut Kopta and Patrick W. Daly. 2004.Guide to LaTex
– Frank Mittelbach et al. 2004. The LaTeX Companion
• Online Guides
– http://en.wikibooks.org/wiki/LaTeX
– http://tobi.oetiker.ch/lshort/lshort.pdf
– https://www.latex-tables.com/
– CV and dissertation templates are available on line
24
Proposal and Thesis Template
• https://bitly.com/thesis-template
25