III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... ·...

35
III. Presentations and Graphics LaTeX for Economists Niclas Frederic Poitiers February 5, 2018 [email protected]

Transcript of III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... ·...

Page 1: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

III. Presentations and Graphics

LaTeX for Economists Niclas Frederic PoitiersFebruary 5, 2018 [email protected]

Page 2: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Course Objective

In this course we want to learn• How to create a presentation using LaTeX Beamer.• How to add overlays to a presentation.• How to structure a presentation.• How to change the layout of the presentation.• What TikZ is.• How the basics of TikZ work.• How to create simple graphs using TikZ.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 2/35

Page 3: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Outline

1. Introduction to Beamer

2. Customising a Presentation

3. Introduction to TikZ

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 3/35

Page 4: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Outline

1. Introduction to Beamer

2. Customising a Presentation

3. Introduction to TikZ

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 4/35

Page 5: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

LaTeX Beamer

Beamer is a LaTeX document type that lets you createpresentations. The main advantage of Beamer over competitorslike power point is its cross-platform compatibility (it creates PDFsthat look the same on every operating system), and that you candirectly put your formulas and tables from your paper into thepresentation.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 5/35

Page 6: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Create a Beamer Document

You can create a beamer presentation by creating a .texdocument with \documentclass{beamer} . The structure of thebeamer document is the same as of every other LaTeX document:it begins with the preamble, and the content is in the documentenvironment.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 6/35

Page 7: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Frames

You create slides by using the frame environment

\begin{frame}[...]{<title>}{<subtitle>}...

\end{frame}

The subtitles are optional. When you want a slide without headeror footer, you can add the option plain . For some content (likeTikZ graphics) you need to add the option fragile .

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 7/35

Page 8: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Structuring the Slides

You can now use itemize and enumerate to structure theslide. If you want to have multiple columnes, the environmentcolumns provides an option for that:

\begin{columns}[<vertical alignment>]\begin{column}{<width>}

...\end{column}\begin{column}{<width>}

...\end{column}

\end{columns}

The usage of minipages in beamer is advised against.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 8/35

Page 9: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Structuring the Presentation

Similarly to the structure of an article, you can structure apresentation using section and subsection . You can create atitle page with title, author and date using

\begin{frame}[plain]\titlepage

\end{frame}

You can display a table of contents using \tableofcontents .

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 9/35

Page 10: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Blocks

Beamer provides you with a distinct set of environments tostructure your slides:

• block• theorem• lemma• proof

• corollary

• definition

The are used as follows:

\begin{block}{<blocktitle>}...

\end{block}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 10/35

Page 11: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Overlays

With overlays you can uncover parts of a slide one by one. You canjust uncover parts of the slide using the \pause command.\onslide can “end ” the effect of \pause

\begin{frame}{Frame with Overlays}Is always showed.\\\pauseIs just showed on a ‘‘second’’ slide.

\end{frame}

You can also specify on which slide something should appear using\uncover<..>{...} , and if it should only appear on one slideusing \only<..>{...} . In both cases you specify the slide onwhich it does appear in <> brackets.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 11/35

Page 12: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Overlays and Highlighs

When using only , the text will not occupy any space if it is notdisplayed, which might cause the other text to wobble, you canchange this behaviour by specifying the option t to the frame:

\begin{frame}[t]{<title>}...

\end{frame}

With \alert<...>{...} you can highlight text in a specifiedslide. You can also add overlay specifications to a variety of othertext formats and environment by just adding the slide specification<...> .

\textit<2->{this is italic from slide 2 onwards}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 12/35

Page 13: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Overlays of Lists

For lists, you can specify the order in which the parts are displayedafter \item in the following way

\begin{itemize}\item<1-> displayed from slide one onwards.\item<5-> displayed from slide five onwards.\item<-3> displayed until slide three.\item<1-3, 5-> displayed from slide one tothree and from slide 5 onwards.

\end{itemize}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 13/35

Page 14: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Links between Slides

You can generate a link to another slide using \label and

\hyperlink{<target>}{<text of the link>}

You can also jump to a specific overlay slide by adding the overlayspecification to the <target> . You can put

\beamergotobutton{<text>}

into the hyperlink in order to get a bottom. LaTeX Beamer alsoknows the bottoms \beamerskipbutton and\beamerreturnbutton .

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 14/35

Page 15: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Handout and Repetition

You can create a handout version of the slides without overlaysusing the option handout in documentclass . Alternatively, youcan create an article-style handout using the document classarticle and the package beamerarticle .

You can label frames using \label{...} and include the sameframe at a later point of your presentation using\againframe{...} .

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 15/35

Page 16: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Outline

1. Introduction to Beamer

2. Customising a Presentation

3. Introduction to TikZ

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 16/35

Page 17: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Presentation Layout

There are a number of different layouts option, and a number ofcolour schemes to choose from. You can load a layout by using\usetheme{...} and you can change the colour scheme using\usecolortheme{...} . A list of combinations can be foundhere:http://www.deic.uab.es/~iblanes/beamer_gallery/

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 17/35

Page 18: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Inner Themes

With inner themes, you can change the way “inner” designelements (e. g. bullet points) are displayed. You have the followingoptions:

• default• circles• rectangless

• rounded• inmargin

You can use the using \useinnertheme{} in the preamble.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 18/35

Page 19: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Outer Themes

With outer themes, you can change the way “outer” designelements (e. g. header and footer) are displayed. You have thefollowing option:

• default• infolines• miniframes• sidebar• split

• shadow• tree• smoothtree

You can use the using \useoutertheme{} in the preamble.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 19/35

Page 20: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Font Themes

With font themes, you can change the usage of fonts on yourslides. You have the following option:

• default• professionalfont

• serif• structurebold• structureitalicserif• structuresmallcapsserif

You can use the using \usefonttheme{} in the preamble.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 20/35

Page 21: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Personalised Colour Schemes

The package xcolor defines some basic colours, but also allowsyou to define your own colours using\definecolor{<colorname>}{RGB}{<R>,<G>,<B>} .

You can than use your own colours in order to change the coloursof your presentation. Beamer design elements always have abackground colour bg and a foreground colour fg . To changecolours, use\setbeamercolor{<itemname>}{fg=<colour>, bg=<colour>} .For example to change the colour of your title to red on green, use

\setbeamercolor{title}{fg=red, bg=green}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 21/35

Page 22: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Background Picture for the Title Page

In order to add a background picture for your title page, use thefollowing code:

{\usebackgroundtemplate{\includegraphics[...]{...}}\begin{frame}[plain]

\titlepage\end{frame}

}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 22/35

Page 23: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Including a Logo

Beamer allows you to add a logo to your slides using the command

\logo{\includegraphics[...]{...}}

However, this is not supported by all themes. In order to placeyour logo in the upper right corner use the following TikZ code:

\addtobeamertemplate{frametitle}{}{%\begin{tikzpicture}[remember picture,overlay]

\node[anchor=north east,yshift=...,xshift=...]at (current page.north east){\includegraphics[...]{...}};

\end{tikzpicture}\vspace{-0.5cm}}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 23/35

Page 24: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Changing Parts of the Layout

You can change parts of the layout of the page using the followingin the preamble

\setbeamertemplate{<item>}{...

}

If you, for example, want to get rid of the navigation symbols, youcan do so by using

\setbeamertemplate{navigation symbols}{}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 24/35

Page 25: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Showing Outlines

If you want to show the table of contents at the beginning of eachsection use the following code in the preamble:

AtBeginSection[]{\begin{frame}<beamer>

\frametitle{Outline}\tableofcontents[currentsection]

\end{frame}}

If you want to have numbers in your table of contents use

\setbeamertemplate{section in toc}{\inserttocsectionnumber.~\inserttocsection}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 25/35

Page 26: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Outline

1. Introduction to Beamer

2. Customising a Presentation

3. Introduction to TikZ

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 26/35

Page 27: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

TikZ ist kein Zeichenprogramm

