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 ID: 787393
Download The PPT/PDF document "Introduction Math bootcamp" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Introduction Math bootcamp 2017
August 14th, 2017
Slide2What is LaTexA 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:
Microsoft
Word:
‘What You See Is What You Get’ (WYSIWYG
)
LaTex
:
Y
ou cannot see
the final
document while
you are
typing (WYSIWYM)
Slide3AdvantagesIt looks pretty It is fastConsistent in term of formatting.Good for long documents, such as dissertation and books.
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}
Slide4Advantages (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!
Slide5DisadvantagesLearning curve. Take a little bit longer to obtain working knowledge. Flexibility. Hard to customize.Trade-off: hard to learn, but powerful.
Slide6How to Setup
LaTeX
for Windows
Download and install
MikTeX
http://www.miktex.org
/
Install Acrobat Reader
Install
Editor
Text Studio
http
://www.texstudio.org/WinEdt http://www.winedt.com/Emacs, vi, etc.
LaTeX package
Slide7How to Setup
LaTeX
for
Mac
Download and install
MacTex
https://www.tug.org/mactex
/
Or
TexShop
http://pages.uoregon.edu/koch/texshop/
Install Acrobat Reader
Install EditorText Studio http://www.texstudio.org/
WinEdt http://www.winedt.com/Emacs, vi, etc.
LaTeX package
LaTeX package
Slide8How to Setup
LaTeX
.
D
on’t
want to install anything
Use overleaf
www.overleaf.com
Slide9Get Started with some basics
Slide10Get Started
\
documentclass
[12pt]
{
article
}
\begin
{
document
}
Hello world.
This is my \
emph{first} document prepared in \LaTeX. \end{document}
Slide11\documentclass
\
documentclass
[12pt]
{
article
}
{
article
}
{
report
}
{
beamer}{book}{letter}article: suitable for short document, journal articlesreport: good for longer document, such as thesis. beamer: similar to power point format.
Slide12Font
Slide13Font Size
Slide14Titles
\
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}
Slide15Sections
…
\
begin
{
abstract
}
...
\
end
{abstract}
\section{introduction} \section{Methodolgy} \subsection{Data and Variables} \subsection{Statistical Model}
Slide16\begin{env_name}
stuff
\end{enc_name}
\begin{itemize}
\item The first item
\item The second item
\end{itemize}
\begin{enumerate}
\item The first item
\item The second item
\end{enumerate}
Environment name (
env_name
) can be
document, itemize, enumerate, tabular, etc.
Standard Environments
Slide17\
begin{equation}
E=mc^2
\end{equation}
\begin{tabular}{
l|c|r
}
1 & 2 & 3
\\
4 & 5 & 6
\\
4
& 5 & 6 \\
\end{tabular}
Standard Environments
Slide18Figures
\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 \subfigurehttps://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captionshttps://www.sharelatex.com/learn/Inserting_Images
Slide19Labels 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},
Slide20Math Mode
Slide21Math 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}
Slide22Math 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
Slide23Exercise
Produces following equations:
Slide24Special Characters# $ % ^ & _ { } ~ \\# \$ \% \^{} \& \_ \{
\} \~{}Try \cdots, \vdots
Slide25User-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}}
Slide26PackagesMany 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
Slide27Tables
Slide28Slide29Slide30\begin{tabular}{|l|l|} Apples & Green \\ Strawberries & Red \\ Oranges
& Orange \\ \end{tabular}
Slide31\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}
Slide32... \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}
Slide33Exercise
Produces following tables:
https://
en.wikibooks.org/wiki/LaTeX/Tables
https://
www.sharelatex.com/learn/Tables
Slide34Bibliography and Citation
Slide35If 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.
Simple Bibliography
Slide36Bibliography Management
BibTeX
is a widely used bibliography management tool in
L
A
T
E
X.
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}
Slide37Main 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}
Slide38BibTex
@
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" }
Slide39Another Advantages
The
bibTex
file can be downloaded directly from Temple library Website!!!
Slide40Other Usage of Latex
Slide41Connect LaTex with other softwareConnect 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.
Slide42LaTex for PresentationGood for math intensive presentation.Not flexible
LaTex
for CV