creating tables and figures with latex...introduction tables figures references creating tables and...

38
Introduction Tables Figures References Creating Tables and Figures with L A T E X Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson Tables and Figures in L A T E X 5 Oct 2016 1 / 23

Upload: others

Post on 17-Aug-2020

14 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

Creating Tables and Figures with LATEX

Ricky Patterson

bit.ly/LaTeXTables

5 Oct 2016

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 1 / 23

Page 2: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

Outline

Introduction

Tablestabular environmentmulticolumn@-expressions

Figurespicture environmentImporting Graphics

References

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 2 / 23

Page 3: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

Introduction

I LATEX is a document preparation system for high qualitytypesetting

I Figures and Tables are usually handled as ”Floats” which,unlike words, cannot be broken across a line or a page

I LATEX allows you much control over the appearance andplacement of tables and figures

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 3 / 23

Page 4: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tables

Tables are usually created within the tabular environment.

\begin{tabular}[pos]{table spec}

The table spec specifies the total number of columns, as wellas the alignment for each column (l, c, or r). The option posargument specifies the vertical location of the table with respectto the surrounding text (b, c, t). c is the default.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 4 / 23

Page 5: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

Keep in mind that LATEX is not a spreadsheet, and it is best togenerate the values for a complex table externally, and themimport the results into LATEX, adding the necessary formatting inan automated way if possible.

For instance: Each element in a LATEX table is separated fromthe adjacent column by an &. Unless you enjoy typing &symbols, you’ll want to format the write statement of the codethat is writing out your data to add a & symbol betweencolumns to make it LATEX ready.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 5 / 23

Page 6: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

Keep in mind that LATEX is not a spreadsheet, and it is best togenerate the values for a complex table externally, and themimport the results into LATEX, adding the necessary formatting inan automated way if possible.

For instance: Each element in a LATEX table is separated fromthe adjacent column by an &. Unless you enjoy typing &symbols, you’ll want to format the write statement of the codethat is writing out your data to add a & symbol betweencolumns to make it LATEX ready.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 5 / 23

Page 7: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tablesheader 1 header 2 header 4

header 4 cell 1 cell 2 cell 3header 5 cell 4 cell 5 cell 6

\begin{tabular}{c||c|c|c|}

& \textbf{header 1}&\textbf{header 2}& \textbf{header 4}\\

\hline\hline

\textbf{header 4}& cell 1 & cell 2 & cell 3 \\

\hline

\textbf{header 5}& cell 4 & cell 5 & cell 6 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 6 / 23

Page 8: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tablesheader 1 header 2 header 4

header 4 cell 1 cell 2 cell 3header 5 cell 4 cell 5 cell 6

\begin{tabular}{c||c|c|c|}

& \textbf{header 1}&\textbf{header 2}& \textbf{header 4}\\

\hline\hline

\textbf{header 4}& cell 1 & cell 2 & cell 3 \\

\hline

\textbf{header 5}& cell 4 & cell 5 & cell 6 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 6 / 23

Page 9: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

There are some additional symbols which can be used todescribe table columns. Obviously | puts a vertical line betweencolumns, and || puts two vertical lines.

In addition p{’width’}specifies a ”paragraph” column, of width ’width’. A non-pcolumn does not wrap text within the cell, so if you have a lot oftext in a cell, you may want to use p to control the appearance.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 7 / 23

Page 10: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

There are some additional symbols which can be used todescribe table columns. Obviously | puts a vertical line betweencolumns, and || puts two vertical lines. In addition p{’width’}specifies a ”paragraph” column, of width ’width’.

A non-pcolumn does not wrap text within the cell, so if you have a lot oftext in a cell, you may want to use p to control the appearance.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 7 / 23

Page 11: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

There are some additional symbols which can be used todescribe table columns. Obviously | puts a vertical line betweencolumns, and || puts two vertical lines. In addition p{’width’}specifies a ”paragraph” column, of width ’width’. A non-pcolumn does not wrap text within the cell, so if you have a lot oftext in a cell, you may want to use p to control the appearance.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 7 / 23

