adopted from: prism brownbag series june 9 th, 2009 byungwon woo

38
INTRODUCTION TO LATEX Adopted from: PRISM Brownbag Series June 9 th , 2009 Byungwon Woo

Upload: jacob-blair

Post on 25-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

INTRODUCTION TO LATEX

Adopted from: PRISM Brownbag Series

June 9th, 2009

Byungwon Woo

Page 2: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

What is LaTeX?

LaTeX is pronounced “lay-tech” or “lah-tech,” not “la-teks.”

LaTeX is a document preparation system for high-quality typesetting.

LaTeX is most often used to produce technical or scientific documents, but it can be used for almost any form of publishing.

Page 3: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Why Use LaTeX? Designed by academics and easily accommodates

academic use. Professionally crafted predefined layouts make a

document really look as if “printed.” Mathematical symbols and equations are easily

integrated. Even complex structures such as footnotes,

references, table of contents, and bibliographies can be generated easily.

Forces author to focus on logical instead of aesthetic structure of a document.

Creates more beautiful documents. Portable, compatible, flexible, versatile, and cheap (or

free)!

Page 4: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo
Page 5: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Installing LaTeX In Windows MiKTeX

MiKTeX is a typesetting system for the Windows.

Download from www.miktex.org for freeIt is generally recommended to install MiKTeX

first, then WinEdt. WinEdt

WinEdt is a text editor.WinEdt creates the source file (.tex and others).Download from www.winedt.com for free for 30

days.WinEdt costs $30.

Page 6: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Installing LaTeX Other text editors

There are other text editors.Winshell for free (http://www.winshell.de/)Scientific Workplace

○ Combination of LaTeX and Mathematics program○ Does a good job of calculating and graphing, very user

friendly, but expensive

In Mac TexShop

Download for free http://www.uoregon.edu/~koch/texshop/

Includes everything!

Page 7: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

DIY

Page 8: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Basic Document Structure• The format of a document is pretty simple.

– In the preamble• Documentclass• Packages

– In the front matter• Title/author

– In the body• Contents

– In the back matter• bibliography

Page 9: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

In the Preamble

You specify your document class.Document classes: letter, article, report, book,

slides(beamer, prosper)○ \documentclass[12pt]{article}○ Backslash – at the beginning of text markup

commandPackages: numerous packages are available

○ \usepackage[margin=1in]{geometry}○ \usepackage{setspace}○ \usepackage{harvard}

Page 10: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo
Page 11: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

In the Front Matter

\begin{document} \title{} \author{} \maketitle \begin{abstract} \end{abstract} \pagebreak

Page 12: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo
Page 13: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Journal Article

Page 14: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Document Class

Article – has sections, subsections etc Report – has chapters, sections, subsections etc. Book – all the stuff for real books Slides – clearly for slides

Page 15: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Document Class Options

Size of main font in document Paper size Number of columns in document Duplexing or not (double sided printing) Page layout Whether chapters must begin on a RHS

page

Page 16: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Project Management

Sometimes you don’t want to keep everything in one text file

Often it is more convenient to have one file per chapter, section, etc.

Page 17: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Multiple-file Project

\begin{document}[letter,12pt]{report}\title{A Simple Report}

\include{Chapter1}\include{Chapter2}

\end{document}

Main.tex

Chapter2.tex

Chapter1.tex

Page 18: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

In the Body

• To begin a new section• \section{}

– Similarly, \subsection{}, \subsubsection{}, \subsubsubsection{}

– LaTeX does automatic numbering. If you don’t like it, use section*{}

• \emph{}, \textbf{}• \singlespacing, \doublespacing, \

onehalfspacing• \centering or \begin{centering} & \

end{centering}

Page 19: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Footnotes/Quotes/Equations \footnote{} \begin{quote} & \end{quote} ` ’, `` ’’ for quatations Mathematical Equations

Math always in between $ & $○ Alternatively, \begin{equation} & \end{equation}

$ 1+4=5 $\frac{}{}, \sqrt{}, \sum_{k=1}^{n}^{}, _{}\greek letters (e.g. \alpha or \Alpha)WinEdt also provides click and type functions.

Page 20: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Citations

\cite{bibtexkey}, citeyear{bibtexkey} It is more convenient to create a

bibliography file, called bibtex file(.bib) and use it as needed.

WinEdt is capable of creating a bib file, but there are more convenient tools out there.

JabRef (http://jabref.sourceforge.net/)

Page 21: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo
Page 22: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo
Page 23: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo
Page 24: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Typing Normal Text

Quotation marks – `` -> “ and ‘‘ -> ” & symbol is saved so use \& % symbol is saved so use \% ~ is a non-breaking space so use ~~

Page 25: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Cross-referencing

First label what you wish to reference

\section{Wing Design}\label{sec:wingDesign}

Then you can reference it by using \ref{}

So as I was saying in~\ref{sec:wingDesign}

Bibliographies work very similarly

Page 26: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Environments

Environments are used to hold special things like Figures and Tables

Figures will float – meaning they will move with the text so that they appear in the best spot for the manuscript’s appearanceThis means that figures are placed at the

top or bottom of pages wherever possible. Also includes things like lists

Page 27: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Lists

There are 3 basic types of listsEnumerate (numbered lists)Itemize (bulleted lists)Description (lists started by a descriptor)

\begin{enumerate}\item Birds\item Trees\end{enumerage}

1. Birds2. Trees

\begin{itemize}\item Birds\item Trees\end{itemize}

\begin{description}\item[Birds] fly\item [Trees] don’t\end{description}

• Birds• Trees

Birds flyTrees don’t

Page 28: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Tables Tables are anchored

in the text

C1 C2 C3

A B C

D E F

\begin{table}\center\caption{A Simple Table}\label{tb:simple}\begin{tabular}{r|rc}C1 & C2 & C3 \\\hlineA & B & C\\D & E & F\\\end{tabular}\end{table}

Table 1: A Simple Table

Page 29: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Figures Tables are anchored

in the text\begin{figure}[h]% Requires \usepackage{graphicx} \includegraphics[width=8in]{SimpleFigure}\\\center\caption{A Simple Figure}\label{fig:simple}\end{figure}

Figure 1: A Simple Figure

Page 30: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Mathematical Formulae

Multiple ways to enter math mode1. In line with text using $

2. Equation environment – This will number your equations off to the

side!

3. Equation array environment– Allows you to type multiple equations at a

time in a single environment and have them nicely separated.

Page 31: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Math Mode

Changes many rules from normal textMost spaces in math mode have no

significance and are ignoredEmpty lines are not allowed – only one

paragraph per formula There are LOTS and LOTS of symbols

Use references or GUI shortcuts until you learn the ones you will need

Page 32: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

In line with Text

Page 33: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Equation Environment\begin{equation} \label{eq:eps}\epsilon > 0\end {equation}

From (\ref{eq:eps}), we gather \ldots{}From \eqref{eq:eps} we do the same.

Page 34: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Equation Array Environment\begin{eqnarray}f(x) & = & \cos x \\f ’(x) & = & -\sin x \\\int_{0}^{x} f(y)dy & = & \sin x\end{eqnarray}

Page 35: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

In the Back Matter

Don’t forget bibliography{filename}Make sure that the bibtex file is saved in the

same location where the main tex file is saved.

Don’t forget end{document}

Page 36: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Seeing the Document

Press on the smiling bear to convert to .dvi

Press on the PDF/LaTeX to convert to .pdf

Press on the PDF+happy bear to convert to .pdf and open it

Page 37: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Common Mistakes Often times, you make a mistake when

creating a document. You will notice the log file reporting a problem.

There are some common mistakes:“end” doesn’t follow “begin”$ doesn’t follow $Using commands from packages lot defined

in the preambleDon’t forget “\”s.

Page 38: Adopted from: PRISM Brownbag Series June 9 th, 2009 Byungwon Woo

Other Resources Books

Leslie Lampert. 1994. LaTeX: A Document Preparation System.

Helmut Kopta and Patrick W. Daly. 2004.Guide to LaTex

Frank Mittelbach et al. 2004. The LaTeX Companion

Online Guideshttp://en.wikibooks.org/wiki/LaTeXhttp://tobi.oetiker.ch/lshort/lshort.pdfCV and dissertation templates are available on

line