输入任务包平均价格、聚类中心位置,任务包内会员的指标。    这句话太长,想让他分为两行,如下:

               输入任务包平均价格、聚类中心位置,

                任务包内会员的指标。

\documentclass[UTF8,a4paper]{ctexart}

\usepackage{graphicx}

\usepackage{tikz}

\usetikzlibrary{shapes.geometric, arrows}

\begin{document}

\begin{figure}[h]

\centering

\thispagestyle{empty}

% 流程图定义基本形状

\tikzstyle{startstop} = [rectangle, rounded corners, minimum width = 2cm, minimum height=1cm,text centered, draw = black, fill = red!40]

\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill = blue!40]

\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill = yellow!50]

\tikzstyle{decision} = [diamond, aspect = 3, text centered, draw=black, fill = green!30]

\tikzstyle{point}=[coordinate] 

% 箭头形式

\tikzstyle{arrow} = [->,>=stealth]

\begin{tikzpicture}[node distance=1.5cm]

%定义流程图具体形状

\node (start)[startstop]

{开始};

\node (in1) [io, below of = start]

{输入任务包平均价格、聚类中心位置,任务包内会员的指标};

\node (pro1) [process,below of = in1]

{计算任务包的价格、距离、会员能力指标};

\node (pro2) [process, below of = pro1]

{应用多元 logistics 回归分析建立任务包完成度模型};

\node (in2) [io, below of=pro2]

{ 输出每个任务包的完成度   };

\node (stop) [startstop, below of=in2]

{结束};

%连接具体形状

\draw [arrow]   (start)  -- (in1);

\draw [arrow] (in1) -- (pro1);

\draw [arrow] (pro1) -- (pro2);

\draw [arrow] (pro2) -- (in2);

\draw [arrow] (in2) --  (stop) ;

[->,>=stealth]\end{tikzpicture}

\caption{任务包完成度的建立与求解过程}

\end{figure}

\end{{document}}

4 回答4

1
<ol class=" list-paddingleft-2" style="list-style-type: decimal;"><li><p>给的代码自己也没跑过吧?能编译通过么?</p></li><li><p>后面一个空的 [->,>=stealth] 是在干啥?</p></li><li><p>\end{{document}} 是什么操作?</p></li><li><p>结点内容用 \parbox 可以进行换行操作,或者让他自动换行。 </p></li></ol><pre class="brush:plain;toolbar:false">\documentclass[UTF8,a4paper]{ctexart} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{shapes.geometric, arrows} \begin{document} \thispagestyle{empty} \begin{figure}[h]  \centering  % 流程图定义基本形状  \tikzstyle{startstop} = [rectangle, rounded corners, minimum width = 2cm, minimum height=1cm,text centered, draw = black, fill = red!40]  \tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill = blue!40]  \tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill = yellow!50]  \tikzstyle{decision} = [diamond, aspect = 3, text centered, draw=black, fill = green!30]  \tikzstyle{point}=[coordinate]   % 箭头形式  \tikzstyle{arrow} = [->,>=stealth] \begin{tikzpicture}[node distance=1.5cm]  \node (start) [startstop] {开始};  \node (in1) [io, below of = start]  {\parbox{7cm}{\centering 输入任务包平均价格、聚类中心位置,\\ 任务包内会员的指标}};  \node (pro1) [process,below of = in1]  {计算任务包的价格、距离、会员能力指标};  \node (pro2) [process, below of = pro1]  {应用多元 logistics 回归分析建立任务包完成度模型};  \node (in2) [io, below of=pro2]  { 输出每个任务包的完成度   };  \node (stop) [startstop, below of=in2]  {结束}; % % %连接具体形状 %  \draw [arrow]   (start)  -- (in1);  \draw [arrow] (in1) -- (pro1);  \draw [arrow] (pro1) -- (pro2);  \draw [arrow] (pro2) -- (in2);  \draw [arrow] (in2) --  (stop) ; \end{tikzpicture} \caption{任务包完成度的建立与求解过程} \end{figure} \end{document}</pre><p><br></p>
  • 为你的细心和耐心点赞,提问时,一定要自己先跑一下MWE! – registor 2019-09-05 16:20 回复
