7

In PStricks... (edited after view the answer about tikz)

How can I draw an arrow similar to this?

enter image description here

to make an sketch os a progresion in 4 steps, similar to

A => B => C => D

but A;B;C;D is images, and => is an arrow to fill

egreg
  • 1,121,712
Mika Ike
  • 3,751

4 Answers4

8

One option using TikZ and single arrow from the shapes.arrows library:

\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}

enter image description here

With images (place \includegraphics inside a node):

\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}

enter image description here

Gonzalo Medina
  • 505,128
7

with current pstricks-add.tex from 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} 

enter image description here

All optional arguments for lines and filling are possible:

\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}

enter image description here

  • Is not neccesary type \being{pspicture} ...\end{pspicture}? to dran ps objects??? It´s the first time I view this with \beign{},....\end{} – Mika Ike Apr 17 '14 at 21:15
  • 1
    Without the pspicture environment it reserves no space! It is put in box of 0pt für height and width. That's the only difference. You can also reserve space with \makebox[...] or \vspace –  Apr 17 '14 at 21:20
  • Fantastic @herbert i'm using this trick. I like it. It's a pity that can't make retangles instead squareboxes. – Mika Ike Apr 17 '14 at 21:33
  • Do you know What Documentation/PDF are \psBigArrow in? I´m looking for knowing more about options but I can´t reach that. For control the wide amount and the size of the forward part.Thank you for sharing your knowledge – Mika Ike Apr 18 '14 at 05:28
  • 1
    It is in http://texnik.dante.de/doc/generic/pstricks-add/, but will be soon on CTAN. However, you have to specify the two coordinates Start-End. Valid options are doublesep (the inner width), linewidth, linecolor, fillcolor, fillstyle. –  Apr 18 '14 at 06:39
  • I think that It is nos in the documentation, because I was searching before question you, and now I´m searching again in that PDF, with Ctrl+F and.... no results!!! It´s no important. but.... only.. curiousity – Mika Ike Apr 18 '14 at 06:49
  • 1
    Follow the link and you'll find it on page 98. See also my edited answer –  Apr 18 '14 at 07:31
  • Yes! :-) \herbert You´re right My Firwfox PDF-viewer runs bad searching, and I viewed my PDF with Adobe Reader, but... I had v3.65 and you give me the link of the v3.66 and That´s the difference :-) Thank you for all. I see that there are no options to set the width of the BIGARROW. I suposse that in the future, to control the size and proportions. – Mika Ike Apr 18 '14 at 07:46
  • 1
    the width is controlled by doublesep, preset to 1cm –  Apr 18 '14 at 07:51
  • ok. I can´t run this code. LATEX tell me Undefined Control SEquence – Mika Ike Apr 18 '14 at 12:52
  • then you do not used the latest pstricks-add.tex –  Apr 18 '14 at 14:28
4

An automatic solution with TikZ, based on Connecting nodes with brace in 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}

The result:

enter image description here

2

Here is one, with round corners and gradient fill:

\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} 

enter image description hereZ.png

Bernard
  • 271,350
  • :-) It´s so good. What detail level!! :-)) I can´t believe that high detaill level!!! :-) I understand in gneral, but I can´t understand (A0)(A1)(A2)(B1) because I can´t view that defined in the code. – Mika Ike Apr 18 '14 at 05:38
  • 1
    (A0)(A1)(A2) is related to the \pnodes{A}(…,…)(…,…)(…,…) syntax: it defines a sequence of nodes all prefixed by A,that are numbered starting from 0. It's defined p. 6 of the pst-node documentation. – Bernard Apr 18 '14 at 10:28
  • ok, I couldn´t understand that first(,) is A0; second (,)is A1;.... I was surprised because I didn´t know that. Thank you. – Mika Ike Apr 18 '14 at 16:59