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
I'm trying to place the basic tkz-graph example located at http://altermundus.com/downloads/exampl ... h/gr_3.tex
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?
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?
NEW: TikZ book now 40% off at Amazon.com for a short time.

tkz-graph in a beamer presentation
Hi,
do not load the xcolor package as in the example. Delete the line
and load the xcolor options as class options for beamer:
The following example should work OK (provided, of course, that the tkz-graph packages has been installed):
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 47
- Joined: Wed Nov 11, 2009 9:30 pm
tkz-graph in a beamer presentation
Hi,
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:
! Package xkeyval Error: `l' undefined in families `beamer@col'.
Happens even if columns are on a separate frame.
And finally, is it possible to position the tikzpicture? textblock seems to fail on \draw
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}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
-
- Posts: 47
- Joined: Wed Nov 11, 2009 9:30 pm
Re: tkz-graph in a beamer presentation
Thanks, your quick fix works. The whole thing is a little funky, however. I'm noticing a lot of subtleties that I have to correct for. If I uncover{} a graph, everything on the slide moves, but \only doesn't. If I add nodes to the tikzpicture, their position changes the position of the entire picture. If I have \textcolor{red}{foo} on a slide, then \uncover{} a graph, "foo" changes to orange. Just plain weird behavior.
-
- Posts: 4
- Joined: Tue Feb 09, 2010 9:43 am
Re: tkz-graph in a beamer presentation
Regarding the positioning of the figure and its moving off the frame. I usually fiddle with the scale option passed to tikzfigure thus:
\begin{tikzfigure}[scale=0.8]
Laurie
\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]
[...]
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
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