38
1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

Embed Size (px)

Citation preview

Page 1: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

1

LaTeX For Dummies

Mulugeta GebregziabherDivision of Biostatistics and Epidemiology

MUSC

April 4, 2011

Page 2: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

2

What is LaTeX

• Pronounced as Lay-tek

• A typesetting program, NOT a word-processor

• Designed by Lamport based on TeX (Knuth)

• Current version LaTeX2 (LaTeX3 coming..)

• Designed for producing books, thesis,articles...

• De facto standard for writing academic papers

Page 3: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

3

Why LaTeX?• Our profession requires it• Platform, version independent (Unix, Windows…)• Pre-set standard formats (for paper, thesis…)• Bibliography management • Fast, professional math equations typesetting• Free available• The commands are easy to learn• Never crash, never lose your file • Can compile very big books (unless your

document is more than 70,000 pages! –verify?)

Page 4: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

4

Disadvantages

• You need other softwares for processing figures (eg. Eps, jpeg, ps, pdf)

• Spelling/grammar checking is not as convenient as those in MS Word

• Requires remembering some commands• Not straightforward for creating complex tables• Not integrated with other MS Office products

(Now, Mathtype is integrated with LaTeX in MS Word 2007)

Page 5: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

5

Where to get LaTeX?

• Windows– MikTeX http://www.miktex.de/

– WinEdit, LaTeX editor available at DBE

– WinShell, a free LaTeX editor

• Where to get help? newsgroup comp.text.tex

• http://www-cs-faculty.stanford.edu/~uno/abcde.html#texbk

– Introduction and tips for LaTeX

Page 6: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

6

Host sites 4 LaTeX related stuff?

• LaTeX/MiKTeX are available free of charge• The best source for these packages is the

Comprehensive TeX Archive Network (CTAN) • three host sites (and many mirrors):

1. http://ctan.tug.org/ in Boston, MA, USA,

2. http://www.tex.ac.uk/ in Cambridge, UK, and

3. http://www.dante.de/ in Mainz, Germany (in German).

Page 7: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

7

How To Run LaTeX

• Compile latex myfile

F5 (WinShell)• View the dvi file yap myfile (Windows)

F7 (WinShell) • Dvi --> PostScript dvips myfile

F8 (WinShell)• View PostScript Use gsview (Windows)

F9 (WinShell)

Page 8: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

8

LaTeX Skeleton

Page 9: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

9

Example: LaTeX Skeleton% my first LaTeX file

\documentclass{article}

% preamble

\usepackage{graphicx}

\begin{document}

\section{This is a section}

\subsection{This is a subsection}

First paragraph is here.

Second paragraph is here.

\end{document}

Page 10: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

10

Preamble Options• Intrinsic document styles: article, book, letter, report, and slides.

• Most publishers have their own style, which they provide for you to download.

• Examples of styles– AMS (amsmath) – Elsevier journals(elsarticle).

• We focus on the article style.

• Other options: font size &other preamble specifications are covered in examples

Page 11: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

11

Now let’s learn by trying some ExampleHands on!

Page 12: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

12

Text

Page 13: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

13

Environment

Page 14: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

14

Fonts

Page 15: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

15

Lists: description,bullet,number

Page 16: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

16

Lists: number

Page 17: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

17

Making Simpler Tables

Page 18: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

18

Making Multi-columnTables

Page 19: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

19

Special Characters

Page 20: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

20

Mathematical Operations

Page 21: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

21

Mathematical Operations

Page 22: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

22

Mathematical Equations

Page 23: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

23

Math: text vs. display mode

Page 24: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

24

Math: equation arrays

Page 25: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

25

Math: equation arrays

Page 26: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

26

Math: equation arrays aligned

Page 27: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

27

Math: equation arrays aligned

Page 28: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

28

Math: means and predicted values

Page 29: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

29

Graphs and Pictures: scale

Page 30: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

30

Graphs and Pictures: dimensions

Page 31: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

31

Front Matter: Cover Page & Abstract

Page 32: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

32

Other Front Matters

Page 33: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

33

BibTeX--Bibliography Management• Bibliography database file mybib.bib

• Command \cite{biblabel}

• How to compile– latex myfile– bibtex myfile– latex myfile (may need to run twice)

• At the end of the document• \bibliographystyle{plain}

• \bibliography{mybib}

• You could also make your own bibliography

Page 34: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

34

BibTek examples

Page 35: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

35

Your own bibliography

Page 36: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

36

How to run LaTeX (from Wang)

latex myfile

xdvi myfile (UNIX)

Edit myfile

Resolve cross-

reference

Resolve compile error

yap myfile (Windows)

myfile.tex

myfile.dvi

dvips myfile myfile.ps

print

Page 37: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

37

Thank you!Happy LaTeXing

Page 38: 1 LaTeX For Dummies Mulugeta Gebregziabher Division of Biostatistics and Epidemiology MUSC April 4, 2011

References

1. Greenberg HJ (2006). A simplified introduction to LaTex

2. Lamport L (1994). LaTeX: a document preparation system

3. LaTeX2e for Authors. CTAN 1995-99.

4. Wang’s Intro to LaTeX