![箭头尖端重叠框架](https://linux22.com/image/398310/%E7%AE%AD%E5%A4%B4%E5%B0%96%E7%AB%AF%E9%87%8D%E5%8F%A0%E6%A1%86%E6%9E%B6.png)
下面是两张图,展示了我在图表中使用的示例,我随后给出了最小的运行代码
\documentclass[border=2pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usetikzlibrary{positioning}
\tikzstyle{fonction}=[
align=center, line width=2pt,
minimum width=4cm, text width=3.8cm,minimum height=1.8cm,
rectangle,rounded corners=2pt
]
\tikzstyle{fonctionInfo}=[fonction, draw=black, text=black]
\tikzstyle{fleche}=[->,>=latex,line width=1mm,black]
\begin{document}
\begin{tabular}{c}
\begin{tikzpicture}[scale=1]
\node (Cod) at (0,0) {};
\node[fonctionInfo,right=2.5cm of Cod] (Trai) {\LARGE Traiter \\[3mm] Mémoriser};
\node[fonctionInfo,right=2.5cm of Trai] (Com) {\LARGE Communiquer};
\draw[fleche,<->] (Trai.350) -- (Com.190);
\coordinate[right=1.5cm of Com.east] (C7);
\draw[fleche,<->] (Com.east) -- (C7);
\node[anchor=west,align=center] (Entree) at (C7)
{\large Informations \\ \large issues et vers \\ \large l'exterieur};
\end{tikzpicture} \\
\begin{tikzpicture}[scale=1]
\node (Cod) at (0,0) {};
\node[fonctionInfo,right=2.5cm of Cod] (Trai) {\LARGE Traiter \\[3mm] Mémoriser};
\node[fonctionInfo,right=2.5cm of Trai] (Com) {\LARGE Communiquer};
\draw[fleche,<->] (Trai.350) -- (Com.190) -- ++ (0.25,0cm);
\coordinate[right=1.5cm of Com.east] (C7);
\draw[fleche,<->] (Com.east) -- (C7);
\node[anchor=west,align=center] (Entree) at (C7)
{\large Informations \\ \large issues et vers \\ \large l'exterieur};
\end{tikzpicture}
\end{tabular}
\end{document}
您可以在图片上看到差异:第二张图片上的箭头像我希望的那样重叠。它来自 le line:
\draw[fleche,<->] (Trai.350) -- (Com.190) -- ++ (0.25,0cm);
结尾,特别是结尾:
++ (0.25,0cm);
让我能用箭走得更远一点。
我的第一个问题是,对于指向左边的箭头我该怎么做?
第二个问题是,有没有办法让每支箭都有额外的长度,而不必在每个箭上手动添加“++ (0.25,0cm)”?
答案1
您可以使用shorten
负长度,这会使箭头更长。
\draw[fleche,<->,shorten <=-0.25cm,shorten >=-0.25cm] (Trai.350) -- (Com.west|-Trai.350);
确保(Com.west|-Trai.350)
箭头是水平的。请注意,\tikzstyle
已弃用,如果您将设置font
为\Large
或\large
,也可以将其添加到样式中,代码会变得更短。
\documentclass[border=3.14mm]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{fonction/.style={
align=center, line width=2pt,
minimum width=4cm, text width=3.8cm,minimum height=1.8cm,
rectangle,rounded corners=2pt
},
fonctionInfo/.style={fonction, draw=black, text=black,font=\LARGE},
fleche/.style={->,>=latex,line width=1mm,black}}
\begin{document}
\begin{tabular}{c}
\begin{tikzpicture}[scale=1]
\node (Cod) at (0,0) {};
\node[fonctionInfo,right=2.5cm of Cod] (Trai) {Traiter
\\ M\'emoriser};
\node[fonctionInfo,right=2.5cm of Trai] (Com) {Communiquer};
\draw[fleche,<->] (Trai.350) -- (Com.190);
\coordinate[right=1.5cm of Com.east] (C7);
\draw[fleche,<->] (Com.east) -- (C7);
\node[anchor=west,align=center,font=\large] (Entree) at (C7)
{Informations \\ issues et vers \\ l'exterieur};
\end{tikzpicture} \\
\begin{tikzpicture}[scale=1]
\node (Cod) at (0,0) {};
\node[fonctionInfo,right=2.5cm of Cod] (Trai) {Traiter
\\ M\'emoriser};
\node[fonctionInfo,right=2.5cm of Trai] (Com) {Communiquer};
\draw[fleche,<->,shorten <=-0.25cm,shorten >=-0.25cm]
(Trai.350) -- (Com.west|-Trai.350);
\coordinate[right=1.5cm of Com.east] (C7);
\draw[fleche,<->] (Com.east) -- (C7);
\node[anchor=west,align=center] (Entree) at (C7)
{\large Informations \\ \large issues et vers \\ \large l'exterieur};
\end{tikzpicture}
\end{tabular}
\end{document}
答案2
可以用来calc
稍微移动箭头的坐标
也tikzstyle
已弃用,并且节点中的字体大小更改会给出不正确的空格
\documentclass[border=2pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{pgfplots}
\usetikzlibrary{positioning,calc}
\tikzset{
fonction/.style={
align=center,
line width=2pt,
minimum width=4cm,
text width=3.8cm,
minimum height=1.8cm,
rectangle,
rounded corners=2pt
},
fonctionInfo/.style={
fonction,
draw=black,
text=black
},
fleche/.style={
->,
>=latex,
line width=1mm,
black
}
}
\begin{document}
\begin{tabular}{c}
\begin{tikzpicture}[scale=1]
\node (Cod) at (0,0) {};
\node[fonctionInfo,right=2.5cm of Cod,font=\LARGE] (Trai) {Traiter Mémoriser};
\node[fonctionInfo,right=2.5cm of Trai,font=\LARGE] (Com) {Communiquer};
\draw[fleche,<->] ($(Trai.350)+(-0.3,0)$) -- ($(Com.190)+(0.3,0)$);
\coordinate[right=1.5cm of Com.east] (C7);
\draw[fleche,<->] (Com.east) -- (C7);
\node[anchor=west,align=center,font=\large, text width=3cm] (Entree) at (C7) {Informations issues et vers l'exterieur};
\end{tikzpicture}
\end{tabular}
\end{document}
答案3
我实际上想到了一个方法来回答第一部分
\draw[fleche,<->] (Trai.350) -- (Com.190) -- ++ (0.25,0cm);
在
\draw[fleche,->] (Trai.350) -- ++ (-0.25,0cm);
\draw[fleche,->] (Trai.350) -- (Com.190) -- ++ (0.25,0cm);
有没有更好的方法?第二个问题仍然存在。我该怎么做才能不为每个箭头复制和粘贴?