我需要在 TikZ 节点中使用制表环境。当我尝试以下操作时:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[box/.style={rectangle,minimum size=1cm,text width=3cm,
text centered}]
\node[box] (mybox) at (0.0,0.0) {
\begin{tabbing}
abcdef \= abcdef \kill
hello \> there
\end{tabbing}
};
\end{tikzpicture}
\end{document}
结果是在“hello there”之前出现了一个空行:
我怎样才能摆脱空行(除了添加\vspace{-\baselineskip}
?
答案1
tikz
将难以处理的内容放入保存箱中。
\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\newsavebox\hello
\savebox\hello{%
\begin{minipage}{3cm}
\begin{tabbing}
abcdef \= abcdef \kill
hello \> there
\end{tabbing}%
\end{minipage}%
}
\begin{document}
\begin{tikzpicture}
\node[draw]{\usebox\hello};
\end{tikzpicture}
\end{document}