Introduction to LaTeX - University of...

42
Introduction Features A Basic L A T E X Document Some L A T E X Examples Installing and Using L A T E X References Introduction to L A T E X Ricky Patterson Big Library 21 Sep 2016 Ricky Patterson Intro to L A T E X 21 Sep 2016 1 / 18

Transcript of Introduction to LaTeX - University of...

Page 1: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Introduction to LATEX

Ricky Patterson

Big Library

21 Sep 2016

Ricky Patterson Intro to LATEX 21 Sep 2016 1 / 18

Page 2: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

OutlineIntroductionFeaturesA Basic LATEX Document

Example DocumentPreamble

\documentclassPackages

BodyTyping Text

CaveatsFormatting

Some LATEX ExamplesTables and FiguresMathematics

Installing and Using LATEXReferences

Ricky Patterson Intro to LATEX 21 Sep 2016 2 / 18

Page 3: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Introduction

I LATEX is a document preparation system for high qualitytypesetting

I Not a Word Processor - Allows authors to focus on contentrather than appearance.

I Frequently used in the preparation of scientific or technicaldocuments, but can be used to create letters, dissertations,music scores, calendars, presentations, etc., etc., etc.

Ricky Patterson Intro to LATEX 21 Sep 2016 3 / 18

Page 4: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

LATEX Features

I Typesetting articles, reports, books, presentationsI Typesetting complex formulasI Control sectioning, cross-references, tables and figuresI Automatic generation of bibliographies, indexes, and TOCsI Free, and Multi-platform (Win/Mac/Linux)I Support: CTAN, TUG

However...I Steep learning curveI Not WYSIWYGI Can’t easily convert to and from Word, etc.

Ricky Patterson Intro to LATEX 21 Sep 2016 4 / 18

Page 5: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

LATEX Features

I Typesetting articles, reports, books, presentationsI Typesetting complex formulasI Control sectioning, cross-references, tables and figuresI Automatic generation of bibliographies, indexes, and TOCsI Free, and Multi-platform (Win/Mac/Linux)I Support: CTAN, TUG

However...I Steep learning curveI Not WYSIWYGI Can’t easily convert to and from Word, etc.

Ricky Patterson Intro to LATEX 21 Sep 2016 4 / 18

Page 6: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Basic Document

\documentclass{article}

\title{My First \LaTeX{}Document}

\author{Ricky Patterson}

\institute{UVa Library}

\date{September 2016}

\begin{document}

\maketitle

Hello world!

\end{document}

Ricky Patterson Intro to LATEX 21 Sep 2016 5 / 18

Page 7: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

My First LATEX Document

Ricky Patterson

UVa Library

September 2016

Hello world!

Ricky Patterson Intro to LATEX 21 Sep 2016 6 / 18

Page 8: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

LATEX Document Preamble

I Everything before the \begin{document}

I Commands placed here will apply to the entire documentI Can customize line width, margins, paragraph spacing,

fonts, page height and widthI Load additional packages hereI At minimum, it must contain a\documentclass[options]{document type} statement...

Ricky Patterson Intro to LATEX 21 Sep 2016 7 / 18

Page 9: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

LATEX Document Preamble

I Everything before the \begin{document}I Commands placed here will apply to the entire document

I Can customize line width, margins, paragraph spacing,fonts, page height and width

I Load additional packages hereI At minimum, it must contain a\documentclass[options]{document type} statement...

Ricky Patterson Intro to LATEX 21 Sep 2016 7 / 18

Page 10: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

LATEX Document Preamble

I Everything before the \begin{document}I Commands placed here will apply to the entire documentI Can customize line width, margins, paragraph spacing,

fonts, page height and width

I Load additional packages hereI At minimum, it must contain a\documentclass[options]{document type} statement...

Ricky Patterson Intro to LATEX 21 Sep 2016 7 / 18

Page 11: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

LATEX Document Preamble

I Everything before the \begin{document}I Commands placed here will apply to the entire documentI Can customize line width, margins, paragraph spacing,

fonts, page height and widthI Load additional packages here

I At minimum, it must contain a\documentclass[options]{document type} statement...

Ricky Patterson Intro to LATEX 21 Sep 2016 7 / 18

Page 12: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

LATEX Document Preamble

I Everything before the \begin{document}I Commands placed here will apply to the entire documentI Can customize line width, margins, paragraph spacing,