TikZ is a LaTeX packages that allows to create costume vectorgraphics within the LaTeX environment. In order to use TikZ, youneed the tikz package. This allows you to create atikzpicture environment in which you can write TikZ code.

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 27/35

Page 28: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Drawing

You can draw in TikZ using the command \draw , by specifyingnodes using brackets, and by specifying the linkage between themusing to . The end of the line is signified using ;

\begin{tikzpicture}\draw (1,0) to (0,0) to (0,1);

\end{tikzpicture}

You can specify in the appearance of the line using the options of\draw :

\begin{tikzpicture}\draw[red, dashed, very thick,

rotate=30](1,0) to (0,0) to (0,1);

\end{tikzpicture}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 28/35

Page 29: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Shapes

The \draw command also allows you to draw shapes

\begin{tikzpicture}\draw[red, very thick](1,0) circle [radius=1.5];

\end{tikzpicture}

You can also specify the shape of the lines between nodes:

\begin{tikzpicture}\draw[->](0,0) to[bend right] (0,1);

\end{tikzpicture}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 29/35

Page 30: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Nodes

node allows you to specify the appearance of the nodes you aredrawing, adding text or shapes:

\begin{tikzpicture}\draw[thick](1,1) node[above] {1st node} --(0,0) node[circle,draw, below]{2nd node};

\end{tikzpicture}

1st node

2nd node

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 30/35

Page 31: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Filldraw

\fill and \filldraw let you create filled shapes and fillednodes respectively

\begin{tikzpicture}\filldraw[thick](1,0) -- (0,0) circle (2pt);

\end{tikzpicture}

\begin{tikzpicture}\fill(1,0) -- (0,0) -- (1,1);

\end{tikzpicture}

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 31/35

Page 32: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Graphs

You can use TikZ for a wide variety of graphs, from timelines andgame trees to data plots. You can find many examples of how touse TikZ here: http://www.texample.net/tikz/examples/ .You can find the documentation of TiKz here:https://ctan.org/pkg/pgf .

One of the main advantages of TikZ is that it allows you to createeasily graphs using multiple inputs that are dynamically adjusted tocolours, font etc. In order to do so you can use the packagepgfplots . You can find the documentation to pgfplots here:http://pgfplots.sourceforge.net/pgfplots.pdf .

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 32/35

Page 33: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

PGF Plots

A plot made with pgfplots starts with defining the axis and theplot properties:

\begin{tikzpicture}[scale=0.5]\begin{axis}[

title=My First Graph,xlabel={$x$},ylabel={$y$},

]\end{axis}\end{tikzpicture} 0 0.2 0.4 0.6 0.8 1

0

0.2

0.4

0.6

0.8

1

x

y

My First Graph

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 33/35

Page 34: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Adding Data

You can now simply add data to this plot by using \addplot .You can import data from a .csv file using

\begin{tikzpicture}[scale=0.5]\begin{axis}[

title=My Second Graph,xlabel={$x$},ylabel={$y$},]

\addplot[blue,]table [col sep=comma]{course/csvsample.csv};

\end{axis}\end{tikzpicture}

1 2 3 4 5 6

100

120

140

160

180

200

x

y

My Second Graph

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 34/35

Page 35: III. Presentations and Graphicsnfpoitiers.eu/wp-content/uploads/2018/08/3-presentations... · 2018-08-14 · Outline 1.IntroductiontoBeamer 2.CustomisingaPresentation 3.IntroductiontoTikZ

Plotting Function

You can also plot a function using \addplot . For doing so, youneed to specify the domain of the funciton

\begin{tikzpicture}[scale=0.5]\begin{axis}[

title=My Third Graph,xlabel={$x$},ylabel={$y$},]

\addplot[ red,domain=-50:50]{x^2};

\end{axis}\end{tikzpicture}

−60 −40 −20 0 20 40 60

0

1,000

2,000

x

y

My Third Graph

LaTeX for EconomistsFebruary 5, 2018

III. Presentations and GraphicsN. F. Poitiers 35/35