![如何跳过 Tikz 节点内标题的一行](https://linux22.com/image/336904/%E5%A6%82%E4%BD%95%E8%B7%B3%E8%BF%87%20Tikz%20%E8%8A%82%E7%82%B9%E5%86%85%E6%A0%87%E9%A2%98%E7%9A%84%E4%B8%80%E8%A1%8C.png)
我找到了一个概念图的代码示例,我想知道如何跳过一行。例如,
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usetikzlibrary{shapes.misc,shapes.geometric,arrows,positioning}
\begin{document}
\begin{tikzpicture}
[->,
>=stealth',
shorten >=1pt,
auto,
node distance=2cm,
thick,
main node/.style={circle,fill=gray!20,draw,font=\sffamily\Large\bfseries}]
\node[main node, chamfered rectangle] (1) {{\scriptsize {\tiny ODEs}}};
\node[main node] (2) [below of=1] {{\scriptsize {\tiny Euler's Equation}}};
\node[main node] (3) [right of=2] {{\scriptsize {\tiny Contrapositive}}};
\node[main node] (4) [right of=3] {{\scriptsize {\tiny direct proof}}};
\node[main node] (5) [right of=4] {{\scriptsize {\tiny test}}};
\end{tikzpicture}
\end{document}
我该输入什么才能使标题“欧拉方程”在两行之间有双倍行距,因为我不太喜欢节点这么大。
非常感谢您的帮助。
答案1
添加align=center
到节点规范允许您在节点文本中放置换行符。您的节点中还有很多多余的字体大小命令。放入\tiny
节点样式就足够了。
\documentclass[tikz,border=10pt,multi]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}
\usetikzlibrary{shapes.misc,shapes.geometric,arrows,positioning}
\begin{document}
\begin{tikzpicture}
[->,
>=stealth',
shorten >=1pt,
auto,
node distance=2cm,
thick,
main node/.style={circle,fill=gray!20,draw,font=\sffamily\bfseries\tiny,align=center}]
\node[main node, chamfered rectangle] (1) { ODEs};
\node[main node] (2) [below of=1] {Euler’s\\Equation};
\node[main node] (3) [right of=2] {Contrapositive};
\node[main node] (4) [right of=3] {direct proof};
\node[main node] (5) [right of=4] {test};
\end{tikzpicture}
\end{document}