Download - LaTeX Tutorial
LaTeX Tutorial2015.01.28
Agenda•
• LaTeX
• Hello LaTeX!
•
• Bibliography
• Build
• Writing Tips
LaTeX
• LaTeX TeX Leslie Lamport
• Leslie Lamport: LaTeX, Paxos algorithm, 2013 Turing award
• TeX Knuth
LaTeX •
• Word + OneNote LaTeX
•
•
• Knuth The Art of Computer Programming TeX
•
LaTeX • Beamer
• Pandoc
• musixtex
• circuitkz
•
• LaTeX
• /ˈleɪtɛk/ /ˈlɑːtɛk/
• X k
LaTeX • Overleaf
• https://www.overleaf.com
• writelatex WYSIWYG
• build ...
• StackExchange TeX
• http://tex.stackexchange.com
• BJ4
LaTeX • LaTeX Wikibook
• http://en.wikibooks.org/wiki/LaTeX
• (?)
• CTAN
• http://www.ctan.org
• TeX package
• API Reference
Installation• http://en.wikibooks.org/wiki/LaTeX/Installation
• Linux: TeX Live package
• distribution 200 - 300 MB
• Windows: MiKTeX 160 MB
• Mac: MacTeX 2.4 GB
Hello LaTeX!\documentclass[a4paper, 12pt]{report}
\begin{document}
Hello, \LaTeX{}!
\emph{Welcome} to this \textbf{world}!
Ito\rq{}s formula:
$$ dX_t = \mu_tdt + \sigma_tdB_t $$
\end{document}
\documentclass[a4paper, 12pt]{report}
\begin{document}
Hello, \LaTeX{}!
\emph{Welcome} to this \textbf{world}!
Ito\rq{}s formula:
$$ dX_t = \mu_tdt + \sigma_tdB_t $$
\end{document}
\documentclass[a4paper, 12pt]{report}
\begin{document}
Hello, \LaTeX{}!
\emph{Welcome} to this \textbf{world}!
Ito\rq{}s formula:
$$ dX_t = \mu_tdt + \sigma_tdB_t $$
\end{document}
• \documentclass
•
• a4paper: A4
• 12pt: 12
• report:
\documentclass[a4paper, 12pt]{report}
\begin{document}
Hello, \LaTeX{}!
\emph{Welcome} to this \textbf{world}!
Ito\rq{}s formula:
$$ dX_t = \mu_tdt + \sigma_tdB_t $$
\end{document}
• \begin \end
•
• document
\documentclass[a4paper, 12pt]{report}
\begin{document}
Hello, \LaTeX{}!
\emph{Welcome} to this \textbf{world}!
Ito\rq{}s formula:
$$ dX_t = \mu_tdt + \sigma_tdB_t $$
\end{document}
• • \LaTeX: LaTeX command
\documentclass[a4paper, 12pt]{report}
\begin{document}
Hello, \LaTeX{}!
\emph{Welcome} to this \textbf{world}!
Ito\rq{}s formula:
$$ dX_t = \mu_tdt + \sigma_tdB_t $$
\end{document}
• \emph: emphasis
• \textbf:
• \rq: right quote
• .tex
\documentclass[a4paper, 12pt]{report}
\begin{document}
Hello, \LaTeX{}!
\emph{Welcome} to this \textbf{world}!
Ito\rq{}s formula:
$$ dX_t = \mu_tdt + \sigma_tdB_t $$
\end{document}
• $ TeX
• $ $
•
• .tex
• indent
• # $ % ˆ & _ { } ̃ \
• Tab
• %
LaTeX Group• { } group
• {
\color{red}
This line will be red.
}
This line will not.
LaTeX Command• command
• function
• { } argument
• [ ] optional option
•
LaTeX Environment
• \begin{name} \end environment
• Environment command environment
Input TeX Files• include
• \input{another.tex}
• another.tex \input
• .tex \input
• Global structure
• Document class
• Package
• Chapter, section, subsection
Global Structure\documentclass{…}
\usepackage{…}
% settings
\begin{document}
% content…
\end{document}
• document class
•
•
• document
Document Class
article Journal short report etc.
report chapter
book book
IEEEtran IEEE Transaction format
•
Document Class• options
10pt, 11pt, 12pt 10pt 12pt
a4paper, letterpaper
onecolumn, twocolumn column twocolumn
twoside, oneside book twoside article & report oneside
Package• \usepackage{…} package
• \usepackage{verbatim}
•
•
• cite citation
• graphicx
• tabularx
• listings
• LaTeX
• \chapter book report
• \section
• \subsection
• \subsubsection
...• List (ordered &
unordered)
• Font
• Source code
• Table
• Table of Contents
• Citation and Footnote
• Figure
• Reference
List (unordered)
\begin{itemize}
\item The first item
\item The second
\item The third
\end{itemize}
• The first item
• The second
• The third
List (ordered)
\begin{enumerate}
\item The first item
\item The second
\item The third
\end{enumerate}
1. The first item
2. The second
3. The third
\begin{enumerate}
\item The first item
\begin{itemize}
\item 1 of the first
\item 2 of the first
\end{itemize}
\item The second
\end{enumerate}
1. The first item
• 1 of the first
• 2 of the first
2. The second
Font
• \textbf{…}
• \emph{…}, \italic{…}
• monospace \texttt{…}
• listings
• \usepackage{listings}
• lstlistings
\begin{lstlistings}[breakline] int my_count = 0; println(“hello world!”); \end{lstlistings}
• syntax highlight
• document
\lstset{ language=C, numbers=none,
tabsize=2, basicstyle=\ttfamily\small, breakatwhitespace=true }
• LaTeX
•
• PPT
\begin{tabular}{ l l l }
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\end{tabular}
1 2 3
4 5 6
7 8 9
\begin{tabular}{ | c | c | c | }
\hline
1 & 2 & 3 \\
\hline
4 & 5 & 6 \\
\hline
7 & 8 & 9 \\
\hline
\end{tabular}
1 2 3
4 5 6
7 8 9
Column c
l
r
p{12cm}
| column
|| column
• \tableofcontents
•
• book: chapter, section, subsection
• report: section, subsection, subsubsection
Citation
• \usepackage{cite}
• \cite{bib_key}
• bib_key bibliography key
Citation
Those techniques are usually used in a client-server scenario where the program is partitioned into tasks and some tasks are offloaded to the server from clients~\cite{MCCSurvey, Chun2011, hung2014mobilefbp}.
Following the emerging HTML5 and JavaScript technologies, web apps are enhanced with increased capabilities that are more specific for mobile contexts \cite{WEBAPP}.
Footnote• citation bibliography
•
• footnote
• \footnote{put footnote texts here}
• \footnotemark \footnotetext
Footnote Web applications are the most widely-adopted cross-platform solution for mobile devices, \footnote{This work was in part supported by MOST under 102-2221-E-002-087-MY3 and by III under 104-EC-17-A-24-0691}
Footnote
\section[Introduction]{Introduction\footnotemark} \footnotetext{This work was in part supported by MOST under 102-2221-E-002-087-MY3 and by III under 104-EC-17-A-24-0691}
• \usepackage{graphicx}
•
• \includegraphics[...]{file_path}
• file_path
• .jpg, .png, .pdf
• .tex \input \input
• \includegraphics[width=1.0\columnwidth]{…}
• column
• 1.0 .8
• \textwidth twocolumn
optional ...
• width=xx height=xx
•
• keepaspectratio
• width height
Figure
• Figure graphic graphictable
• \begin{figure} \end{figure}
Figure: graphic\begin{figure}[htb!]
\begin{centering}
\includegraphics[width=1.0\columnwidth]{figures/usecase-webcam}
\caption{A distributed webcams example}
\label{fig:usecase-webcam}
\end{centering}
\end{figure}
figure
Figure: table\begin{figure}[htb!] \begin{centering} \begin{tabular} % table content... \end{tabular} \caption{A distributed webcams example} \label{fig:usecase-webcam} \end{centering} \end{figure}
Figure • Figure float flow • \begin{figure}[htb!] • placement specifier figure
• h: here source code • t: top • b: bottom • !: LaTeX
• LaTeX •
Figure Graphic
• figure
\begin{figure}[htb!] \includegraphics[width=1.0\columnwidth]{file1} \caption{Caption 1} \label{fig:file1} \includegraphics[width=1.0\columnwidth]{file2} \caption{Caption 2} \label{fig:file2} \end{figure}
Label• \label{label_name}
•
• \chapter \section figure
• label_name
• \label{fig:system_architecture}
• \label{sec:introduction}
Reference• ref
The high-level overview of Migratom.js is illustrated in Figure~\ref{fig:Architecture}.
• FigureChapter Table !!
Bibliography• LaTeX bib
• BibTeX
• .bib key-value pair citation
• \cite{key} Biliography
.bib key-value @article{MCCSurvey, author = {Fernando, Niroshinie and Loke, Seng W. and Rahayu, Wenny}, title = {{Mobile Cloud Computing: A Survey}}, journal = {Future Gener. Comput. Syst.}, issue_date = {January, 2013}, volume = {29}, number = {1}, month = jan, year = {2013}, issn = {0167-739X}, pages = {84--106}, numpages = {23}, url = {http://dx.doi.org/10.1016/j.future.2012.05.023}, doi = {10.1016/j.future.2012.05.023}, acmid = {2388260}, publisher = {Elsevier Science Publishers B. V.}, address = {Amsterdam, The Netherlands, The Netherlands}, keywords = {Mobile cloud computing, Pervasive networks, Task offload}, }
Best Practices
• survey bib
• title
• Google Scholar BibTeX
•
• \addcontentsline{toc}{chapter}{\bibname}
• \bibliography{bib_file_name}
• \usepackage[notbib]{tocbibind}
• Mac xelatex bibtex
• xelatex thesis.tex
• bibtex thesis.tex
• xelatex thesis.tex
• xelatex thesis.tex
• Linux pdftex
1. xelatex thesis.tex: xelatex \cite thesis.aux
2. bibtex thesis.tex: bibtex thesis.aux key .bib values
thesis.bbl 3. xelatex thesis.tex: xelatex .bbl
\bibliography{…} 4. xelatex thesis.tex:
BibTeX
• definecolor
• lstdefinelanguage
• hyphenation
• pdfpages
• listoffigures listoftables
• vspace noindent
definecolor• \definecolor{my_red}{RGB}{223,0,2}
{
\color{my_red}
This sentence is red.
}
lstdefinelanguage\lstdefinelanguage{JavaScript}{ keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break}, keywordstyle=\color{jskw}\bfseries, ndkeywords={class, export, boolean, throw, implements, import, this}, ndkeywordstyle=\color{darkgray}\bfseries, identifierstyle=\color{black}, sensitive=false, comment=[l]{//}, morecomment=[s]{/*}{*/}, commentstyle=\color{jsgreen}\ttfamily, stringstyle=\color{jsred}\ttfamily, morestring=[b]', morestring=[b]" }
… lstset
\lstset{ language=JavaScript, numbers=none, tabsize=2, basicstyle=\ttfamily\small, breakatwhitespace=true }
Hyphenation• LaTeX
• hyphenation • \hyphenation{Java-Script}
pdfpages
• \usepackage{pdfpages}
\addcontentsline{toc}{chapter}{ }
\includepdf[pages={1}]{cert.pdf}
listoffigures & listoftables
• \listoffigures \listoftables
• \tableofcontents
vspace
• \vspace{5mm}
• v = verticle
• 5mm
noindent
• \noindent
•
Best Practices• \input \input • • ~ • e.g. i.e. • \emph \textbf \texttt • itemize enumerate • build.sh makefile • Google Scholar bib • Git Github Bitbucket
• TeX .gitignore • https://www.gitignore.io/api/latex