如何绘制这个表示系统的框,并用箭头表示输入和输出?

如何绘制这个表示系统的框,并用箭头表示输入和输出?

我需要画一个图,如下图所示。哪个包比较适合画这个图,TikZ?其实我需要将 latex 代码集成到我的软件程序中,输入、输出和变量可以根据程序中的参数改变,例如,如果只有两个输入参数,那么图片就只显示两个输入。而图例部分,既然是固定的,可以作为附件使用吗?

程序部分我可以考虑,但是如何在 Latex 中绘制图片对我来说确实是一个挑战,有人可以帮忙吗?

如何绘制黑色箭头符号?(RTDB 变量)

在此处输入图片描述

我尝试使用 pifont 包来制作小黑箭头。我检查了 \ding{253} 是否是我想要的,但是当我在 latex 代码中使用它时,它显示为鱼骨状,你知道问题是什么吗?

标有“CDMS::ALDS”的矩形,包含 5 个输入、2 个输出和 5 个变量

答案1

pics这是一项需要运用技巧的尝试,需要tikz 3.0

在此处输入图片描述

代码

\documentclass[border=10pt]{standalone}%[12pt,twoside,a4paper]{book}
\usepackage{graphicx,wrapfig,tikz}
\usetikzlibrary{positioning,shapes}
\tikzset{myarrow/.pic = {
\begin{scope}[rotate=-90,scale=0.5]
\draw[fill=black] (-0.5,0) -- (0,0.5)--(0.5,0)--(0.5,1)--
(0,1.5)--(-0.5,1)--(-0.5,0) ;
\end{scope}},
mydot/.pic={
\draw[fill=black,inner sep=0.7pt] circle(5pt);},
myelliB/.pic={
\draw[fill=black,inner sep=0.7pt] ellipse (1em and 0.5em);},
myelli/.pic={
\draw[very thick,inner sep=0.7pt] ellipse (1em and 0.5em);},
rec/.style={draw,minimum height=3em,minimum width=15em,fill=yellow},
}

\begin{document}
\begin{tikzpicture}
\draw (0,0) rectangle (6,6);
\node[] at (3,3) {CMDA::ALDS};

% draw myarrows on the left side
\foreach \i [count=\j from 1] in {5,4,3,2,1} {
\pic () at (-0.5,\i) {myarrow};
\node[xshift=-2cm] at (-1,\i) {input\j};
}

% draw mydots at bottom
\foreach \i [count=\j from 1] in {5,4,3,2,1} {
\pic (b\i) at (\i,0) {mydot};
\draw[] (\j,0)--(\j,-\i)node[right] {variable\j};
}

% draw myarrows on the right
\foreach \i [count=\j from 1] in {5,4} {
\pic () at (5.5,\i) {myarrow};
\node[xshift=2cm] at (6,\i) {output\j};
}

%--------legend
\node[rec] (L) at (11,2){Ledgend};
\node[rec,below=0.1cm of L](L1){RTDB variable};
\node[rec,below=0.1cm of L1](L2) {in all variants};
\node[rec,below=0.1cm of L2](L3){in some variants};
\node[rec,below=0.1cm of L3](L4) {XP variable};
\pic[xshift=-2.3cm] at (L1) {myarrow};
\pic[xshift=-2.cm] at (L2) {myelliB};
\pic[xshift=-2.cm] at (L3) {myelli};
\pic[xshift=-2.cm] at (L4) {mydot};
\end{tikzpicture}
\end{document}

相关内容