0% found this document useful (0 votes)
76 views51 pages

Latex 1232732314274501 2

This document provides an introduction to LaTeX, including what LaTeX is, why it should be used, how to get LaTeX, the basic structure of a LaTeX document, common commands, special characters, how LaTeX works, common file types, and how to compile a LaTeX document. It outlines the preamble, body, and ending of a basic LaTeX document and describes common commands. It also explains LaTeX document classes, output files, and the compiling process.

Uploaded by

mmrmathsiubd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views51 pages

Latex 1232732314274501 2

This document provides an introduction to LaTeX, including what LaTeX is, why it should be used, how to get LaTeX, the basic structure of a LaTeX document, common commands, special characters, how LaTeX works, common file types, and how to compile a LaTeX document. It outlines the preamble, body, and ending of a basic LaTeX document and describes common commands. It also explains LaTeX document classes, output files, and the compiling process.

Uploaded by

mmrmathsiubd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

An Intro to LATEXPart I

An introduction to creating a LATEXdocument

Aubry W. Verret

Brown Science and Engineering Library Research Computing Lab

November 10, 2008


Outline I
Introduction to LATEX
What is LATEX?
Why use LATEX?
How to Get LATEX
Basic LATEXDocument
Example Document
Markup fo Example Document
Basic LATEXCommands
Special LATEXcharacters
Compiling
How LATEXWorks
How to Compile
Files
CLS files
Output files
Index and Table of Contents Generation
The ToC
Outline II
The Index

Bibliographies
.bib files
Bibliography Styles
Compiling
Bibliography Assistance

Resources

Preview
What is LATEX?

Definition
LATEXis a powerful document markup system that uses the TeX
typesetting program.
It is pronounced as ’Lah Tek’ or ’Lay Tek’
Why use LATEX?

I LATEXproduces superior quality documents compared to word


processor such as Microsoft Word.

I It offers separation of content and formatting

I Makes it easy to collaborate with others on a document

I Many conferences prefer submissions done in LATEX


How to Get LATEX

There are several distributions of LATEXthat are free to obtain.


How to Get LATEX

There are several distributions of LATEXthat are free to obtain.


I Windows - MikTeX is a common package to use. It is free
and easy to install.
Common editors to use are TeXnicCenter, WinShell, and Led.
How to Get LATEX

There are several distributions of LATEXthat are free to obtain.


I Windows - MikTeX is a common package to use. It is free
and easy to install.
Common editors to use are TeXnicCenter, WinShell, and Led.
I Mac - MacTex is the current distribution for Mac users.
How to Get LATEX

There are several distributions of LATEXthat are free to obtain.


I Windows - MikTeX is a common package to use. It is free
and easy to install.
Common editors to use are TeXnicCenter, WinShell, and Led.
I Mac - MacTex is the current distribution for Mac users.
I Linux - It is likely that LATEXis already a part of your operating
system, but if not you can install Tex live.
You can use whatever text editor you would normally prefer to
use, Emacs, Vi, etc.
How to Get LATEX

There are several distributions of LATEXthat are free to obtain.


I Windows - MikTeX is a common package to use. It is free
and easy to install.
Common editors to use are TeXnicCenter, WinShell, and Led.
I Mac - MacTex is the current distribution for Mac users.
I Linux - It is likely that LATEXis already a part of your operating
system, but if not you can install Tex live.
You can use whatever text editor you would normally prefer to
use, Emacs, Vi, etc.
I LATEXis also on all of the Lab computers
How to Get LATEX

There are several distributions of LATEXthat are free to obtain.


I Windows - MikTeX is a common package to use. It is free
and easy to install.
Common editors to use are TeXnicCenter, WinShell, and Led.
I Mac - MacTex is the current distribution for Mac users.
I Linux - It is likely that LATEXis already a part of your operating
system, but if not you can install Tex live.
You can use whatever text editor you would normally prefer to
use, Emacs, Vi, etc.
I LATEXis also on all of the Lab computers
Go here for more information
http://www.latex-project.org/ftp.html
Basic LATEXDocument

The basic LATEXdocument consists of a preamble, a body, and an


ending.
A Basic LATEXDocument

Example Document
Aubry W. Verret
November 7, 2008

Hello World!
Markup for a Basic LATEXDocument

\ documentclass { a r t i c l e }
\ t i t l e {A B a s i c \LaTeX Document }
\ a u t h o r { Aubry W. V e r r e t }
\ d a t e { November 2008}
\ b e g i n { document }
\ maketitle

H e l l o World !

\end{ document }
Basic LATEXcommands: Preamble

LATEXdocuments begin with a preamble:


Basic LATEXcommands: Preamble

LATEXdocuments begin with a preamble:


I \documentclass{}
Basic LATEXcommands: Preamble

LATEXdocuments begin with a preamble:


I \documentclass{}
I \title{}
Basic LATEXcommands: Preamble

LATEXdocuments begin with a preamble:


I \documentclass{}
I \title{}
I \author{}
Basic LATEXcommands: Preamble

LATEXdocuments begin with a preamble:


I \documentclass{}
I \title{}
I \author{}
I \date{}
Basic LATEXCommands: Body

The Body of the document:


Basic LATEXCommands: Body

The Body of the document:


I \begin{document}
Basic LATEXCommands: Body

The Body of the document:


I \begin{document}
I \maketitle
Basic LATEXCommands: Body

The Body of the document:


I \begin{document}
I \maketitle
You can then type the body of your document.
No need to indent-this happens automatically.
Separate paragraphs by a blank line.
Basic LATEXCommands: Body

The Body of the document:


I \begin{document}
I \maketitle
You can then type the body of your document.
No need to indent-this happens automatically.
Separate paragraphs by a blank line.
The document must end with
I \end{document}
Other Common Commands

Here are some other commands that you will use often:
I \section
I \subsection
I \chapter
I {\bf text}
I {\it text}
I \smallskip \medskip \bigskip
I \begin{enumerate}...\end{enumerate}
I \begin{itemize}...\end{itemize}
Special Characters

LATEXreserves some characters for special purposes:

\ # $ % & ~ _ ^ { }

These characters cannot be used by themselves in your document.


Special Characters

LATEXreserves some characters for special purposes:

\ # $ % & ~ _ ^ { }

These characters cannot be used by themselves in your document.

You can include these characters in your text by using the Escape
Character

\
Understanding How LATEXWorks

LATEXtakes in a number of different input files and outputs a


number of different files.

The main input file is the .tex file.

Along with the .tex file, LATEXreads in .cls files and .sty files which
provide all of the needed formatting information.
LATEXoutputs a .dvi file and a .log file
Compiling LATEX

In order to compile your LATEXdocument use the latex command on


the .tex file.
Compiling LATEX

In order to compile your LATEXdocument use the latex command on


the .tex file.

For example, if you


are using a unix environment then the command would look like this:

latex name of file.tex


.cls files

.cls files specify the format of a specific type of document


document. LATEXcomes with four different document classes:
.cls files

.cls files specify the format of a specific type of document


document. LATEXcomes with four different document classes:
I book - This is good for writing longer books with many
chapters
.cls files

.cls files specify the format of a specific type of document


document. LATEXcomes with four different document classes:
I book - This is good for writing longer books with many
chapters
I report - This is good for longer works like dissertations,
theses, short books
.cls files

.cls files specify the format of a specific type of document


document. LATEXcomes with four different document classes:
I book - This is good for writing longer books with many
chapters
I report - This is good for longer works like dissertations,
theses, short books
I article - This is good for conference presentations, short
reports, shorter documents
.cls files

.cls files specify the format of a specific type of document


document. LATEXcomes with four different document classes:
I book - This is good for writing longer books with many
chapters
I report - This is good for longer works like dissertations,
theses, short books
I article - This is good for conference presentations, short
reports, shorter documents
I letter - This is a simple way of writing a well-formatted letter.
.cls files

.cls files specify the format of a specific type of document


document. LATEXcomes with four different document classes:
I book - This is good for writing longer books with many
chapters
I report - This is good for longer works like dissertations,
theses, short books
I article - This is good for conference presentations, short
reports, shorter documents
I letter - This is a simple way of writing a well-formatted letter.
These are mostly similar with some small differences. For instance,
the book class allows for chapters and the article class allows for
abstracts.
.cls files

.cls files specify the format of a specific type of document


document. LATEXcomes with four different document classes:
I book - This is good for writing longer books with many
chapters
I report - This is good for longer works like dissertations,
theses, short books
I article - This is good for conference presentations, short
reports, shorter documents
I letter - This is a simple way of writing a well-formatted letter.
These are mostly similar with some small differences. For instance,
the book class allows for chapters and the article class allows for
abstracts.
There are also many .sty files that allow for more specific
formatting control.
Output Files

DVIs (device independent) are files that contain a preview of your


document once it is compiled. It can be converted to a number of
different formats, such as PDF for printing.

LOG files contain a transcript of the compilation process. They


mostly contain the same information that is printed to the screen
during the process.
How to Generate a Table of Contents

Table of Contents in LATEXcan be generated automatically using the

\tableofcontents command.

Place the command wherever you want the table of contents to


appear. This is usually right after the

\maketitle command.

The way

\tableofcontents

works is by taking entries from the sectioning commands. You


must run the latex command twice to generate the ToC whenever
you add new entries to it. The first time the entries are recorded
on a .toc file. The second time they are actually typeset.
How To Generate Indexes
LATEXcan automatically generate indexes

Include

\usepackage{makeidx}
\makeindex

in the preamble.
When you encounter a term in your document that you would like
to be indexed, use the

\index{term}term command

You will need to run LATEXtwice in order for the index to appear.
Once for the entries to be recorded in a .idx file and twice for the
entries to be typeset.

It is possible to create various levels of entries.


Bib files

It is relatively simple to generate bibliographies in LATEXusing


bibtex and many different bibliographic formats are available.

Bibliographic entries must be kept in a separate file, the .bib file

This is the basic format for bib file entries:

@BOOK{make up an abbreviation,
AUTHOR = "author",
TITLE = "book title",
PUBLISHER = {who published it},
ADDRESS = {where it was published},
YEAR = year it was published}
@BOOK{latex,
AUTHOR = "Goossens, Michel",
TITLE = "The \LaTeX Companion",
PUBLISHER = {Addison Wesley Longman, Inc.},
ADDRESS = {Reading, MA},
YEAR = 1994}
@BOOK{latex,
AUTHOR = "Goossens, Michel",
TITLE = "The \LaTeX Companion",
PUBLISHER = {Addison Wesley Longman, Inc.},
ADDRESS = {Reading, MA},
YEAR = 1994}

Your document should reference the source as follows:

\cite[p. 24] {latex}


@BOOK{latex,
AUTHOR = "Goossens, Michel",
TITLE = "The \LaTeX Companion",
PUBLISHER = {Addison Wesley Longman, Inc.},
ADDRESS = {Reading, MA},
YEAR = 1994}

Your document should reference the source as follows:

\cite[p. 24] {latex}

To make the bibliography appear in your document include these


commands at the end where you want the bibliography to go:

\bibliography{filename}
\bibliographystyle{plain}
Bibliography styles

There are several different options for the bibliographystyle


command. It is also possible to define the style of the bibliography
using external custom style files.

Go here for more info on bib styles:

http://amath.colorado.edu/documentation/LaTeX/
reference/faq/bibstyles.html#styles
Compiling the bibliography

Compiling a document with a bibliography is a little more


complicated.

I run latex on the .tex file


I run bibtex on the .tex file
I run latex twice more
The first time you run latex, a .aux file is created which bibtex will
subsequently read. The subsequent latex runs allow latex to
resolve all of the references between the document and the bib file.

Each time you add new references to your document you must
repeat this process.
Bibliography Assistance

You can use an external program to manage your bibliography.

A good program for this is Jabref


I Free
I Detailed editing of entries
I Compatibility with various formats
I Automatic key generation
You can get Jabref here: http://jabref.sourceforge.net/
Where to get Help

There are several different resources for learning LATEX


Books:
I LATEXConcisely by Adrian Johnstone
I The LATEXCompanion by Michel Goossens
I A Guide to LATEXby Melmut Kopka
I LATEXFor Scientists and Engineers by David J. Buerger
I The LAT
EXGraphics Companion
I The LATEXWeb Companion
Online: There are numerous online tutorials and user guides for
LATEX, specific commands, packages, etc.

The Research Computing Lab: You can send questions to me


through our ticket system
http:
//www2.lib.virginia.edu/brown/rescomp/help/index.html
What’s Coming Next?

Intro to LATEXPart 2 will cover:

I Including Notes
I Typesetting Mathematics
I Tables
I Graphics
I Figures
I Presentations

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy