0% found this document useful (0 votes)
135 views

Math Bootcamp 2017 August 14th, 2017

LaTeX is a typesetting system that uses commands to produce documents. It was developed by Donald Knuth in 1978 as an extension of TeX. Unlike Word, LaTeX documents cannot be seen as they are typed (WYSIWYM). LaTeX has advantages like consistent formatting, easy bibliography management, and producing high quality documents, especially for long documents like dissertations. It also has some disadvantages like a learning curve and less flexibility compared to Word. BibTeX is often used for bibliography management in LaTeX.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
135 views

Math Bootcamp 2017 August 14th, 2017

LaTeX is a typesetting system that uses commands to produce documents. It was developed by Donald Knuth in 1978 as an extension of TeX. Unlike Word, LaTeX documents cannot be seen as they are typed (WYSIWYM). LaTeX has advantages like consistent formatting, easy bibliography management, and producing high quality documents, especially for long documents like dissertations. It also has some disadvantages like a learning curve and less flexibility compared to Word. BibTeX is often used for bibliography management in LaTeX.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Introduction

Math bootcamp 2017


August 14th, 2017
What is LaTex
• A scripting language used for writing documents.
• Donald Knuth in 1978 develop a typesetting program Tex.
• LaTex is an extension of Tex.
• Like a programming language, and produces files (PDF, html, ps)
• Differences with Microsoft word:
1. Microsoft Word: ‘What You See Is What You Get’ (WYSIWYG)
2. LaTex: You cannot see the final document while you are typing (WYSIWYM)
Advantages
• It looks pretty

• It is fast
y = \frac{{n!}}{{k!\left( {n - k} \right)!}}p^k q^{n - k} =
\left( {\begin{array}{*{20}c} n \\ k \\\end{array}} \right)p^k
q^{n - k}

• Consistent in term of formatting.


• Good for long documents, such as dissertation and books.
Advantages (Cont.)
• Stability and interchangeability (Office 97, Office 2000, ….)
• Most journals have their LaTeX styles file (just download and use
them).
• Good bibliography management.
• Connection with statistical software (R and SAS)
• It is free!
Disadvantages
• Learning curve. Take a little bit longer to obtain working knowledge.
• Flexibility. Hard to customize.
• Trade-off: hard to learn, but powerful.
How to Setup LaTeX for Windows

• Download and install MikTeX LaTeX package


http://www.miktex.org/

• Install Acrobat Reader

• Install Editor
— Text Studio
http://www.texstudio.org/
— WinEdt
http://www.winedt.com/
— Emacs, vi, etc.
How to Setup LaTeX for Mac

• Download and install MacTex LaTeX package


https://www.tug.org/mactex/

• Or TexShop LaTeX package

http://pages.uoregon.edu/koch/t
exshop/

• Install Acrobat Reader

• Install Editor
— Text Studio
http://www.texstudio.org/
— WinEdt
http://www.winedt.com/
— Emacs, vi, etc.
How to Setup LaTeX. Don’t want to install anything

• Use overleaf
www.overleaf.com
Get Started with some basics
Get Started

\documentclass[12pt]{article}
\begin{document}
Hello world. This is my \emph{first} document prepared in \LaTeX.
\end{document}
\documentclass
{article}
{report}
\documentclass[12pt]{article} {beamer}
{book}
{letter}
• article: suitable for short document, journal articles
• report: good for longer document, such as thesis.
• beamer: similar to power point format.
Font
Font Size
Titles

\documentclass[12pt]{article}
\begin{document}
\title{Introduction to \LaTeX}
\author{Zeda Li and William W.S. Wei}
\maketitle
Hello world. This is my \emph{first} document prepared in \LaTeX.
\end{document}
Sections

\begin{abstract}
...
\end{abstract}
\section{introduction}
\section{Methodolgy}
\subsection{Data and Variables}
\subsection{Statistical Model}
Standard Environments
\begin{env_name}
stuff Environment name (env_name) can be
\end{enc_name} document, itemize, enumerate, tabular, etc.

\begin{itemize}
\item The first item
\item The second item
\end{itemize}

\begin{enumerate}
\item The first item
\item The second item
\end{enumerate}
Standard Environments
\begin{equation}
E=mc^2
\end{equation}

\begin{tabular}{l|c|r}
1 & 2 & 3 \\
4 & 5 & 6 \\
4 & 5 & 6 \\
\end{tabular}
Figures
\begin{figure}
\centering
\includegraphics {name of the figure file}
\caption{Put the caption here}
\end{figure}

• You can insert figures in pdf, jpg, png, eps, and other formats into your document.
• In general, figures have to be in the same folder as .tex file.
• Multiple figures can be inserted using \subfigure
https://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions
https://www.sharelatex.com/learn/Inserting_Images
Labels and cross-reference
\begin{figure}
\centering
\includegraphics {name of the figure file}
\caption{Put the caption here}
\label{a short name that you can easily remember}
\end{figure}

\section{Introduction} \label{sec:intro}
\section{Methodology} \label{sec:meth}
….

In Section \ref{sec:intro}, we see the Figure \ref{fig:s11},


