如何为流程图添加标题?

如何为流程图添加标题?

有没有一种简单的方法可以为流程图添加标题?

\caption{A simple table} 

不起作用 谢谢

答案1

我发现答案是在开始图之后立即写标题行,这是我的工作示例

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\graphicspath{ {Images/} }
\usetikzlibrary{shapes.geometric, arrows}
\usepackage{adjustbox}

\begin{figure}
\caption{An example graph}

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

\tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=2cm, minimum height=1cm, text centered, draw=black, fill=blue!30]
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, draw=black, fill=orange!30]
\tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered, draw=black, fill=green!30]
\tikzstyle{arrow} = [thick,->,>=stealth]

\tikzstyle{mytext} = [text width=0.5cm,color= red,text centered]

%\begin{frame}
\begin{adjustbox}{width=\textwidth,height=15 cm,keepaspectratio}
\begin{tikzpicture}[node distance=2cm]

\node (start) [startstop] {Start};
\node (in1) [io, below of=start] {Enter Command };
\draw [arrow] (start) -- (in1);
\node (send) [process, below of=in1] {send Command};
\draw [arrow] (in1) -- (send);
\node (receive) [process, below of=send] {Receive  Response};
\draw [arrow] (send) -- (receive);
\node (done) [decision, below of=receive, yshift= -1.0cm] {All bytes received ?};
\draw [arrow] (receive) -- (done);
\draw [arrow] (done)-|   ([xshift=1.0cm]  done.east) |-   (receive) ;
\node[mytext, below left of= done,xshift= 3.6cm,yshift= 1.6cm] (doneno) {No}; 
%\node[text, below left of= done,xshift= 1.8cm,yshift= 0.8cm] (doneyes) {yes};
\node (okok) [decision, below of=done, yshift= -2.5cm] {Every thing is O.K.? };
\draw [arrow] (done) -- node[anchor=south,xshift= .3cm, yshift= -.2cm] {\color[rgb]{1,0,0} yes} (okok);
% Connect okok yes to enter command 
%\draw [arrow] (okok)-|   ([xshift=1.5cm]  okok.east) |-   (in1) ;



%print the response okok=yes
\node[mytext, below left of=okok,xshift= 3.6cm,yshift= 1.6cm] (okokyes) {Yes}; 
\node (printokyes) [process, right of=receive,xshift=3cm] {Print the response };
\draw [arrow] (okok)-|   ([xshift=3cm]  okok.east) --   (printokyes) ;
\draw [arrow] (printokyes)|-  (in1);

%print the response okok=no
\node[mytext, below right of=okok,xshift= -3.6cm,yshift= 1.6cm] (okokyes) {No}; 
\node (printokno) [process, left of=receive,xshift=-3cm] {Print "error" + the response(error number) };
\draw [arrow] (okok)-|   (  okok.west) -|   (printokno) ;
\draw [arrow] (printokno)|-  (in1);
%\draw [arrow] (done) -- {yes}(okok);
***% when I was writing caption here it was the error*** 
\end{tikzpicture}
\end{adjustbox}


\end{figure}

输出

答案2

将整个流程图包裹在 \begin{figure} 元素中,并添加 [H] 位置说明符。它看起来像这样:

\begin{figure}[H] ... ... ... \caption{此处为标题} \label{此处为标签} \end{figure}

这里的位置说明符 [H] 代表这里,它覆盖所有内置的定位规则和指南。

它将流程图定位到对应图形的代码在乳胶文件中的任何位置。

相关内容