von Winfried45 » Do 5. Mär 2015, 21:37
Hallo zusammen,
ich bin ziemlich neu beim Umgang mit TikZ und habe mir folgendes
zusammengebastelt. Der Nein-Zweig unten rechts ist nicht richtig
ausgerichtet. Man kann das zwar durch ausprobieren des xshift-Wertes
hinbiegen, aber wenn man den Font wechselt, ist es wieder falsch.
Kann mir jemand sagen, wie man das richtig macht?
\documentclass[ngerman,fontsize=12pt]{scrartcl}
\usepackage[
rm=txfonts:new,
sf=txfonts:new:scale:lowercase,
tt=txfonts:new:scale:lowercase,
math=txfonts:new:libertine,
sym=amssymb]{typeface}
\usepackage{babel,microtype,tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=yellow!10, text width=7.5em,
text badly centered, inner sep=0pt, aspect=1.5]
\tikzstyle{block} = [rectangle, draw, fill=yellow!20, text width=15em,
text centered, rounded corners, minimum height=3em]
\tikzstyle{cloud} = [draw, ellipse,fill=yellow!20, minimum height=2em]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[auto,line width=1pt,scale=0.8,
every node/.style={transform shape}]
% Place nodes
\node [cloud] (start) {Messwert $i$ in mA};
\node [decision, below of=start,node distance=3cm] (dec1)
{\small $\mathrm{MPX_3} > \mathrm{MPX_2}$};
\node [decision, right of=dec1, node distance=4.5cm] (dec2)
{\small $i \ge \mathrm{MPX_3}$};
\node [block, right of=dec2, node distance=6.5cm] (expr3)
{\small $\mathrm{Wert} = 10^{\left(i\cdot \mathrm{MPA_3}+\mathrm{MPB_3}\right)} +
\mathrm{MPC_3}$};
\node [decision, below of=dec1, node distance=4.5cm] (dec3)
{\small $\mathrm{MPX_2} > \mathrm{MPX_1}$};
\node [decision, right of=dec3, node distance=4.5cm] (dec4)
{\small $i \ge \mathrm{MPX_2}$};
\node [block, right of=dec4, node distance=6.5cm] (expr2)
{\small $\mathrm{Wert} = 10^{\left(i\cdot \mathrm{MPA_2}+\mathrm{MPB_2}\right)} +
\mathrm{MPC_2}$};
\node [block, below of=expr2, node distance=3.0cm] (expr1)
{\small $\mathrm{Wert} = 10^{\left(i\cdot \mathrm{MPA_1}+\mathrm{MPB_1}\right)} +
\mathrm{MPC_1}$};
% Draw edges
\path [line] (start) -- (dec1);
\path [line] (dec1) -- node[near start] {Ja} (dec2);
\path [line] (dec2) -- node[near start] {Ja} (expr3);
\path [line] (dec1) -- node[near start] {Nein} (dec3);
\path [line] (dec2) |- node[near start] {Nein} ([yshift=10mm]dec3.north);
\path [line] (dec3) -- node[near start] {Ja} (dec4);
\path [line] (dec4) -- node[near start] {Ja} (expr2);
\path [line] (dec3) |- node[near start] {Nein} (expr1);
\path [line] (dec4.south) -- node[near start] {Nein} ([xshift=-30.5mm]expr1.west);
\end{tikzpicture}
\end{document}
Hallo zusammen,
ich bin ziemlich neu beim Umgang mit TikZ und habe mir folgendes
zusammengebastelt. Der Nein-Zweig unten rechts ist nicht richtig
ausgerichtet. Man kann das zwar durch ausprobieren des xshift-Wertes
hinbiegen, aber wenn man den Font wechselt, ist es wieder falsch.
Kann mir jemand sagen, wie man das richtig macht?
[code]\documentclass[ngerman,fontsize=12pt]{scrartcl}
\usepackage[
rm=txfonts:new,
sf=txfonts:new:scale:lowercase,
tt=txfonts:new:scale:lowercase,
math=txfonts:new:libertine,
sym=amssymb]{typeface}
\usepackage{babel,microtype,tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=yellow!10, text width=7.5em,
text badly centered, inner sep=0pt, aspect=1.5]
\tikzstyle{block} = [rectangle, draw, fill=yellow!20, text width=15em,
text centered, rounded corners, minimum height=3em]
\tikzstyle{cloud} = [draw, ellipse,fill=yellow!20, minimum height=2em]
\tikzstyle{line} = [draw, -latex']
\begin{tikzpicture}[auto,line width=1pt,scale=0.8,
every node/.style={transform shape}]
% Place nodes
\node [cloud] (start) {Messwert $i$ in mA};
\node [decision, below of=start,node distance=3cm] (dec1)
{\small $\mathrm{MPX_3} > \mathrm{MPX_2}$};
\node [decision, right of=dec1, node distance=4.5cm] (dec2)
{\small $i \ge \mathrm{MPX_3}$};
\node [block, right of=dec2, node distance=6.5cm] (expr3)
{\small $\mathrm{Wert} = 10^{\left(i\cdot \mathrm{MPA_3}+\mathrm{MPB_3}\right)} +
\mathrm{MPC_3}$};
\node [decision, below of=dec1, node distance=4.5cm] (dec3)
{\small $\mathrm{MPX_2} > \mathrm{MPX_1}$};
\node [decision, right of=dec3, node distance=4.5cm] (dec4)
{\small $i \ge \mathrm{MPX_2}$};
\node [block, right of=dec4, node distance=6.5cm] (expr2)
{\small $\mathrm{Wert} = 10^{\left(i\cdot \mathrm{MPA_2}+\mathrm{MPB_2}\right)} +
\mathrm{MPC_2}$};
\node [block, below of=expr2, node distance=3.0cm] (expr1)
{\small $\mathrm{Wert} = 10^{\left(i\cdot \mathrm{MPA_1}+\mathrm{MPB_1}\right)} +
\mathrm{MPC_1}$};
% Draw edges
\path [line] (start) -- (dec1);
\path [line] (dec1) -- node[near start] {Ja} (dec2);
\path [line] (dec2) -- node[near start] {Ja} (expr3);
\path [line] (dec1) -- node[near start] {Nein} (dec3);
\path [line] (dec2) |- node[near start] {Nein} ([yshift=10mm]dec3.north);
\path [line] (dec3) -- node[near start] {Ja} (dec4);
\path [line] (dec4) -- node[near start] {Ja} (expr2);
\path [line] (dec3) |- node[near start] {Nein} (expr1);
\path [line] (dec4.south) -- node[near start] {Nein} ([xshift=-30.5mm]expr1.west);
\end{tikzpicture}
\end{document}
[/code]