2

I have an arrow that looks like in this:

    \documentclass[tikz]{standalone}        
    \usetikzlibrary{shapes, arrows.meta, positioning}
    \tikzset{every picture/.style={/utils/exec={\sffamily\normalsize}}}
    
    \tikzstyle{textbox} = [rectangle, minimum width = 3.2cm, minimum height = 1cm, rounded corners = 1pt, line width = 1pt, draw = black, align = center]
    \tikzstyle{arrow}   = [solid, line width = 9pt, -{Triangle[width = 18pt, length = 12pt]}, color = black, shorten >= 3pt, shorten <= 3pt]
    
    \begin{document}
        \begin{tikzpicture}[node distance = 2cm and 1cm, outer sep = 0, inner sep = 0]
                
            \node [textbox]                  (box1) {box1};
            \node [textbox, right = of box1] (box2) {box2};
            \draw [arrow] (box1) -- (box2);
            
        \end{tikzpicture}
    \end{document}

arrow between boxes

My Goal is to round all the corners of the arrow by 1pt like I am doing it with the textboxes. I already tried line cap and rounded corners but it is not working. How am I able to round all the corners of the arrow head and also the of the line cap by 1pt?

2
  • Some arrowheads support a [round] option; e.g. Latex[round] Commented Aug 8, 2021 at 12:19
  • Arrow head round is short for line cap=round, line join=round, so I would think that all arrow heads support that option. Commented Aug 8, 2021 at 12:40

1 Answer 1

4
  \documentclass[tikz]{standalone}        
    \usetikzlibrary{shapes, arrows.meta, positioning}
    \tikzset{every picture/.style={/utils/exec={\sffamily\normalsize}}}
    
    \tikzstyle{textbox} = [rectangle, minimum width = 3.2cm, minimum height = 1cm, rounded corners = 1pt, line width = 1pt, draw = black, align = center]
    \tikzstyle{arrow}   = [solid, line width = 9pt, -{Triangle[width = 18pt, length = 12pt, round, line width=1pt]}, color = black, shorten >= 3pt, shorten <= 3pt]
    
    \begin{document}
        \begin{tikzpicture}[node distance = 2cm and 1cm, outer sep = 0, inner sep = 0]
                
            \node [textbox]                  (box1) {box1};
            \node [textbox, right = of box1] (box2) {box2};
            \draw [arrow] (box1) -- (box2);
            
        \end{tikzpicture}
    \end{document}

Rounded arrow

To make the left end rounded, you can add a rounded Square to the end like this:

\documentclass[tikz]{standalone}        
    \usetikzlibrary{shapes, arrows.meta, positioning}
    \tikzset{every picture/.style={/utils/exec={\sffamily\normalsize}}}
    
    \tikzstyle{textbox} = [rectangle, minimum width = 3.2cm, minimum height = 1cm, rounded corners = 1pt, line width = 1pt, draw = black, align = center]
    \tikzstyle{arrow}   = [solid, line width = 9pt, {Square[round, line width=1pt, length= 2pt, width=9pt]}-{Triangle[width = 18pt, length = 12pt, round, line width=1pt]}, color = black, shorten >= 3pt, shorten <= 3pt]
    
    \begin{document}
        \begin{tikzpicture}[node distance = 2cm and 1cm, outer sep = 0, inner sep = 0]
                
            \node [textbox]                  (box1) {box1};
            \node [textbox, right = of box1] (box2) {box2};
            \draw [arrow] (box1) -- (box2);
            
        \end{tikzpicture}
    \end{document}    

Rounded arrow in both ends

An other way to do this would be not to use an arrow at all, but to use a single arrow node shape.

Edit:

Using a single arrow node also rounds the inner corners, but of course it does not extend as a normal draw arrow:

\documentclass[tikz]{standalone}        
    \usetikzlibrary{shapes, arrows.meta, positioning, shapes.arrows}
    \tikzset{every picture/.style={/utils/exec={\sffamily\normalsize}}}
    \tikzstyle{textbox} = [rectangle, minimum width = 3.2cm, minimum height = 1cm, rounded corners = 1pt, line width = 1pt, draw = black, align = center]    
    \begin{document}
        \begin{tikzpicture}[node distance = 2cm and 1cm, outer sep = 0, inner sep = 0]            
            \node [textbox]                  (box1) {box1};
            \node [textbox, right = of box1] (box2) {box2};
            \path (box1) -- (box2) node[midway, xshift= -2pt, draw, single arrow, minimum height=0.8cm, minimum width=0.7cm, single arrow head extend=0.01cm, single arrow tip angle=75,rounded corners=1pt, fill]{};
        \end{tikzpicture}
    \end{document}    
 

Rounded arrow including inner corners

2
  • this is an amazing answer, thank you! 1 additional question regarding your single arrow code answer. If I remove single arrow head extend=0.01cm in the single arrow node I only get a really thin line and minimum height is not working. Why is this happening?
    – Bolle
    Commented Aug 8, 2021 at 13:23
  • I must admit that I do not understand single arrow head extend=0.01cm - it was found by trail and error. In the manual it is defined on page 811. I expect it is a bug - it makes no sense to set it so small. Commented Aug 8, 2021 at 13:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .