节点标签换行

节点标签换行
\documentclass[
pdftex,
12pt,
a4paper,
chapterprefix,
headinclude,
headsepline,
footsepline,
colordvi,
twoside,
halfparskip,
final,
appendixprefix,
pointlessnumbers,
tablecaptionabove,
BCOR=12mm,
DIV=16, 
bibliography=totoc]{scrbook}

\usepackage{tikz}
\usepackage{enumitem}
\usetikzlibrary{shapes.geometric, arrows, calc, fit, positioning, chains, arrows.meta}

%%% styles for Figure: Structure of the paper %%%

\begin{document}
\tikzset{arrow/.style = {thick,->,>=stealth,}}
\tikzset{arrow2/.style = {thick,dotted,->,>=stealth,}}
\begin{figure}
\centering
\begin{tikzpicture}
\node[regular polygon, regular polygon sides=8, minimum width=3cm,draw,label=center:Input Scripts] (reg1) at (0,0){};

\node[circle,minimum size=3cm, draw, label=center:Export Files] (c1) at (6,0){};

\node[regular polygon, regular polygon sides=8, minimum width=3cm,draw,label=center:Input Files] (reg2) at (12,0){};

\node[regular polygon, regular polygon sides=4, minimum width=3cm,draw,label=center:Execute] (s1) at (6,-6){};


\draw[arrow] (reg1.east) -- (c1.west);
\draw[arrow] (c1.east) -- (reg2.west);
\draw[arrow] (reg1.east) -- (s1.north);
\draw[arrow] (reg2.west) -- (s1.north);
\end{tikzpicture}
\caption[work-flow prepossess-0]{Prepossessing part-0} \label{fig:pre2inout}
\end{figure}
\end{document}

我需要包装节点的标签。Input \\ scripts但它不起作用。

\node[regular polygon, regular polygon sides=8, minimum width=3cm,draw,label=center:Input \\ Files] (reg2) at (12,0){};

答案1

考虑以下 MWE:

\documentclass{report}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\tikzset{arrow/.style = {thick,->,>=stealth,}}
\tikzset{arrow2/.style = {thick,dotted,->,>=stealth,}}
\begin{tikzpicture}
\node[regular polygon, regular polygon sides=8, minimum width=3cm,draw, text width=1.2cm,align=center] (reg1) at (0,0){Input Scripts};

\node[circle,minimum size=3cm, draw, label=center:Export Files] (c1) at (6,0){};

\node[regular polygon, regular polygon sides=8, minimum width=3cm,draw,label=center:Input Files] (reg2) at (12,0){};

\node[regular polygon, regular polygon sides=4, minimum width=3cm,draw,label=center:Execute] (s1) at (6,-6){};

\draw[arrow] (reg1.east) -- (c1.west);
\draw[arrow] (c1.east) -- (reg2.west);
\draw[arrow] (reg1.east) -- (s1.north);
\draw[arrow] (reg2.west) -- (s1.north);
\end{tikzpicture}
\end{document}

结果如下:

在此处输入图片描述

相关内容