Using Beamer and Tikz: Robb Koether & Brian Lins
Using Beamer and Tikz: Robb Koether & Brian Lins
Hampden-Sydney College
Introduction
TikZ is a package that allows you to draw pictures within the
LATEXenviroment.
Wolff’s Theorem
z0
Title Page Introduction TikZ Examples Tutorial Example Source
Force Diagram
Fν Ff
FG
Title Page Introduction TikZ Examples Tutorial Example Source
P
S
P2
P1 D0
D
Q1 Q2 Q
Title Page Introduction TikZ Examples Tutorial Example Source
You can find many more examples of TikZ at the following website:
http://www.texample.net/tikz/examples/
Title Page Introduction TikZ Examples Tutorial Example Source
TikZ Tutorial
\begin{tikzpicture}
...
...
\end{tikzpicture}
Title Page Introduction TikZ Examples Tutorial Example Source
TikZ Tutorial
\begin{tikzpicture}
\draw[color=blue,fill=red] (0,0) circle (1);
\end{tikzpicture}
TikZ Tutorial
TikZ Tutorial
Any time you enter a coordinate in a TikZ picture, you may add
LATEX text next to that coordinate with the node command.
\begin{tikzpicture}
\draw[semithick, color=blue] (0,0) circle (1);
\draw[semithick, <->](-2,0) -- (2,0) node[below] {$x$};
\draw[semithick, <->](0,-2) -- (0,2) node[left] {$y$};
\draw (1,1) node[above right] {$x^2+y^2= 1$};
\end{tikzpicture}
Copy this TikZ picture into LATEX, then try adding position markers
for x = −1, x = 1, y = −1, and y = 1.
Title Page Introduction TikZ Examples Tutorial Example Source
TikZ Tutorial
You can also write for-loops with TikZ, which can really save time.
For example, try the following command.
\begin{tikzpicture}
\draw[semithick,<->] (-2.5,0) -- (5.5,0);
\foreach \n in {-2,-1,0,1,2,3,4,5}
{
\fill (\n,0) circle (1.6pt) node [below=2pt] {$\n$};
}
\end{tikzpicture}
Title Page Introduction TikZ Examples Tutorial Example Source
On the next three slides you can find the LATEX source code for the
three TikZ examples I showed at the beginning.
Title Page Introduction TikZ Examples Tutorial Example Source
\begin{center}
\begin{tikzpicture}
\filldraw[fill=gray!0!white, draw=black]
(1.5cm,2cm) arc (30:360:2.5cm) arc(0:30:2.5cm);
\filldraw[fill=gray!20!white, draw=black]
(1.5cm,2cm) arc (30:360:1.5cm) arc(0:30:1.5cm);
\filldraw[fill=gray!70!white, draw=black]
(1.5cm,2cm) arc (30:360:1cm) arc(0:30:1cm);
\filldraw (1.5cm, 2cm) circle (0.1cm) node[right] {$z_0$};
\end{tikzpicture}
\end{center}
Title Page Introduction TikZ Examples Tutorial Example Source
\begin{center}
\begin{tikzpicture}
\filldraw[fill=gray!10!white, draw=black]
(0,0) -- (5,0)-- (5,3.75) -- (0,0);
\filldraw[fill=gray!30!white, draw=black]
(2,1.5) -- (4,3) -- (3.25,4) -- (1.25,2.5) -- (2,1.5);
\draw[very thick, color=blue, ->]
(3,2) -- (3,0.8) node[below right] {$F_G$};
\draw[very thick, color=blue, ->]
(3.7,3.6) -- (4.5,4.2) node[above right] {$F_{f}$};
\draw[very thick, color=blue, ->]
(2.2,3.3) -- (1.6,4.1) node[above left] {$F_{\nu}$};
\end{tikzpicture}
\end{center}
Title Page Introduction TikZ Examples Tutorial Example Source
\begin{center}
\begin{tikzpicture}
\draw[very thick, <->] (5,0) node[below] {$Q$}
-| (0,5) node[left] {$P$};
\draw[red, thick] (0.5,0.5) parabola (4.5,4.5)
node[above] {$S$};
\draw[blue, thick] (0.5,4.5) parabola[bend at end]
(4.5,0.5) node[right] {$D$};
\draw[blue, thick] (1.5,4.5) parabola[bend at end]
(4.5,1.5) node[right] {$D’$};
\draw[dashed] (0,1.5) node[left] {$P_1$} --
(2.5,1.5) (2.5,1.5) -- (2.5,0) node[below] {$Q_1$};
\draw[dashed] (0,2.2) node[left] {$P_2$} --
(3.1,2.2) (3.1,2.2) -- (3.1,0) node[below] {$Q_2$};
\end{tikzpicture}
\end{center}