如何跳过 Tikz 节点内标题的一行

如何跳过 Tikz 节点内标题的一行

我找到了一个概念图的代码示例,我想知道如何跳过一行。例如,

\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}

代码输出

相关内容