在 PStricks 中......(查看有关 tikz 的答案后编辑)
我怎样才能绘制类似的箭头?
绘制草图分为 4 步,类似于
A => B => C => D
但是 A;B;C;D 是图像,而 => 是填充箭头
答案1
与pstricks-add.tex
来自http://texnik.dante.de/tex/generic/pstricks-add/
\documentclass{article}
\usepackage{pstricks-add}
\usepackage{graphicx,mwe}
\begin{document}
\includegraphics[scale=0.2]{example-image}
\makebox[4cm]{%
\psBigArrow[fillstyle=solid,fillcolor=blue!30,doublesep=5mm,
linecolor=blue,linewidth=2pt](-1,1)(1,1)}
\includegraphics[scale=0.2]{example-image}
\includegraphics[scale=0.2]{example-image}
\vspace{2cm}
\makebox[2cm]{%
\psBigArrow[fillstyle=solid,fillcolor=blue!30,doublesep=5mm,
linecolor=blue,linewidth=2pt](0,0.2)(0,2)}
\includegraphics[scale=0.2]{example-image}
\end{document}
所有线条和填充的可选参数都是可能的:
\documentclass{article}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}(5,5)
\psset{doublesep=1cm}
\psBigArrow[fillstyle=solid,fillcolor=blue!30,linecolor=blue](0,3)(5,3)
\psBigArrow[fillstyle=solid,opacity=0.3,fillcolor=red,linecolor=red,linewidth=3pt](0.5,0.5)(5,5)
\end{pspicture}
\end{document}
答案2
single arrow
使用 TikZ 和库中的一个选项shapes.arrows
:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}[]
\node (a) {A};
\node at (2,0) (b) {B};
\node at (4,0) (c) {C};
\node at (6,0) (d) {D};
\foreach \Xcoor in {1,3,5}
\node at (\Xcoor,0) [draw=green,fill=green!30,single arrow] {\phantom{aaa}};
\end{tikzpicture}
\end{document}
使用图像(放置\includegraphics
在节点内):
\documentclass{article}
\usepackage{tikz}
\usepackage{graphicx}
\usetikzlibrary{shapes.arrows}
\begin{document}
\begin{tikzpicture}[]
\node (a) {\includegraphics[width=1cm]{example-image-a}};
\node at (3,0) (b) {\includegraphics[width=1cm]{example-image-a}};
\node at (6,0) (c) {\includegraphics[width=1cm]{example-image-a}};
\node at (9,0) (d) {\includegraphics[width=1cm]{example-image-a}};
\foreach \Xcoor in {1.5,4.5,7.5}
\node at (\Xcoor,0) [draw=green,fill=green!30,single arrow] {\phantom{aaa}};
\end{tikzpicture}
\end{document}
答案3
基于 TikZ 的自动解决方案在 TikZ 中使用括号连接节点:
\documentclass{article}
\usepackage{tikz,mwe}
\usetikzlibrary{calc,shapes.arrows,decorations.pathreplacing,shadows}
% list of keys
\newif\ifbraceon
\pgfkeys{/tikz/.cd,
arrow color/.store in=\arrowcol,
arrow color=green!80!blue,
items distance/.store in=\itemdistance,
items distance=3cm,
border color/.store in=\bordercol,
border color=green!80!black,
fill color/.store in=\fillcol,
fill color=green!80!lime!20,
brace color/.store in=\bracecol,
brace color=green!80!blue,
brace distance/.store in=\bracedistance,
brace distance=5pt,
display brace/.is if=braceon,
display brace=true
}
% list of styles
\tikzset{my arrow/.style={
single arrow, draw, minimum height=0.5cm,
minimum width=0.05cm,
single arrow head extend=0.1cm
},
module/.style={
rounded corners,
draw=\bordercol,
fill=\fillcol,
minimum height=1cm,
minimum width=1.5cm,
text width=1.45cm,
align=center,
general shadow={shadow yshift=-.4ex,opacity=.4, fill=black!50, every shadow},
},
brace/.style={
decoration={brace,raise=\bracedistance,amplitude=0.75em},
decorate,
draw=\bracecol,
very thick,
}
}
% arrows between two modules
\newcommand{\guparrow}{
node[my arrow,top color=\arrowcol!10,bottom color=\arrowcol,midway] {}
}
% bracediagram:
% #1 options, optional argument
% #2 list of items,
% #3 brace comment
\newcommand{\braceddiagram}[3][]{
\begin{tikzpicture}[#1]% here we can pass the options to customize the colors
% counting all the items to be displayed
\foreach \items [count=\xi] in {#2}{\global\let\maxnumitem\xi}
\foreach \items [count=\xi] in {#2}{%
\path let
\n1={0+\xi*\itemdistance} in
node[module] (module\xi) at +(\n1,0) {\items};
}
\foreach \items [count=\xi] in {#2}{%
\pgfmathtruncatemacro{\xj}{mod(\xi, \maxnumitem) + 1)}
\ifnum\xi<\maxnumitem % to not have the path from the last module
% directed to the first one
\path (module\xj) -- (module\xi) \guparrow;
\fi
}
\ifbraceon
% at the end we draw the brace with the comment
\draw[brace] (module1.north west)--(module\maxnumitem.north east)
node[above=3*\bracedistance, midway]{#3};
\fi
\end{tikzpicture}
}
\begin{document}
\braceddiagram[module/.style={},display brace=false]{A,B,C}{}
\vspace{1cm}
\braceddiagram[module/.style={},display brace=false]{
\includegraphics[scale=0.1]{example-image},
\includegraphics[scale=0.1]{example-image-a},
\includegraphics[scale=0.1]{example-image-b}}{}
\end{document}
结果:
答案4
下面是一个带有圆角和渐变填充的:
\documentclass[a4paper,x11names, svgnames]{article}%
\usepackage[pdf]{pstricks}%
\usepackage{pstricks-add, pst-grad}
\definecolor[ps]{bordercolor}{rgb}{0.06 0.42 0.11}
\definecolor[ps]{greenbegin}{rgb}{0.47 0.94 0.151}
\definecolor[ps]{greenend}{rgb}{0.23 0.65 0.02}
\begin{document}
\psset{unit = 1mm}
\begin{pspicture}(-5,-10)(30,10) %
\psset{unit = 1mm, linearc = 0.05,linewidth = 1.2, linecolor =bordercolor}%SeaGreen4
\pnode(0,0){O}
\pnodes{A}(10.5,9.6)(10.5,5.5)(26,5.5)
\pnodes{B}(10.5,-9.6)(10.5,-5.5)(26,-5.5)
\pspolygon[fillstyle = gradient, gradangle=-45, gradbegin=PaleGreen1!60!, gradend=Chartreuse3! 50! SpringGreen4 ](O)(A0)(A1)(A2)(B2)(B1)(B0)%
\end{pspicture}
\end{document}
大呂.png