Page 12: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

\begin{tabular}{| l | l | l | l |}

Day Min Temp Max Temp SummaryMonday 11C 22C A clear day with lots of sunshine. However, the strong breeze will bring down the temperatures.

versus

\begin{tabular}{| l | l | l | p{5cm}|}

Day Min Temp Max Temp SummaryMonday 11C 22C A clear day with lots of sun-

shine. However, the strongbreeze will bring down thetemperatures.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 8 / 23

Page 13: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

\begin{tabular}{| l | l | l | l |}

Day Min Temp Max Temp SummaryMonday 11C 22C A clear day with lots of sunshine. However, the strong breeze will bring down the temperatures.

versus

\begin{tabular}{| l | l | l | p{5cm}|}

Day Min Temp Max Temp SummaryMonday 11C 22C A clear day with lots of sun-

shine. However, the strongbreeze will bring down thetemperatures.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 8 / 23

Page 14: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

Use \multicolumn for cells which span more than one column:

\multicolumn{number cols}{align}{text}% align: l,c,r

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 9 / 23

Page 15: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tablesheader 1 header 2 header 4

header 4 cell 1 and 2 cell 3header 5 cell 4 cell 5 cell 6

\begin{tabular}{c||c|c|c|}

& \textbf{header 1}&\textbf{header 2}& \textbf{header 4}\\

\hline\hline

\textbf{header 4}& \multicolumn{2}{l}{cell 1 and 2}& cell

3 \\

\hline

\textbf{header 5}& cell 4 & cell 5 & cell 6 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 10 / 23

Page 16: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tablesheader 1 header 2 header 4

header 4 cell 1 and 2 cell 3header 5 cell 4 cell 5 cell 6

\begin{tabular}{c||c|c|c|}

& \textbf{header 1}&\textbf{header 2}& \textbf{header 4}\\

\hline\hline

\textbf{header 4}& \multicolumn{2}{l}{cell 1 and 2}& cell

3 \\

\hline

\textbf{header 5}& cell 4 & cell 5 & cell 6 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 10 / 23

Page 17: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tablesheader 1 header 2 header 4

header 4 cell 1 and 2 cell 3header 5 cell 4 cell 5 cell 6

\begin{tabular}{c||c|c|c|}

& \textbf{header 1}&\textbf{header 2}& \textbf{header 4}\\

\hline\hline

\textbf{header 4}& \multicolumn{2}{l|}{cell 1 and 2}& cell

3 \\

\hline

\textbf{header 5}& cell 4 & cell 5 & cell 6 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 11 / 23

Page 18: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tablesheader 1 header 2 header 4

header 4 cell 1 and 2 cell 3header 5 cell 4 cell 5 cell 6

\begin{tabular}{c||c|c|c|}

& \textbf{header 1}&\textbf{header 2}& \textbf{header 4}\\

\hline\hline

\textbf{header 4}& \multicolumn{2}{l}{cell 1 and 2}& cell

3 \\

\hline

\textbf{header 5}& cell 4 & cell 5 & cell 6 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 12 / 23

Page 19: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

LATEX Tablesheader 1 header 2 header 4

header 4 cell 1 and 2 cell 3header 5 cell 4 cell 5 cell 6

\begin{tabular}{c||c|c|c|}

& \textbf{header 1}&\textbf{header 2}& \textbf{header 4}\\

\hline\hline

\textbf{header 4}& \multicolumn{2}{l}{cell 1 and 2}& cell

3 \\

\hline

\textbf{header 5}& cell 4 & cell 5 & cell 6 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 12 / 23

Page 20: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

Note: \multicolumn{1}{align}{text element} can be used tosimply alter the default column centering for that particular textelement.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 13 / 23

Page 21: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.

By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 22: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).

This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 23: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 24: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 25: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 26: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 27: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 28: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

tabular environmentmulticolumn@-expressions

