Graphics, Figures & Tables ⇒ tkz-graph in a beamer presentation
-
- Posts: 47
- Joined: Wed Nov 11, 2009 9:30 pm
tkz-graph in a beamer presentation
in a \documentclass{beamer}
But I keep getting option clashes with xcolor. If I remove xcolor, I get
! Package xkeyval Error: `l' undefined in families `beamer@col'.
Suggestions?
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
tkz-graph in a beamer presentation
do not load the xcolor package as in the example. Delete the line
Code: Select all
\usepackage[usenames,dvipsnames]{xcolor}
Code: Select all
\documentclass[xcolor={usenames,dvipsnames}]{beamer}
Code: Select all
\documentclass[xcolor={usenames,dvipsnames}]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage[upright]{fourier}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\SetVertexNormal[Shape = circle,
FillColor = orange,
LineWidth = 2pt]
\SetUpEdge[lw = 1.5pt,
color = black,
labelcolor = white,
labeltext = red,
labelstyle = {sloped,draw,text=blue}]
\tikzstyle{EdgeStyle}=[bend left]
\Vertex[x=0, y=0]{G}
\Vertex[x=0, y=3]{A}
\Vertex[x=3, y=5]{P}
\Vertex[x=4, y=2]{C}
\Vertex[x=8, y=3]{Q}
\Vertex[x=7, y=0]{E}
\Vertex[x=3, y=-1]{R}
\Edges(G,A,P,Q,E) \Edges(C,A,Q) \Edges(C,R,G) \Edges(P,E,A)
\end{tikzpicture}
\end{document}
-
- Posts: 47
- Joined: Wed Nov 11, 2009 9:30 pm
tkz-graph in a beamer presentation
Thanks - it works!
Could you explain why it was needed in the options and not a usepackage?
Also, is it not possible to use columns with this? This is your example but with columns added:
Code: Select all
\documentclass[xcolor={usenames,dvipsnames}]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage[upright]{fourier}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}
\SetVertexNormal[Shape = circle,
FillColor = orange,
LineWidth = 2pt]
\SetUpEdge[lw = 1.5pt,
color = black,
labelcolor = white,
labeltext = red,
labelstyle = {sloped,draw,text=blue}]
\tikzstyle{EdgeStyle}=[bend left]
\Vertex[x=0, y=0]{G}
\Vertex[x=0, y=3]{A}
\Vertex[x=3, y=5]{P}
\Vertex[x=4, y=2]{C}
\Vertex[x=8, y=3]{Q}
\Vertex[x=7, y=0]{E}
\Vertex[x=3, y=-1]{R}
\Edges(G,A,P,Q,E) \Edges(C,A,Q) \Edges(C,R,G) \Edges(P,E,A)
\end{tikzpicture}
\begin{columns}
\begin{column}[l]{0.5\textwidth}
here's one
\end{column}
\begin{column}[r]{0.5\textwidth}
here's another
\end{column}
\end{columns}
\end{document}
Happens even if columns are on a separate frame.
And finally, is it possible to position the tikzpicture? textblock seems to fail on \draw
tkz-graph in a beamer presentation
That's because the beamer class automatically loads the xcolor package, so you cannot pass options to xcolor in the usual way. See the beamer manual (Section 2.6 Compatibility with other Packages and Classes) for further information (by the way, there's a note there about the fourier package).CoolnessItself wrote: ...Could you explain why it was needed in the options and not a usepackage?..
In fact, now that I review your code, in your example you don't need to pass any options to xcolor; you can simply use
Code: Select all
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage[upright]{fourier}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\SetVertexNormal[Shape = circle,
FillColor = orange,
LineWidth = 2pt]
\SetUpEdge[lw = 1.5pt,
color = black,
labelcolor = white,
labeltext = red,
labelstyle = {sloped,draw,text=blue}]
\tikzstyle{EdgeStyle}=[bend left]
\Vertex[x=0, y=0]{G}
\Vertex[x=0, y=3]{A}
\Vertex[x=3, y=5]{P}
\Vertex[x=4, y=2]{C}
\Vertex[x=8, y=3]{Q}
\Vertex[x=7, y=0]{E}
\Vertex[x=3, y=-1]{R}
\Edges(G,A,P,Q,E) \Edges(C,A,Q) \Edges(C,R,G) \Edges(P,E,A)
\end{tikzpicture}
\end{frame}
\end{document}
Of course it is possible. Simply, don't use the [l] and [r] modifiers (they are not allowed). Refer to section 12.7 Splitting a Frame into Multiple Columns of the beamer manual to see the valid options for the columns environment.CoolnessItself wrote: ...is it not possible to use columns with this? This is your example but with columns added:
Hmmm... I see your point here; using the code that I just provided, the resulting graph falls off the frame and changing the y-coordinates doesn't seem to have any effect. I'll have to think about this a little more.CoolnessItself wrote: ...And finally, is it possible to position the tikzpicture?...
A quick fix to manually move the graph vertically would be to use a \vspace* command before the tikzpicture:
Code: Select all
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{fullpage}
\usepackage[upright]{fourier}
\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\begin{document}
\begin{frame}
\vspace*{-3cm}
\begin{tikzpicture}
\SetVertexNormal[Shape = circle,
FillColor = orange,
LineWidth = 2pt]
\SetUpEdge[lw = 1.5pt,
color = black,
labelcolor = white,
labeltext = red,
labelstyle = {sloped,draw,text=blue}]
\tikzstyle{EdgeStyle}=[bend left]
\Vertex[x=0, y=11]{G}
\Vertex[x=0, y=14]{A}
\Vertex[x=3, y=16]{P}
\Vertex[x=4, y=13]{C}
\Vertex[x=8, y=14]{Q}
\Vertex[x=7, y=11]{E}
\Vertex[x=3, y=10]{R}
\Edges(G,A,P,Q,E) \Edges(C,A,Q) \Edges(C,R,G) \Edges(P,E,A)
\end{tikzpicture}
\end{frame}
\end{document}
-
- Posts: 47
- Joined: Wed Nov 11, 2009 9:30 pm
Re: tkz-graph in a beamer presentation
-
- Posts: 4
- Joined: Tue Feb 09, 2010 9:43 am
Re: tkz-graph in a beamer presentation
\begin{tikzfigure}[scale=0.8]
Laurie
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
tkz-graph in a beamer presentation
Just for the record. The environment is called tikzpicture.retrogrouch wrote:[...] I usually fiddle with the scale option passed to tikzfigure thus:
\begin{tikzfigure}[scale=0.8]
[...]
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 4
- Joined: Tue Feb 09, 2010 9:43 am
tkz-graph in a beamer presentation
Whoops, sorry about that!localghost wrote:Just for the record. The environment is called tikzpicture.retrogrouch wrote:[...] I usually fiddle with the scale option passed to tikzfigure thus:
\begin{tikzfigure}[scale=0.8]
[...]
Laurie