带箭头的方框内的文字

带箭头的方框内的文字

类似问题我如何构建带有框架的页面布局?

我需要构建一个非常简单的流程图,其中有几个垂直和水平对齐的框,它们之间有箭头。

由于我对 LaTeX 辅助不是很有经验,所以我需要一些帮助!

我所追求的是这样的:

      +-----------------------------------------+
      | A few lines of text in a block,         |
      | centered would be nice but not required |
      +-----------------------------------------+
                         |
                         v
           o---------------------------o
           | A double box here perhaps?|
           o---------------------------o
                         |
            +------------+-------------+
            |                          |
            v                          v
   +------------------+   +--------------------------+
   |More words here   |   |     More words here      |
   +------------------+   +--------------------------+

答案1

这是我的第一次尝试,有几个地方需要完善,我会在弄清楚怎么做之后再做:-)

\documentclass{amsart}
\usepackage{tikz}
\usetikzlibrary{arrows, shapes}
\newlength{\mytw}
\settowidth{\mytw}{A few lines of text in a block}
\begin{document}
\begin{center}
\begin{tikzpicture}
[> = latex', auto,
block/.style ={rectangle,draw=black, thick,
align=flush center, rounded corners,
minimum height=4em},
]
\matrix [column sep=5mm,row sep=7mm]
{
% row 1
&
\node [block, text width=\mytw] (firstbox) {A few lines of text in a block, centered would be nice but not required}; &
 \\
% row 2
& \node [block, double, double distance=1pt] (dbox) {A double box here perhaps?!}; & \\
% row 3
 & \node[inner sep = 0pt] (dummy) {}; & \\
%row 4
\node [block] (b1) {More text goes here};&
&\node [block] (b2) {more text goes here};\\
};

 \draw[->] (firstbox) -- (dbox);
 \draw[-] (dbox) -- (dummy); 
 \draw[->]    (dummy) -| (b1); 
 \draw[->]    (dummy) -| (b2);

\end{tikzpicture}
\end{center}

flow2e.png

答案2

这是一个使用的解决方案flowchart包裹(基于 TikZ)。有关详细信息,请参阅软件包文档。

\documentclass[11pt]{standalone}
\usepackage{flowchart}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}[>=stealth, thick]

\node (A) at (0,0) [draw, process, text width=5cm, minimum height=0.5cm, align=flush center] 
{A few lines of text in a block, centered would be nice but not required};

\node (B) at (0,-2) [draw, double, double distance=1pt, process, minimum height=0.5cm, align=flush center] 
{A double box here perhaps?};

\node (C) at (-3,-4) [draw, process, minimum height=0.5cm, align=flush center] 
{Some words here};

\node (D) at (3,-4) [draw, process, minimum height=0.5cm, align=flush center] 
{More words here};

\coordinate (z) at (0,-3);

\draw[->] (A) -- (B);
\draw[->] (B) -- (z) -| node[above] {NO} (C);
\draw[->] (B) -- (z) -| node[above] {YES} (D);

\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容