Math Mode
Math Mode
• Use \( … \) or $...$ for in-line math formulas
• Use \[ … \] or $$...$$ for math formulas with separate line

• Spaces inside \( … \) and \[ … \] are ignored. If needed, use “\ ” or “~” to add


space

• Use \mbox{…} or \text{…} for words inside math formulas

• \begin{equation} …. \end{equation}
Math Mode: some examples
x = \frac{-b \pm \sqrt{b^2-4ac} } {2a}

\int_0^\infty

\frac{\partial u}{\partial x}

\gamma, \pi, \theta, \lambda, \sigma

\Gamma, \Pi, \Theta, \Lambda, \Sigma


https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols
http://artofproblemsolving.com/wiki/index.php?title=LaTeX:Symbols
Exercise
Produces following equations:
Special Characters

• # $ % ^ & _ {} ~ \
• \# \$ \% \^{} \& \_ \{ \} \~{}

• Try \cdots, \vdots


User-defined Commands
• \newcommand\bs{\boldsymbol}
• \newcommand{\cov}{\text{Cov}}
• \newcommand{\cor}{\text{Corr}}
• \def\mb#1{\setbox0=\hbox{$#1$}
\kern-.025em\copy0\kern-\wd0
\kern.05em\copy0\kern-\wd0
\kern-.025em\raise.0em\box0}
• \def\X{{\bf X}}
• \def\Z{{\bf Z}}
• \newcommand{\beq}{\begin{equation}}
• \newcommand{\eeq}{\end{equation}}
Packages
• Many packages can be used to fill user’s advanced needs.
• It is hard to include all of them here.
• Use google!
• https://en.wikibooks.org/wiki/LaTeX/Package_Reference
Tables
\begin{tabular}{|l|l|}
Apples & Green \\
Strawberries & Red \\
Oranges & Orange \\
\end{tabular}
\begin{tabular}{l*{6}{c}r}
Team & P & W & D & L & F & A & Pts \\
\hline
Manchester United & 6 & 4 & 0 & 2 & 10 & 5 & 12 \\
Celtic & 6 & 3 & 0 & 3 & 8 & 9 & 9 \\
Benfica & 6 & 2 & 1 & 3 & 7 & 8 & 7 \\
FC Copenhagen & 6 & 2 & 1 & 3 & 5 & 8 & 7 \\
\end{tabular}
...
\usepackage{multirow}
...
\begin{tabular}{ |l|l|l| }
\begin{tabular}{ |l|l|l| }
\hline
\multicolumn{3}{ |c| }{PhD Office} \\
\hline
Senior Associate Dean & Milton F Stauffer Professor & Paul Pavlou \\
\hline
\multirow{2}{*}{Student Services}
& Associate Director & Lisa Fitch \\
& Coordinator & Felix Flores \\
\hline
\multirow{12}{*}{Concentration Advisors}
& Accounting & Jagannathan Krishnan \\
& Decision Neuroscience & Angelika Dimoka \\
& Finance & Connie X. Mao\\
& Human Resource & Crystal Harold \\
& Interdisciplinary Studies & Angelika Dimoka \\
& International Business & J. Jay Choi\\
& Marketing & Susan Mudambi \\
& MIS & Sunil Wattal \\
& RMI & Hua Chen\\
& Statistics & Cheng Yong Tang\\
& Strategic & Susan Feinberg\\
& Tourism \& Sports & Daniel Funk\\
\hline
\end{tabular}
Exercise
Produces following tables:

https://en.wikibooks.org/wiki/LaTeX/Tables
https://www.sharelatex.com/learn/Tables
Bibliography and Citation
Simple Bibliography
If you know you have between 10 and 99 publications, you can start
with \begin{thebibliography}[99]. Use any two digit number in the
argument, since all numerals are the same width.
Bibliography Management
• BibTeX is a widely used bibliography management tool in LATEX.
• The bibliography entries are kept in a separate file and then imported into the
main document.
• Once the external bibliography file is imported, the command \cite, \citet, \citep,…
• Very useful to build your own bibliography library.
• Make sure include package \usepackage{natbib}
Main Tex
Ths document is an example of BibTeX using in bibliography management. Three
items are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the
Einstein journal paper \cite{einstein}, and the Donald Knuth's website
\cite{knuthwebsite}. The \LaTeX\ related items are
\cite{latexcompanion,knuthwebsite}.  
\medskip  

\bibliographystyle{unsrt}
\bibliography{sample}
BibTex
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German}) [{On} the electrodynamics of moving
bodies]",
journal = "Annalen der Physik", volume = "322", number = "10", pages = "891--921", year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004" }  

@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts" }  

@misc{knuthwebsite,
author = "Donald Knuth",
title = "Knuth: Computers and Typesetting",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html" }
Another Advantages
The bibTex file can be downloaded directly from Temple library Website!!!
Other Usage of Latex
Connect LaTex with other software
• Connect with R.
• Provide flexible and fast report writing and editing.
• Need two packages, kinitr and sweave.
• If you are all interested in learning R, we can do a section latter.
LaTex for Presentation
• Good for math intensive presentation.
• Not flexible

LaTex for CV

You might also like