帮助使用 LaTeX 绘制图表

帮助使用 LaTeX 绘制图表

我怎样才能在 LaTeX 中绘制不带颜色(只有黑色和白色)的图形?

图像

我设法让我的代码代表每个部分,但我需要中间的箭头

\begin{tikzpicture}[sharp corners=2pt,inner sep=7pt,node distance=.8cm,every text node part/.style={align=center}]
\tikzstyle{block} = [rectangle, draw, fill=orange!30, 
    text width=10em, text centered, rounded corners, minimum height=4em]

% Draw rectangular nodes (switch sharp to smooth for different corners)
\node[draw, minimum height = 1cm, minimum width = 1cm] (state0){Lecture hall A };
\node[draw,below=1cm of state0, minimum height = 1cm, minimum width = 1cm](state2){ Female students };
\node[draw,right=1cm of state0, minimum height = 1cm, minimum width = 1cm](state1){Lecture hall A };
\node[draw,below=1cm of state1, minimum height = 1cm, minimum width = 1cm](state3){Male students};
width = 1cm](state2){ Female students };
\node[draw,right=2cm of state3, minimum height = 1cm, minimum
width = 1cm](state4){ Female students };
\node[draw,right=1cm of state4, minimum height = 1cm, minimum width = 1cm](state5){Male students};
\node [block, right=3cm of state1] (state6) {Lecture hall A};
%Draw arrows
\draw[-triangle 60] (state0) -- (state2) node [midway, above, left = 0.1cm]{};

\draw[-triangle 60] (state1) -- (state3) node [midway, above, right = 0.1cm]{};

\draw[-triangle 60] (state6) -- (state4) node [midway, above, right = 0.1cm]{};
\draw[-triangle 60] (state6) -- (state5) node [midway, above, right = 0.1cm]{};

代码输出

答案1

以下是我想出的办法。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,arrows}

\begin{document}

\centering
\begin{tikzpicture}[sharp corners=2pt,inner sep=7pt,node distance=.8cm,every text node part/.style={align=center}]

% Draw rectangular nodes (switch sharp to smooth for different corners)
\node[draw] (state0){Lecture hall A };
\node[draw,below=2.5em of state0](state2){ Female students };
\node[draw,right=2em of state0](state1){Lecture hall A };
\node[draw,below=2.5em of state1](state3){Male students};
%Blank node for positioning
\node[right=2em of state1](blank){};
%Arrow
\node[single arrow, draw=black, fill=black!25, minimum height=4em, below=0.9em of blank](arrow){};
\node[draw, right=7em of state1, minimum height = 5em, minimum width =9em](state4){Lecture hall A};
%Blank node for positioning
\node[below=4em of state4](invis){};
\node[draw, below left=1em of invis](state5){Female students};
\node[draw, below right=1em of invis](state6){Male students};

%Draw arrows
\draw[-triangle 60] (state0) -- (state2) node [midway, above, left = 0.1cm] {};
\draw[-triangle 60] (state1) -- (state3) node [midway, above, right = 0.1cm] {};
\draw[-triangle 60] (state4.south) -- (state5);
\draw[-triangle 60] (state4.south) -- (state6);

\end{tikzpicture}

\end{document}

输出:

在此处输入图片描述

相关内容