fonts, page height and widthI Load additional packages hereI At minimum, it must contain a\documentclass[options]{document type} statement...

Ricky Patterson Intro to LATEX 21 Sep 2016 7 / 18

Page 13: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

\documentclass

I The only required line in a preamble

I \documentclass[options]{document type}I document types:

I article: Default. contains: parts, sections, subsections...I report: also contains chaptersI book: like report, but treats even/odd pages differentlyI letter: for writing letters

I OptionsI Font Size (10pt,11pt,12pt)I Paper Size (letterpaper), and Orientation (landscape)I Page Format (twocolumn, oneside)I and others...

Ricky Patterson Intro to LATEX 21 Sep 2016 8 / 18

Page 14: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

\documentclass

I The only required line in a preambleI \documentclass[options]{document type}

I document types:I article: Default. contains: parts, sections, subsections...I report: also contains chaptersI book: like report, but treats even/odd pages differentlyI letter: for writing letters

I OptionsI Font Size (10pt,11pt,12pt)I Paper Size (letterpaper), and Orientation (landscape)I Page Format (twocolumn, oneside)I and others...

Ricky Patterson Intro to LATEX 21 Sep 2016 8 / 18

Page 15: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

\documentclass

I The only required line in a preambleI \documentclass[options]{document type}I document types:

I article: Default. contains: parts, sections, subsections...I report: also contains chaptersI book: like report, but treats even/odd pages differentlyI letter: for writing letters

I OptionsI Font Size (10pt,11pt,12pt)I Paper Size (letterpaper), and Orientation (landscape)I Page Format (twocolumn, oneside)I and others...

Ricky Patterson Intro to LATEX 21 Sep 2016 8 / 18

Page 16: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

\documentclass

I The only required line in a preambleI \documentclass[options]{document type}I document types:

I article: Default. contains: parts, sections, subsections...I report: also contains chaptersI book: like report, but treats even/odd pages differentlyI letter: for writing letters

I OptionsI Font Size (10pt,11pt,12pt)I Paper Size (letterpaper), and Orientation (landscape)I Page Format (twocolumn, oneside)I and others...

Ricky Patterson Intro to LATEX 21 Sep 2016 8 / 18

Page 17: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Packages

I You can further customize the behavior of somecommands, and add additional commands by invokingadditional packages, with\usepackage[option1,options2...]{package1,package2...}

I CTAN (The Comprehensive TEX Archive Network) currentlyhosts over 5000 packages at http://www.ctan.org

I You can write your own packages (or more likely edit/tweakan existing package to alter the behavior in order to meetyour needs). They are simply lines of LATEX commands.

Ricky Patterson Intro to LATEX 21 Sep 2016 9 / 18

Page 18: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Packages

I You can further customize the behavior of somecommands, and add additional commands by invokingadditional packages, with\usepackage[option1,options2...]{package1,package2...}

I CTAN (The Comprehensive TEX Archive Network) currentlyhosts over 5000 packages at http://www.ctan.org

I You can write your own packages (or more likely edit/tweakan existing package to alter the behavior in order to meetyour needs). They are simply lines of LATEX commands.

Ricky Patterson Intro to LATEX 21 Sep 2016 9 / 18

Page 19: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Packages

I You can further customize the behavior of somecommands, and add additional commands by invokingadditional packages, with\usepackage[option1,options2...]{package1,package2...}

I CTAN (The Comprehensive TEX Archive Network) currentlyhosts over 5000 packages at http://www.ctan.org

I You can write your own packages (or more likely edit/tweakan existing package to alter the behavior in order to meetyour needs). They are simply lines of LATEX commands.

Ricky Patterson Intro to LATEX 21 Sep 2016 9 / 18

Page 20: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Body of Document

I End the preamble and begin the body with\begin{document}

I End the body (and the entire document) with\end{document}

I Simplest possible document:\documentclass{article}

\begin{docuemnt}

\end{document}

I But it will produce a blank page

Ricky Patterson Intro to LATEX 21 Sep 2016 10 / 18

Page 21: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Body of Document

I End the preamble and begin the body with\begin{document}

I End the body (and the entire document) with\end{document}

I Simplest possible document:\documentclass{article}

\begin{docuemnt}

\end{document}

I But it will produce a blank page

Ricky Patterson Intro to LATEX 21 Sep 2016 10 / 18

Page 22: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Body of Document

I End the preamble and begin the body with\begin{document}

