Sie sind auf Seite 1von 32

LaTeX Tutorial

Fiona Shearer

May 11th, 2004


Disclaimer: This is in no way a complete tutorial of LaTeX and WinEdt. It is only intended as an initial introduction. There are certainly many important concepts that are outside the scope of this presentation and are left for the audience to discover. No technical support is offered in conjunction with this presentation, although several key references are listed.

Presentation Overview

What is LaTeX? Comparison: MS Word vs LaTeX Tutorial of LaTeX Commands


Class files and Macro Packages Special Characters and LaTeX Commands Lots of Examples

Software Downloads & Demo References


May 11th, 2004 LaTeX Tutorial 2

What is LaTeX?

Pronounced: Lay-tech S/W package that uses the TeX typesetting engine TeX: computer program released in 1982 by Donald E. Knuth and written for typesetting digital documents [1] For more info see [2]

May 11th, 2004

LaTeX Tutorial

MS Word vs LaTeX

What You See Is What You Get


More Info in [3]

May 11th, 2004

LaTeX Tutorial

Example: Hello World


Text & Commands
hello_world.tex

Typeset Document
hello_world.pdf

LaTeX

May 11th, 2004

LaTeX Tutorial

Overview of LaTeX

Class Files Macro Packages Special Characters Commands


Section Headings, Citations, Cross-References Figures, Tables, Equations Miscellaneous commands

Many examples throughout


May 11th, 2004 LaTeX Tutorial 6

Class File

Defines what your document will look like Selected by \documentclass command

\documentclass[options]{class_name}

Some examples:

amsart.cls (included with basic download)

\documentclass[]{amsart}

IEEEtran.cls (download from [4])

Specify font size, number of columns, format, etc


\documentclass[10pt,conference]{IEEEtran}
LaTeX Tutorial 7

May 11th, 2004

Class Files - Examples

May 11th, 2004

LaTeX Tutorial

Macro Packages

Allow you to use special commands Packages are activated by:

\usepackage[options]{package_name}

Examples:
cite.sty graphicx.sty geometry.sty url.sty
May 11th, 2004

\usepackage{cite} \usepackage{graphicx} \usepackage[margin=1in]{geometry} \usepackage{url}


LaTeX Tutorial 9

Special Characters

The following symbols are reserved:

&

To include them in your text:

\# \$ \% \& \_ \{ \} \^{} \~{}

Note: you cannot just do \\ (which is a linebreak) , but instead:

$\backslash$

May 11th, 2004

LaTeX Tutorial

10

A few more notes

Consecutive whitespace characters (blank or tab) are treated as one space. Paragraphs must be separated by at least one line in the .tex file. Comments can be added using the % character. Any text on a line after % will be ignored by the TeX compiler.

May 11th, 2004

LaTeX Tutorial

11

A Quick Review

LaTeX

May 11th, 2004

LaTeX Tutorial

12

Commands

Used to help organize the document


Section headings Labels and Cross-References Figures Tables Equations Listing Options Miscellaneous: newpage, pagestyle, include Bibliographic Referencing
LaTeX Tutorial 13

May 11th, 2004

Section Headings

Use commands to define sections:


\section{Section Name} \subsection{Sub-section Name} \subsubsection{Sub-sub-section Name} \tableofcontents \appendix OR using the appendix.sty package: \begin{appendices} \end{appendices}

Note: commands are case sensitive


May 11th, 2004 LaTeX Tutorial 14

Labels and Cross-Referencing

Tired of re-numbering your section or figure numbers in MS Word by hand? Solution: Each section, figure, table, equation, and so on can have its own label:

\label{label_name}
\ref{label_name}

You can recall that label in the text:

LaTeX assigns the correct section, figure, table and equation numbers to the labels when you compile the document.
May 11th, 2004 LaTeX Tutorial 15

Label Example

May 11th, 2004

LaTeX Tutorial

16

Figures

Require graphicx.sty package Figure type: eps (encapsulated postscript) Sample code:
\begin{figure}[options] \includegraphics[options]{figure_name.eps} \caption{Figure Caption would go here} \label{fig_label} \end{figure}

May 11th, 2004

LaTeX Tutorial

17

Example

Warning: ind.eps must exist in the same file directory as the TeX file, unless \graphicspath{} command is used.
May 11th, 2004 LaTeX Tutorial 18

