我正在尝试在附件上绘制一些阴影和颜色渐变箭头。最后剩下的部分是在代码中称为“NILb.png”的第二个图形和代码中称为“NILc.png”的第三个图形之间获得相同的箭头。当然,您可以简单地替换上传代码中的图片加载文本。箭头可以是弯曲的,也可以是 90 度旋转。我无法扩展样式来绘制这个东西。有什么建议吗?提前谢谢。注意:该图是从另一个参考资料中复制的,因此请记住作者 WD Slafer 的法定权利。
\documentclass{article}
\usepackage{listings}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usepackage{lipsum}
\usetikzlibrary{fadings, shapes.arrows, shadows}
\usetikzlibrary{trees,positioning, graphs, calc}
\tikzfading[name=arrowfading, top color=transparent!50, bottom color=transparent!95]
\begin{document}
\tikz [baseline = (NILa.north), arrowfill/.style={top color=Gray, bottom color=LightGray, general shadow={fill=Gray, shadow xshift=0.3ex, shadow yshift=-0.3ex, path fading=arrowfading}},
arrowstyle/.style={draw=Gray,arrowfill, single arrow, single arrow,
single arrow head extend=0.2cm}] { %
%Load the pics from file and align them
\node[anchor=north west,inner sep=0] (NILa) at (0,0) {\includegraphics[width=0.3\textwidth]{NILa.png}};
\node[inner sep=0] (NILb) [right =3cm of NILa] {\includegraphics[width=0.3\textwidth]{NILb.png}};
\path (NILa.south west) -- coordinate (aux) (NILa.south -| NILb.east);
\path let
\p1=(aux)
in
node (NILc) [below] at ($(\x1, \y1-1.5cm)$) {\includegraphics[width=0.3\textwidth]{NILc.png}}
;
%Now I insert the arrows needed
\node [arrowstyle, minimum height=2.1cm] [right =0.2cm of NILa] {};
%Take the coordinate of the corner between the second and third boxes
\path (NILb.south) |- coordinate (aux2) (NILc.east);
\node [arrowstyle] [below=0.2cm of NILb] {};
} %This bracket closes the \tikz command
\end{document}
答案1
节点不太灵活,因此使用普通的线路径可能更容易做到这一点。制作一个样式
widearrow/.style={
-{Triangle[length=6mm,width=10mm]},line width=4mm,gray
}
并做例如
\draw [widearrow] ([yshift=-1mm]NILb.south) to[out=270,in=20] (NILc.east);
您可以使用以下方式制作带角的箭头
\draw [widearrow] ([yshift=-1mm]NILb.south) |- (NILc.east);
(黑色方块是由于demo
选项引起的,您不希望在文档中出现它。)
\documentclass[
demo % remove this in your document
]{article}
\usepackage{listings}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{
fadings,
shapes.arrows,
shadows,
arrows.meta, % has replaced the old arrows library
positioning,
calc
}
\begin{document}
\begin{tikzpicture}[
baseline = (NILa.north),
widearrow/.style={
-{Triangle[length=6mm,width=10mm]},line width=4mm,gray
}
]
%Load the pics from file and align them
\node[anchor=north west,inner sep=0] (NILa) at (0,0) {\includegraphics[width=0.3\textwidth]{NILa.png}};
\node[inner sep=0] (NILb) [right =3cm of NILa] {\includegraphics[width=0.3\textwidth]{NILb.png}};
\path (NILa.south west) -- coordinate (aux) (NILa.south -| NILb.east);
\path let
\p1=(aux)
in
node (NILc) [below] at ($(\x1, \y1-1.5cm)$) {\includegraphics[width=0.3\textwidth]{NILc.png}}
;
%Now I insert the arrows needed
%\node [arrowstyle, minimum height=2.1cm] [right =0.2cm of NILa] {};
\draw [widearrow,shorten >=1mm,shorten <=1mm] (NILa) -- (NILb);
\draw [widearrow] ([yshift=-1mm]NILb.south) to[out=270,in=0] (NILc.east);
\end{tikzpicture}
\begin{tikzpicture}[
baseline = (NILa.north),
widearrow/.style={
-{Triangle[length=6mm,width=10mm]},line width=4mm,gray
}
]
%Load the pics from file and align them
\node[anchor=north west,inner sep=0] (NILa) at (0,0) {\includegraphics[width=0.3\textwidth]{NILa.png}};
\node[inner sep=0] (NILb) [right =3cm of NILa] {\includegraphics[width=0.3\textwidth]{NILb.png}};
\path (NILa.south west) -- coordinate (aux) (NILa.south -| NILb.east);
\path let
\p1=(aux)
in
node (NILc) [below] at ($(\x1, \y1-1.5cm)$) {\includegraphics[width=0.3\textwidth]{NILc.png}}
;
%Now I insert the arrows needed
%\node [arrowstyle, minimum height=2.1cm] [right =0.2cm of NILa] {};
\draw [widearrow,shorten >=1mm,shorten <=1mm] (NILa) -- (NILb);
\draw [widearrow] ([yshift=-1mm]NILb.south) |- (NILc.east);
\end{tikzpicture}
\end{document}