0
<p style="box-sizing: content-box; margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 30px; color: rgb(47, 47, 47); font-family: ">\node (in1) [io, below of = start]</p><p style="box-sizing: content-box; margin-top: 0px; margin-bottom: 0px; padding: 0px; line-height: 30px; color: rgb(47, 47, 47); font-family: "><span style="box-sizing: content-box; margin: 0px; padding: 0px; white-space: pre;"> </span>{输入任务包平均价格、聚类中心位置,任务包内会员的指标};</p><p>这句话改为</p><p style="margin-top: 0px; margin-bottom: 0px; white-space: normal; box-sizing: content-box; padding: 0px; line-height: 30px; color: rgb(47, 47, 47); font-family: ">\node (in1) [io, below of = start,align=left]%%或者align=center/right,自己选择对齐方式</p><p style="margin-top: 0px; margin-bottom: 0px; white-space: normal; box-sizing: content-box; padding: 0px; line-height: 30px; color: rgb(47, 47, 47); font-family: "><span style="box-sizing: content-box; margin: 0px; padding: 0px; white-space: pre;"> </span>{输入任务包平均价格、聚类中心位置,\\任务包内会员的指标};</p><p><br></p>
0
<pre class="brush:plain;toolbar:false">\documentclass[UTF8,a4paper]{ctexart} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{shapes.geometric,arrows} \begin{document} \thispagestyle{empty} \begin{figure}[h]   \centering   % 流程图定义基本形状   \tikzstyle{startstop}=[%     rectangle,     rounded corners,     minimum width=2cm,     minimum height=1cm,     text centered,     draw=black,     fill = red!40   ]   \tikzstyle{io}=[%     trapezium,     trapezium left angle=70,     trapezium right angle=110,     minimum width=2cm,     minimum height=1cm,     text centered,     draw=black,     fill=blue!40   ]   \tikzstyle{process}=[%     rectangle,     minimum width=3cm,     minimum height=1cm,     text centered,     draw=black,     fill=yellow!50   ]   \tikzstyle{decision}=[%     diamond,     aspect=3,     text centered,     draw=black,     fill=green!30   ]   \tikzstyle{point}=[coordinate]   % 箭头形式   \tikzstyle{arrow}=[->,>=stealth]      \begin{tikzpicture}[node distance=1.5cm]     %定义流程图具体形状     \node (start) [startstop] {开始};     \node (in1) [io,below of=start,align=left] {输入任务包平均价格、聚类中心位置,\\任务包内会员的指标};     \node (pro1) [process,below of=in1] {计算任务包的价格、距离、会员能力指标};     \node (pro2) [process,below of=pro1] {应用多元 logistics 回归分析建立任务包完成度模型};     \node (in2) [io,below of=pro2] {输出每个任务包的完成度};     \node (stop) [startstop,below of=in2] {结束};     %连接具体形状     \draw [arrow] (start) -- (in1);     \draw [arrow] (in1) -- (pro1);     \draw [arrow] (pro1) -- (pro2);     \draw [arrow] (pro2) -- (in2);     \draw [arrow] (in2) -- (stop);   \end{tikzpicture}   \caption{任务包完成度的建立与求解过程} \end{figure} \end{document}</pre><p><img src="/data/ueditor/php/upload/image/20190905/1567680534619370.png" title="1567680534619370.png" alt="image.png"></p>
0
<p>与各们大佬的思路差不多,写过一个宏包,仅供参考:<a href="https://github.com/registor/tikz-flowchart">https://github.com/registor/tikz-flowchart</a></p>

你的回答

请登录后回答

你的回答将会帮助更多人,请务必认真回答问题。