Tables

A little awkward to use, but they work: Sample Code:


\begin{table}[options] \renewcommand{\arraystretch}{spacing_num} \caption{Table Caption would go here} \label{tab_label} \centering \begin{tabular}{column_scheme} row_info \end{tabular} \end{table}
May 11th, 2004 LaTeX Tutorial 19

Tables- continued

column_scheme

c, l, or r represent centered, left-justified or right-justified columns |(vertical bar) represents a vertical column line Example: |c|c|c| represents three centered columns
Text in the rows is entered with the&character used to separate the columns \\ indicates a line break \hline adds a horizontal line Example: \hline A & B & C \\ \hline represents a row with three entries and lines above & below
LaTeX Tutorial 20

row_info

May 11th, 2004

Example

Table line spacing


Column Scheme: one leftjustified and three centered columns. Note the double || Notice use of &, \\ and \hline to form the rows
May 11th, 2004 LaTeX Tutorial 21

Equations

Two ways to form equations


Using $: $ equation syntax $ Using commands:


\begin{equation} \label{equation_label} Insert equation syntax here \end{equation}

Syntax can be generated with software packages like MathType orTeXaide


May 11th, 2004 LaTeX Tutorial 22

Example
Makes Eqn numbers appear on the right side of the page

Syntax refer to [1]

May 11th, 2004

LaTeX Tutorial

23

Listing Options

Lists: itemized, enumerated, descriptive

May 11th, 2004

LaTeX Tutorial

24

Miscellaneous Commands

Newpage: \newpage Header/Footer: \pagestyle{style}

style: plain, headings, OR empty \include{filename} \input{filename}

Nested TeX files:


Quotation Marks:

Use `` and , rather than and


LaTeX Tutorial 25

May 11th, 2004

Bibliographic Referencing

BIBTeX: manages bibliographic databases Database files have .bib extension Example of bibliographic entry:
@book{RFICtext, author title publisher address year }; = = = = = "J. Rogers and C. Plett", "Radio Frequency Integrated Circuit Design", "Artech House, Inc", "Boston, MA", "2003"

Style files (.bst) are used to format the entries

IEEEtran.bst [5]
LaTeX Tutorial 26

May 11th, 2004

Referencing - continued

Entries can be referenced from the TeX file:

\cite{RFICtext}

The cite package will have to be included Example:

Numbers are automatically assigned in the correct order IEEEtran.bst bibliography style file RFIC.bib must have an entry labeled RFICtext
May 11th, 2004 LaTeX Tutorial 27

What you need to get started:

Adobe Acrobat Reader

http://www.adobe.com/products/acrobat/ www.miktex.org www.winedt.com (30-day trial download) http://www.dessci.com/en/products/texaide/ (Free download)


LaTeX Tutorial 28

MIKTEX: TeX for Windows

WinEdt: my GUI, but many others exist

TeXAide: for equation editing:

May 11th, 2004

WinEdt Compile Procedure


GUI for editing and compiling LaTeX files Compile Procedure:


Open .tex file and .bib file (if needed) Edit as required Click on TeXify button to compile Watch log file window to check for errors Click on dvi pdf button Click on the Adobe symbol

Adobe should open with your new pdf file


LaTeX Tutorial 29

May 11th, 2004

Demo

May 11th, 2004

LaTeX Tutorial

30

References

The best reference by far is Google Groups:


Go to www.google.com and click on the Groups tab Type in some key words related to your question (include TeX) Click on the Google Search button and you should get some good hits

References:

[1] [2] [3] [4] [5]

http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf?action=/starter/ http://en.wikipedia.org/wiki/TeX http://www.cs.cornell.edu/Info/Misc/LaTeX-Tutorial/Introduction.html http://www.ieee.org/portal/cms_docs/pubs/transactions/IEEEtran.zip http://www.ieee.org/portal/cms_docs/pubs/transactions/IEEEtranBST.zip

May 11th, 2004

LaTeX Tutorial

31

Any Further Questions?

Conference and JournalTemplates for the IEEEtran class file can be downloaded from [4]. LaTeX templates for the amsart class file are available upon request.

May 11th, 2004

LaTeX Tutorial

32

Das könnte Ihnen auch gefallen