I End the body (and the entire document) with\end{document}

I Simplest possible document:\documentclass{article}

\begin{docuemnt}

\end{document}

I But it will produce a blank page

Ricky Patterson Intro to LATEX 21 Sep 2016 10 / 18

Page 23: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Body of Document

I End the preamble and begin the body with\begin{document}

I End the body (and the entire document) with\end{document}

I Simplest possible document:\documentclass{article}

\begin{docuemnt}

\end{document}

I But it will produce a blank page

Ricky Patterson Intro to LATEX 21 Sep 2016 10 / 18

Page 24: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Document

I Hello World document:\documentclass{article}

\begin{docuemnt}

Hello World!

\end{document}

Ricky Patterson Intro to LATEX 21 Sep 2016 11 / 18

Page 25: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Typing Text

I Two basic modes or environments: text and math

I Special Characters: #, %, ,̂ $, &, , {, }, ,̃ and \ They can’tbe used in regular text without first “escaping” them,usually by prepending a \

I Some symbols are only available in math mode. You cantemporarily enter math mode by enclosing the command indollar signs ($). For instance $ \alpha $ will produce α

I Guides to symbols are easy to find online; you can evendraw a symbol to find the proper code using Detexify(http://detexify.krelabs.org)

I Double quotes are produced by typing two of the openingquote (‘) or closing quote (’)

Ricky Patterson Intro to LATEX 21 Sep 2016 12 / 18

Page 26: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Typing Text

I Two basic modes or environments: text and mathI Special Characters: #, %, ,̂ $, &, , {, }, ,̃ and \ They can’t

be used in regular text without first “escaping” them,usually by prepending a \

I Some symbols are only available in math mode. You cantemporarily enter math mode by enclosing the command indollar signs ($). For instance $ \alpha $ will produce α

I Guides to symbols are easy to find online; you can evendraw a symbol to find the proper code using Detexify(http://detexify.krelabs.org)

I Double quotes are produced by typing two of the openingquote (‘) or closing quote (’)

Ricky Patterson Intro to LATEX 21 Sep 2016 12 / 18

Page 27: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Typing Text

I Two basic modes or environments: text and mathI Special Characters: #, %, ,̂ $, &, , {, }, ,̃ and \ They can’t

be used in regular text without first “escaping” them,usually by prepending a \

I Some symbols are only available in math mode. You cantemporarily enter math mode by enclosing the command indollar signs ($). For instance $ \alpha $ will produce α

I Guides to symbols are easy to find online; you can evendraw a symbol to find the proper code using Detexify(http://detexify.krelabs.org)

I Double quotes are produced by typing two of the openingquote (‘) or closing quote (’)

Ricky Patterson Intro to LATEX 21 Sep 2016 12 / 18

Page 28: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Typing Text

I Two basic modes or environments: text and mathI Special Characters: #, %, ,̂ $, &, , {, }, ,̃ and \ They can’t

be used in regular text without first “escaping” them,usually by prepending a \

I Some symbols are only available in math mode. You cantemporarily enter math mode by enclosing the command indollar signs ($). For instance $ \alpha $ will produce α

I Guides to symbols are easy to find online; you can evendraw a symbol to find the proper code using Detexify(http://detexify.krelabs.org)

I Double quotes are produced by typing two of the openingquote (‘) or closing quote (’)

Ricky Patterson Intro to LATEX 21 Sep 2016 12 / 18

Page 29: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Typing Text

I Two basic modes or environments: text and mathI Special Characters: #, %, ,̂ $, &, , {, }, ,̃ and \ They can’t

be used in regular text without first “escaping” them,usually by prepending a \

I Some symbols are only available in math mode. You cantemporarily enter math mode by enclosing the command indollar signs ($). For instance $ \alpha $ will produce α

I Guides to symbols are easy to find online; you can evendraw a symbol to find the proper code using Detexify(http://detexify.krelabs.org)

I Double quotes are produced by typing two of the openingquote (‘) or closing quote (’)

Ricky Patterson Intro to LATEX 21 Sep 2016 12 / 18

Page 30: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Formatting

I Change style: \textbf{strong} or {\bf strong}: strong

I Similarly \textit{italicize}: italicize, \texttt{fixed width}:fixed width, and \textsc{small caps}: SMALL CAPS.

I \underline{underlined} produces underlined,\textcolor{color name}{pretty} produces pretty.

I text$ {sub}$ yields textsub while text${̂sup}$ yieldstextsup. Note that any text in math mode will by defaulthave an italic face. Use \rm to get a normal (roman) fontface. text$ {\rm sub}$ yields textsub

I The overall font size is set in preamble, but you can changefont size temporarily: {\tiny tiny text} gives tiny text. Othersizes: scriptsize, footnotesize, small, normalsize, large,

Large, LARGE, huge, and Huge.

Ricky Patterson Intro to LATEX 21 Sep 2016 13 / 18

Page 31: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Formatting

I Change style: \textbf{strong} or {\bf strong}: strongI Similarly \textit{italicize}: italicize, \texttt{fixed width}:

fixed width, and \textsc{small caps}: SMALL CAPS.

I \underline{underlined} produces underlined,\textcolor{color name}{pretty} produces pretty.

I text$ {sub}$ yields textsub while text${̂sup}$ yieldstextsup. Note that any text in math mode will by defaulthave an italic face. Use \rm to get a normal (roman) fontface. text$ {\rm sub}$ yields textsub

I The overall font size is set in preamble, but you can changefont size temporarily: {\tiny tiny text} gives tiny text. Othersizes: scriptsize, footnotesize, small, normalsize, large,

Large, LARGE, huge, and Huge.

Ricky Patterson Intro to LATEX 21 Sep 2016 13 / 18

Page 32: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Formatting

I Change style: \textbf{strong} or {\bf strong}: strongI Similarly \textit{italicize}: italicize, \texttt{fixed width}:

fixed width, and \textsc{small caps}: SMALL CAPS.I \underline{underlined} produces underlined,\textcolor{color name}{pretty} produces pretty.

I text$ {sub}$ yields textsub while text${̂sup}$ yieldstextsup. Note that any text in math mode will by defaulthave an italic face. Use \rm to get a normal (roman) fontface. text$ {\rm sub}$ yields textsub

I The overall font size is set in preamble, but you can changefont size temporarily: {\tiny tiny text} gives tiny text. Othersizes: scriptsize, footnotesize, small, normalsize, large,

Large, LARGE, huge, and Huge.

Ricky Patterson Intro to LATEX 21 Sep 2016 13 / 18

Page 33: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Formatting

I Change style: \textbf{strong} or {\bf strong}: strongI Similarly \textit{italicize}: italicize, \texttt{fixed width}:

fixed width, and \textsc{small caps}: SMALL CAPS.I \underline{underlined} produces underlined,\textcolor{color name}{pretty} produces pretty.

I text$ {sub}$ yields textsub while text${̂sup}$ yieldstextsup. Note that any text in math mode will by defaulthave an italic face. Use \rm to get a normal (roman) fontface. text$ {\rm sub}$ yields textsub

I The overall font size is set in preamble, but you can changefont size temporarily: {\tiny tiny text} gives tiny text. Othersizes: scriptsize, footnotesize, small, normalsize, large,

Large, LARGE, huge, and Huge.

Ricky Patterson Intro to LATEX 21 Sep 2016 13 / 18

Page 34: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

Formatting

I Change style: \textbf{strong} or {\bf strong}: strongI Similarly \textit{italicize}: italicize, \texttt{fixed width}:

fixed width, and \textsc{small caps}: SMALL CAPS.I \underline{underlined} produces underlined,\textcolor{color name}{pretty} produces pretty.

I text$ {sub}$ yields textsub while text${̂sup}$ yieldstextsup. Note that any text in math mode will by defaulthave an italic face. Use \rm to get a normal (roman) fontface. text$ {\rm sub}$ yields textsub

I The overall font size is set in preamble, but you can changefont size temporarily: {\tiny tiny text} gives tiny text. Othersizes: scriptsize, footnotesize, small, normalsize, large,

Large, LARGE, huge, and Huge.Ricky Patterson Intro to LATEX 21 Sep 2016 13 / 18

Page 35: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

More Formatting

I Three environments for Lists: Itemize, Enumerate, andDescription

I \begin{itemize} generates bulleted list, for each linebeginning with \item{symbol} item in list. Symbol isoptional, but can be used to customize bullet type.

I \begin{enumerate} is similar to itemize, but the list is nownumbered. You can control the style (arabic, roman, letter,etc.) and starting value of the numbers.

I \begin{description} also produces a list with each\item[Point I] text yields:Point I text

Ricky Patterson Intro to LATEX 21 Sep 2016 14 / 18

Page 36: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

More Formatting

I Three environments for Lists: Itemize, Enumerate, andDescription

I \begin{itemize} generates bulleted list, for each linebeginning with \item{symbol} item in list. Symbol isoptional, but can be used to customize bullet type.

I \begin{enumerate} is similar to itemize, but the list is nownumbered. You can control the style (arabic, roman, letter,etc.) and starting value of the numbers.

I \begin{description} also produces a list with each\item[Point I] text yields:Point I text

Ricky Patterson Intro to LATEX 21 Sep 2016 14 / 18

Page 37: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

More Formatting

I Three environments for Lists: Itemize, Enumerate, andDescription

I \begin{itemize} generates bulleted list, for each linebeginning with \item{symbol} item in list. Symbol isoptional, but can be used to customize bullet type.

I \begin{enumerate} is similar to itemize, but the list is nownumbered. You can control the style (arabic, roman, letter,etc.) and starting value of the numbers.

I \begin{description} also produces a list with each\item[Point I] text yields:Point I text

Ricky Patterson Intro to LATEX 21 Sep 2016 14 / 18

Page 38: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Example DocumentPreambleBodyTyping Text

More Formatting

I Three environments for Lists: Itemize, Enumerate, andDescription

I \begin{itemize} generates bulleted list, for each linebeginning with \item{symbol} item in list. Symbol isoptional, but can be used to customize bullet type.

I \begin{enumerate} is similar to itemize, but the list is nownumbered. You can control the style (arabic, roman, letter,etc.) and starting value of the numbers.

I \begin{description} also produces a list with each\item[Point I] text yields:Point I text

Ricky Patterson Intro to LATEX 21 Sep 2016 14 / 18

Page 39: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Tables and FiguresMathematics

Tables and Figures

I Use tabular for basic tables — see Table 1, for example.I To include a figure in your document, use the

includegraphics command (see the comment below inthe source code).

Item QuantityWidgets 42Gadgets 13

Table 1: An example table.

Ricky Patterson Intro to LATEX 21 Sep 2016 15 / 18

Page 40: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Tables and FiguresMathematics

Readable Mathematics

Let X1,X2, . . . ,Xn be a sequence of independent and identicallydistributed random variables with E[Xi ] = µ andVar[Xi ] = σ2 <∞, and let

Sn =X1 + X2 + · · ·+ Xn

n=

1n

n∑i

Xi

denote their mean. Then as n approaches infinity, the randomvariables

√n(Sn − µ) converge in distribution to a normal

N (0, σ2).

Ricky Patterson Intro to LATEX 21 Sep 2016 16 / 18

Page 41: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

Installing and Using

I There are several browser/cloud-based solutions. Overleaf,ShareLaTeX and Authorea all provide collaborativeediting capabilities and LATEX package and templatesupport. There are free and paid versions of each.

I You can also install LATEX locally. TeXLive (MacTeX onMacs) is one good (and free) choice. It can be configuredto check for package updates at CTAN automatically.

I When you try to write valid LATEX you’ll want an editor thathas a LATEX mode. TeXShop (part of TeXLive) is one,TeXStudio is another. Emacs and VIM have good support.

Ricky Patterson Intro to LATEX 21 Sep 2016 17 / 18

Page 42: Introduction to LaTeX - University of Virginiastatic.lib.virginia.edu/.../Intro2LaTeXFall2016.pdf · 2016-09-21 · Introduction Features A Basic LATEX Document Some LATEX Examples

IntroductionFeatures

A Basic LATEX DocumentSome LATEX Examples

Installing and Using LATEXReferences

References

I CTAN (Comprehensive TEX Archive Network): ctan.orgI TUG (TEX Users Group): tug.orgI The LATEX Companion (Mittelbach and Goossens, 2004)I A Guide to LATEX: Document Preparation for Beginners and

Advanced Users (Kopka and Daly, 1999)I The Not So Short Intro to LATEX (Oetiker, updated July 2015→ lshort.pdf)

I This presentation (code and PDF):https://www.overleaf.com/read/mctrvxzfdtvh

I Materials from previous LATEX workshops:http://data.library.virginia.edu/statlab/past-workshops/

I Overleaf.com Templates and Intro Guides.

Ricky Patterson Intro to LATEX 21 Sep 2016 18 / 18