在算法表示中(几个月前我得到了帮助,感谢 tex.stackexchange!),我想使用 2 个特定符号表示输入和输出数据:这是实际的算法图:
Latex 源代码如下:
\documentclass{standalone}
\usepackage[T1]{fontenc} %lien codage fonte en sortie
\usepackage[latin1]{inputenc} %lien codage d'entrée
\usepackage{dejavu} % fonte en sortie
\usepackage{forest}
\usepackage{amssymb}
\usetikzlibrary{shapes.geometric}
\begin{document}
\pgfkeys{/forest,
racine/.append style={minimum width=1cm, fill=white!80,circle,
tikz={
\draw [circle,draw,line width=0.5pt] ;
\draw [->,line width=1pt] () ++(160:4mm) arc (-200:40:4mm);}
},
affecter/.append style={rectangle, minimum height=5mm},
ecrire/.append style={trapezium, trapezium left angle=110,trapezium right angle=70, minimum height=5mm},
lire/.append style={trapezium, trapezium left angle=70,trapezium right angle=-70, minimum height=5mm},
executer/.append style={below=0ex,draw,cloud,aspect=4,cloud puffs=32},
retourner/.append style={minimum width=2cm, fill=red!40,rectangle},
nop/.append style={circle},
sequence/.append style={fill=red!20, rounded corners},
decision/.append style={diamond, fill=blue!20, text width=5em, inner sep=.5pt, rounded corners},
si/.append style={fill=red!20, circle},
tq/.append style={fill=red!20, circle},
pour/.append style={fill=red!20, circle},
nuage/.append style={below=0ex,draw,dotted,cloud,aspect=4,cloud puffs=12}
}
\begin{forest}
for tree={
child anchor=north,
parent anchor=south,
thick,
draw,
align=center
}
[{CalculerSomme1\\\hline \mbox{}\\[-1em]VAR entier som,a,b,compteur\\} [seq, racine
[Initialisation, sequence[{a,b $\leftarrow$ }, lire][{som$\leftarrow$ 0}, affecter ] ]
[Traitement, sequence
[POUR, pour
[ { compteur\\de 1\\a b\\pas 1}, decision]
[repeter, sequence, edge label={node[midway,left,font=\scriptsize]{vrai}}[{som$\leftarrow$ som + a}, affecter ] ] ] ]
[Resultat, sequence[{ som}, ecrire] ] ] ]
\end{forest}
\end{document}
我想用符号替换输入 a 和 b,输出 som :你能帮助我吗?非常感谢!
答案1
这些形状已在shapes.symbols
库中可用,它们被称为signal
。请查看第 703 页pgfmanual
以下示例摘自该处:
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{shapes.symbols}
\begin{document}
\begin{tikzpicture}
[every node/.style={signal, draw, text=white, signal to=nowhere}]
\node[fill=green!65!black, signal to=east] at (0,1) {To East};
\node[fill=red!65!black, signal from=east] at (0,0) {From East};
\end{tikzpicture}
\end{document}