我是 TkiZ 的新手。我正在尝试在本地减小节点的字体大小。
尝试阅读以下内容(第 224 页):
http://mirror.utexas.edu/ctan/graphics/pgf/base/doc/pgfmanual.pdf
更改未生效。希望您能指导我哪里做错了。
梅威瑟:
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.multipart, shapes.geometric, arrows}
\begin{document}
\tikzstyle{rec} = [rectangle split, rectangle split horizontal, rectangle split parts=3, minimum height=1cm, minimum width=3cm, align=left, draw=black, fill=blue!30]
\begin{tikzpicture} [node distance=1.5cm]
\node (rec1) [rec] {\nodepart{two}
\textbf{Node: Normal Size Text}
\\\# Text 1
\\\# Text 2
\\\# Text 3
};
\node (rec2) [rec, below of=rec1, yshift=-1cm, font=\small] {\nodepart{two} %Attempt 1: not working
%\node (rec2) [rec, below of=rec1, yshift=-1cm, style={font=\small}] {\nodepart{two} %Attempt 2: not working
%\node (rec2) [rec, below of=rec1, yshift=-1cm] {\nodepart{two} \small %Attempt 3: not working
\textbf{Node: Small Size Text}
\\\# Text 1
\\\# Text 2
\\\# Text 3
};
\end{tikzpicture}
\end{document}
答案1
这是因为您使用的minimal
文档类不提供字体大小命令,例如\small
。请改用standalone
或article
或book
....
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes,shapes.multipart, shapes.geometric, arrows}
\begin{document}
\tikzset{rec/.style = {rectangle split, rectangle split horizontal, rectangle split parts=3,
minimum height=1cm, minimum width=3cm, align=left, draw=black, fill=blue!30}
}
\begin{tikzpicture} [node distance=1.5cm]
\node (rec1) [rec] {\nodepart{two}
\textbf{Node: Normal Size Text}
\\\# Text 1
\\\# Text 2
\\\# Text 3
};
\node (rec2) [rec, below of=rec1, yshift=-1cm, font=\small] {\nodepart{two} %Attempt 1: not working
%\node (rec2) [rec, below of=rec1, yshift=-1cm, style={font=\small}] {\nodepart{two} %Attempt 2: not working
%\node (rec2) [rec, below of=rec1, yshift=-1cm] {\nodepart{two} \small %Attempt 3: not working
\textbf{Node: Small Size Text}
\\\# Text 1
\\\# Text 2
\\\# Text 3
};
\end{tikzpicture}
\end{document}
结论
切勿使用 minimal
除非你知道自己在做什么。如需更多详细信息,请访问并阅读: