
Ich folge der Antwort, die ich bekommen habeHierfür eine vorherige Frage zur Steuerung der Textposition innerhalb eines großen Knotens in tikz
. Ich hätte gerne eine schräge Box, die 4 kleinere Boxen umgibt, und möchte dann automatisch die Beschriftung für die schräge Box oben rechts platzieren. Sie ist nicht weit genug rechts. Ich könnte sie manuell verschieben, aber ich werde dies mehrere Male tun und die schräge Box wird jedes Mal ihre Größe ändern. Es müsste also wiederholt gemacht werden.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,fit,backgrounds}
\tikzset{box/.style={draw, minimum width = 1.cm, minimum height = 1.cm, text width=1cm, text centered},
slantedbox/.style={draw,trapezium,trapezium left angle=70,trapezium right angle=-70, label={[shift={(9ex,-3ex)}]north east:#1}}
}
\begin{document}
\begin{tikzpicture}
\node [box] (phiQQ) at (0,0) {$\phi_{QQ}$};
\node [box] (phiQA) at (3,0) {$\phi_{QA}$};
\node [box] (phiQ*A) at (6,0) {$\phi_{Q^*A}$};
\node [box] (phiAA) at (4.5,-2) {$\phi_{AA}$};
\node [slantedbox = $\xi$, fit = (phiQQ)(phiQA)(phiQ*A)(phiAA), minimum height = 2cm] at (3,-1) (xi) {};
\end{tikzpicture}
\end{document}
Hier ist meine aktuelle Ausgabe:
Ich möchte $\xi$
automatisch weiter rechts.
Antwort1
Verwendung top right corner
in
slantedbox/.style={draw,trapezium,trapezium left angle=70,
trapezium right angle=-70, label={[shift={(0,-3ex)}]top right corner:#1}}
Die möglichen Anker sind (ab pgfmanual
Seite 705)
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,fit,backgrounds}
\tikzset{box/.style={draw, minimum width = 1.cm, minimum height = 1.cm, text width=1cm, text centered},
slantedbox/.style={draw,trapezium,trapezium left angle=70,
trapezium right angle=-70, label={[shift={(0,-3ex)}]top right corner:#1}}
}
\begin{document}
\begin{tikzpicture}
\node [box] (phiQQ) at (0,0) {$\phi_{QQ}$};
\node [box] (phiQA) at (3,0) {$\phi_{QA}$};
\node [box] (phiQ*A) at (6,0) {$\phi_{Q^*A}$};
\node [box] (phiAA) at (4.5,-2) {$\phi_{AA}$};
\node [slantedbox = $\xi$, fit = (phiQQ)(phiQA)(phiQ*A)(phiAA), minimum height = 2cm] at (3,-1) (xi) {};
\end{tikzpicture}
\end{document}