我使用 tikz 制作了一些图表和括号。现在我必须镜像一个括号,但括号的描述现在位于括号上方 - 不再位于下方。我尝试为该文本创建一个单独的节点,但失败了。
这是我的乳胶代码:
\documentclass{standalone}
\usepackage{tikz}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{float}
\usetikzlibrary{decorations.pathreplacing, positioning, calc}
\begin{document}
\begin{tikzpicture}
[mynode/.style={font=\footnotesize, align=center, minimum height=1.1cm}]
\node[mynode, draw] (text1) {text};
\node[mynode, draw, right=-\pgflinewidth of text1] (text2) {Even more test};
\node[mynode, draw, right=-\pgflinewidth of text2] (text3) {\hphantom{xxxxxxxxxx}Teeeeeext \hphantom{xxxxxxxxxx}};
\node[mynode, below left=-0.3cm and -0.5cm of text1] (dummy_links) {};
\node[mynode, below right=-0.3cm and -0.4cm of text3] (dummy_rechts) {};
\draw [decorate,decoration={brace,mirror,amplitude=10pt},xshift=-4pt,yshift=0pt]
(dummy_links.south west) -- (dummy_rechts.south east) node [black,midway,xshift=-0.6cm]
{\footnotesize $P_1$};
\end{tikzpicture}
\end{document}
(是的,也许令人困惑,但事实就是这样)。
答案1
您需要更改xshift
为yshift
。
\documentclass{standalone}
\usepackage{tikz}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{float}
\usetikzlibrary{decorations.pathreplacing, positioning, calc}
\begin{document}
\begin{tikzpicture}
[mynode/.style={font=\footnotesize, align=center, minimum height=1.1cm}]
\node[mynode, draw] (text1) {text};
\node[mynode, draw, right=-\pgflinewidth of text1] (text2) {Even more test};
\node[mynode, draw, right=-\pgflinewidth of text2] (text3) {\hphantom{xxxxxxxxxx}Teeeeeext \hphantom{xxxxxxxxxx}};
\node[mynode, below left=-0.3cm and -0.5cm of text1] (dummy_links) {};
\node[mynode, below right=-0.3cm and -0.4cm of text3] (dummy_rechts) {};
\draw [decorate,decoration={brace,mirror,amplitude=10pt},xshift=-4pt,yshift=0pt]
(dummy_links.south west) -- (dummy_rechts.south east) node [black,midway,yshift=-0.6cm]
{\footnotesize $P_1$};
\end{tikzpicture}
\end{document}