A Column Separator can be specified using the @-expression.By default, columns are separated with tabs (or vertical lines).However, using an @-expression, columns can be separatedwith decimal points or dashes (or any other character).This can be very useful if you wish to align a list of numbers onthe decimal point:

left-aligned3.1415916.2123.456

centered3.14159

16.2123.456

right-aligned3.14159

16.2123.456

@-aligned3.14159

16.2123.456

\begin{tabular}{r@{.}l}

3 & 14159 \\

16 & 2 \\

123 & 456 \\

\end{tabular}Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 14 / 23

Page 29: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

It is possible to create figures within LATEX (usually within thepicture environment), and there are packages available whichsimplify the creation of certain types of figures (like the tikzpackage for flowcharts, or pstricks which enhances the pictureenvironment). This has a couple of advantages: the documentis self-contained and small, and you have access to the fontsand math notation within LATEX.

- χ

6β = v/c = tanhχ

uRicky Patterson Tables and Figures in LATEX 5 Oct 2016 15 / 23

Page 30: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

���

����H

HHHH�

�����A

B

Ca

bc

F =√

s(s − a)(s − b)(s − c)

s :=a + b + c

2

bej����&%'$&%'$behjm� ����������������������"!# "!# &%'$

r u x z}Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 16 / 23

Page 31: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

However, most complex figures you use will probably beproduced in other programs (it’s just easier), and the resultingPDF or EPS file is imported into the LATEX file. You will need touse the graphicx package in order to import graphics.

Keep in mind: If you are compiling directly with latex command,you can only use EPS files. However, most compilation is nowdone with pdflatex, which can handle additional formats,including JPG (good for photos), PNG (loosless, good fordiagrams and screenshots), PDF (can be used for vectorgraphics), and EPS (but you may have to load the epstopdfpackage).

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 17 / 23

Page 32: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

However, most complex figures you use will probably beproduced in other programs (it’s just easier), and the resultingPDF or EPS file is imported into the LATEX file. You will need touse the graphicx package in order to import graphics.

Keep in mind: If you are compiling directly with latex command,you can only use EPS files. However, most compilation is nowdone with pdflatex, which can handle additional formats,including JPG (good for photos), PNG (loosless, good fordiagrams and screenshots), PDF (can be used for vectorgraphics), and EPS (but you may have to load the epstopdfpackage).

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 17 / 23

Page 33: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

Using the graphicx environment, you will use theincludegraphics command to import the figure, while scaling,rotating and offsetting it to place it exactly where you want it.

\includegraphics[attr1=val1, ... attrn=valn]{image}

Possible attributes include: width, height, scale, angle,resolution, and keepaspectratio, as well as trim, clip, and page.

Let’s try importing a figure.

\includegraphics{1.eps}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 18 / 23

Page 34: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 19 / 23

Page 35: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

Set the scale to 40%, so it fits better on the page:

\includegraphics[scale=0.4]{14.eps}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 20 / 23

Page 36: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

Now let’s rotate it, just for fun:

\includegraphics[scale=0.4, angle=20]{14.eps}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 21 / 23

Page 37: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

picture environmentImporting Graphics

And trim it a bit (note that trim is performed prior to rotation inthis case):

\includegraphics[trim= 3mm 60mm 1mm 10cm, scale=0.4, angle=20]{14.eps}

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 22 / 23

Page 38: Creating Tables and Figures with LaTeX...Introduction Tables Figures References Creating Tables and Figures with LATEX Ricky Patterson bit.ly/LaTeXTables 5 Oct 2016 Ricky Patterson

IntroductionTables

FiguresReferences

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 LATEX WikiBook https://en.wikibooks.org/wiki/LaTeX/I This presentation (code and PDF): http://bit.ly/LaTeXTablesI Materials from previous LATEX workshops:

http://data.library.virginia.edu/statlab/past-workshops/I Overleaf.com Templates and Intro Guides.

Ricky Patterson Tables and Figures in LATEX 5 Oct 2016 23 / 23