PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : pgf/tikz code in article (problemlos) und in beamer (fehlerhaft)



pyrolysis
28-06-2009, 18:00
Hi hab hier en Code pgf/tikz das in einem article problemlos läuft:


\documentclass[a4paper,10pt]{article}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows}

\begin{document}

\section{PGF TEST}

\begin{figure}[htbp]
\begin{center}
\begin{tikzpicture}[point/.style={coordinate},
sty/.style={rectangle,draw=black!50,thick,inner sep=0pt,minimum size=10mm},
skip loop/.style={to path={-- ++(0,#1) -| node[below,swap] {$S=0$} (\tikztotarget)}},>=stealth',tip/.style={<-,rounded corners}]
\matrix[row sep=1mm,column sep=15mm,ampersand replacement=\&] {
% Symbolreihe
\node[sty] (lin) [label=above:{$(C A B)$}] {0 0 0}; \& \node[point] (p1) {.}; \&
\node[sty] (mit) {0 1 0}; \& \node[point] (p2) {.}; \&
\node[sty] (rec) {1 1 0}; \& \node[point] (p3) {.}; \&
\node[sty] (attrak) {1 1 1}; \\
};
\draw (mit) edge [tip] node[auto,swap] {$t=\tau_a$} (lin);
\draw (rec) edge [tip] node[auto,swap] {$t=\tau_a+\tau_c$} (mit);
\draw (attrak) edge [tip] node[auto,swap] {$t=\tau_b$} (rec);
\draw (rec) edge [-] node[auto,swap] {$t=\tau_a+\tau_c+\tau_b$} (attrak);
\draw (p1) edge [->,rounded corners,skip loop=-10mm] (lin);
\draw [->,rounded corners] (attrak.east) .. controls +(right:10mm) and +(up:10mm).. (attrak.north);
\end{tikzpicture}
\caption{So schauts aus.}
\label{fig:boolflow}
\end{center}
\end{figure}

\end{document}

Wollte das nun direkt in meine Beamer Präsi übernehmen dabei kommt es aber leider zu einer Reihe von Fehlermeldungen.


\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{shapes,arrows,shadows}

\usepackage{default}

\begin{document}

\begin{frame}

\begin{figure}[htbp]
\begin{center}
\begin{tikzpicture}[point/.style={coordinate},
sty/.style={rectangle,draw=black!50,thick,inner sep=0pt,minimum size=10mm},
skip loop/.style={to path={-- ++(0,#1) -| node[below,swap] {$S=0$} (\tikztotarget)}},>=stealth',tip/.style={<-,rounded corners}]
\matrix[row sep=1mm,column sep=15mm,ampersand replacement=\&] {
% Symbolreihe
\node[sty] (lin) [label=above:{$(C A B)$}] {0 0 0}; \& \node[point] (p1) {.}; \&
\node[sty] (mit) {0 1 0}; \& \node[point] (p2) {.}; \&
\node[sty] (rec) {1 1 0}; \& \node[point] (p3) {.}; \&
\node[sty] (attrak) {1 1 1}; \\
};
\draw (mit) edge [tip] node[auto,swap] {$t=\tau_a$} (lin);
\draw (rec) edge [tip] node[auto,swap] {$t=\tau_a+\tau_c$} (mit);
\draw (attrak) edge [tip] node[auto,swap] {$t=\tau_b$} (rec);
\draw (rec) edge [-] node[auto,swap] {$t=\tau_a+\tau_c+\tau_b$} (attrak);
\draw (p1) edge [->,rounded corners,skip loop=-10mm] (lin);
\draw [->,rounded corners] (attrak.east) .. controls +(right:10mm) and +(up:10mm).. (attrak.north);
\end{tikzpicture}
\caption{So schauts aus.}
\label{fig:boolflow}
\end{center}
\end{figure}

\end{frame}

Weiss jmd zufällig woran das liegen könnte? Da ich das jetzt nicht Stück für Stück in der Beamer Klasse erstellt habe bin ich vollkommen ratlos.

Stefan_K
28-06-2009, 19:07
Hallo,

evtl. prüfe einmal diese Zeile:

skip loop/.style={to path={-- ++(0,#1) ...
Sobald man # quotet, also ++(0,\#1) schreibt, verschwindet der Fehler und der Code ist zumindest compilierbar. Vielleicht kriegst Du den tikz-code anders hin.

Viele Grüße,

Stefan


--
TeXblog.net (http://texblog.net)

u_fischer
29-06-2009, 08:45
\begin{frame}[fragile]

Ulrike Fischer

pyrolysis
29-06-2009, 08:50
Dank dir.
Ich habe die Übergabe eines Parameters einfach mal weggelassen. Also den style fix definiert. Dadurch entfällt das "#1" und alles läuft wie erwünscht.

Edit: Ui die Option kannte ich noch gar nicht @u_fischer. Danke für den Hinweis. Damit läufts durch ohne jegliche Änderungen.