An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting....

26
An Introduction to the LaTex typesetting system Ziv Yaniv Not : Last Modified October 2011

Transcript of An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting....

Page 1: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

An Introduction to the LaTex typesetting system

Ziv Yaniv

Not :

Last Modified October 2011

Page 2: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Who (Credit Where Credit is Due)

Donald E. Knuth

Tex late 70’s

Pictures courtesy of wikipedia http://en.wikipedia.org/

LaTex early 80’s

Leslie Lamport

Page 3: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

What

• A typesetting system, not a word processor.

• Pronounced “Lay-Tek” or “Lah-Tek”.

• Tex/LaTex central, Comprehensive TeX Archive Network (CTAN): http://www.ctan.org/

Page 4: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Samples of LaTex

All samples taken from: http://www.tug.org/texshowcase/

Page 5: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Where to Obtain

• Win, MikTex:http://www.miktex.org/

• Unix/Linux, Tex Live:http://tug.org/texlive/

• Mac, MacTex:http://tug.org/mactex/

Page 6: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Book Recommendation Corner

Free online substitutes:

• The EOS 1918 edition: http://www.crockford.com/wrrrld/style.html

• A (Not So) Short Guide to LaTeX2e : http://www.ctan.org/tex-archive/info/lshort/english/

Page 7: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Editors Specifically supporting LaTex

• Win: WinEdt (shareware), TexnicCenter (freeware).

• Mac: TexShop

• Unix/Linux: emacs, Lyx

Page 8: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Files Galore

*.cls (class file)*.sty (style file)*.bbl (bibliography file)

(auxiliary files for system use)*.aux, *.idx, *.toc, *.log

*.ps *.pdf

*.tex

*.dvi

Page 9: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Document Structure

1. Preamble 1. document class [article, report, book…],

2. packages [additional macros],

3. your additional macro definitions.

2. Document body.

Page 10: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Your First Document

Page 11: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Document Body

• \section{My first section}• \subsection{My first subsection}• \chapter{My first chapter}• \appendix• \footnote{My first footnote}• \label{firstLabel}• \ref{firstLabel}

Label-ref mechanism: When using labels and references you will need to run LaTex multiple times

(remember those auxiliary files).

Page 12: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Your Second Document

Page 13: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Basic Formatting

force new line and new page: \\ or \newline \newpage

bold text: \bf or \textbf{}

italicize text: \emph{} or \textit{} or \it

underline text: \ul, \underline{}

font sizes: \tiny, \scriptsize, \footnotesize, \small, \normalsize, \large, \Large, \LARGE, \huge, \Huge

lists:

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

\begin{enumerate} \item The first item. \item The second item.\end{enumerate}

Page 14: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Basic Formatting

Page 15: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Math

• Two important packages that add many useful macros:

\usepackage{amsmath}

\usepackage{amssymb}

Page 16: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Math

Page 17: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Floating objects (Tables and Figures)

• Objects that cannot be broken across pages are referred to as floating:– \begin{table} \end{table}– \begin{figure} \end{figure}

• Table and Figure numbering are done for you.

• Referencing a floating object is done via the label-ref mechanism.

• Enhanced support of graphics, add \usepackage{graphicx}in preamble.

Page 18: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Floating objects (Tables and Figures)

Page 19: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Bibliography

• Manage bibliography using BibTex program.

*.tex *.bib

*.bblIn your *.tex file:

\bibliographystyle{plain}\bibliography{mybibliography}

Bibliography style defined in a ASCII text file(*.bst).

Page 20: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Bibliography

*.bib file – ASCII text file with entries in a human readable format. Entry types include @article, @book, @inproceedings, @mastersthesis, @techreport…:

@ARTICLE{yaniv2010c,

author = {Ziv Yaniv},

title = {Evaluation of Spherical Fiducial Localization in {C-arm} Cone-Beam

{CT} using Patient Data},

journal = {Med. Phys.},

year = {2010},

volume = {37},

pages = {5298--5305},

number = {10},

}

@INPROCEEDINGS{wiesner2007,

author = {Stefan Wiesner and Ziv Yaniv},

title = {Monitoring Patient Respiration using a Single Optical Camera},

booktitle = {Int. Conf.of the IEEE Eng. Med. Biol.},

year = {2007},

pages = {2740--2743},

}

Page 21: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

JabRefGUI for bib file

http://jabref.sourceforge.net/

Page 22: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

LaTex + BibTex

To obtain the final typeset file, with all references and citations numbered andin order run the following series of commands:1. Latex2. Bibtex3. Latex4. Latex

Page 23: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

LaTex + BibTex

@ARTICLE{banovac2005, author = {Filip Banovac and Jonathan Tang and Sheng Xu and David Lindisch and

Ho Young Chung and Elliot B. Levy and Thomas Chang and Michael F.McCullough and Ziv Yaniv and Bradford J. Wood and Kevin Cleary},

title = {Precision targeting of liver lesions using a novel electromagneticnavigation device in physiologic phantom and swine},

journal = {Med. Phys.}, year = {2005}, volume = {32}, pages = {2698--2705}, number = {8},}

@ARTICLE{bansal2003, author = {Ravi Bansal and Lawrence H. Staib and Zhe Chen and Anand Rangarajan

and Jonathan Knisely and Ravinder Nath and James S. Duncan}, title = {Entropy-Based, Dual-Portal-to-3{DCT} Registration Incorporating Pixel

Correlation}, journal = {{IEEE} Trans. Med. Imag.}, year = {2003}, volume = {22}, pages = {29--49}, number = {1},}

@ARTICLE{yaniv2010c, author = {Ziv Yaniv}, title = {Evaluation of Spherical Fiducial Localization in {C-arm} Cone-Beam

{CT} using Patient Data}, journal = {Med. Phys.}, year = {2010}, volume = {37}, pages = {5298--5305}, number = {10},}

Page 24: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Bringing It all Together

LaTex sources for:

"Fiducial localization in C-arm based Cone-Beam CT", Z. Yaniv, SPIE Medical Imaging: Visualization, Image-Guided Procedures, and Display, 2009.

Page 25: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Presenting Your Work

• Embed latex into your power point presentations:1. Insert formulas as pictures

• cannot change scale gracefully.

2. Use TexPPT (http://sites.google.com/site/tex4ppt/)• gracefully change scale. • copy-paste from the paper you already wrote.

Page 26: An Introduction to the LaTex typesetting system LaTeX is a free system for document typesetting. Documents are stored in ASCII text files with markup,

Summary

• This introduction has covered the basic functionality of LaTex and BibTex.

• These are standard tools in many scientific disciplines.

• Comprehensive TeX Archive Network (CTAN): http://www.ctan.org/

• Don’t start from scratch, base your documents on previous ones.