TransWikia.com

Increase the width of the arrowhead and shape boundary

TeX - LaTeX Asked by Shivam Chakraborty on January 16, 2021

I want to increase the width of the arrowhead and want to make the boundary of the shapes border a little darker (like I want to make the lines of the rectangle to be thicker). Is there is any way of the latter, for the former I got some references like arrow.meta but couldn’t understand it.

Thanks for the help in advance!

documentclass[14pt,english]{article}
usepackage{nopageno}
usepackage{blindtext}
usepackage[paperheight=13.1in,paperwidth=7.9in,margin=0.05in,heightrounded]{geometry}
%usepackage[margin=0.2in]{geometry}
% geometry{
% a4paper,
% total={170mm,275mm},
% left=1mm,
% top=7mm,
% }
usepackage[utf8]{inputenc}
usepackage{amsmath}

usepackage{tikz}
usetikzlibrary{shapes.geometric, arrows}

tikzstyle{startstop} = [rectangle, rounded corners, minimum width=3cm, minimum height=1cm,text centered,text width=4cm,draw=black, fill=red!0]
%tikzstyle{io} = [trapezium, trapezium left angle=70, trapezium right angle=110, minimum width=3cm,text width=3cm, minimum height=1cm, text centered, draw=black, fill=blue!00]
tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered,text width=7cm, draw=black, fill=orange!0]
tikzstyle{decision} = [diamond, minimum width=3cm, minimum height=1cm, text centered,text width=5cm, draw=black, fill=green!0]
tikzstyle{arrow} = [thick,->,>=stealth]

begin{document}

begin{tikzpicture}[node distance=1.5cm]

node (start) [startstop,font=Large] {Start};
node (pro1) [process, below of=start,font=Large] {Make};
node (pro2) [process, below of=pro1,font=Large] {Initialize};
node (pro3) [process, below of=pro2,font=Large] {Increment};
node (dec1) [decision, below of=pro3, yshift=-2cm,aspect=2,font=Large] {satisfied?};
node (dec2) [decision, below of=dec1, yshift=-4cm,aspect=2,font=Large] {satisfied?};
node (dec3) [decision, below of=dec2, yshift=-4cm,aspect=2,font=Large] {Achieved?};
node (pro3a) [process, left of=dec3,xshift=-6cm, yshift=3cm,font=Large] {Increase};
node (dec2a) [decision, left of=dec2, xshift=-6cm, yshift=2cm,aspect=1.5,font=Large] {Thickness within maximum limit?};
node (pro4) [process, below of=dec3, yshift=-2.5cm,font=Large] {Store};
node (dec4) [decision, below of=pro4, yshift=-2cm,aspect=2,font=Large] {Maximum reached?};
node (pro5) [process, below of=dec4, yshift=-2cm,font=Large] {Select model with max};
node (stop) [startstop, below of=pro5,font=Large] {Stop};

draw [arrow] (start) -- (pro1);
draw [arrow] (pro1) -- (pro2);
draw [arrow] (pro2) -- (pro3);
draw [arrow] (pro3) -- (dec1);
draw [arrow] (dec1) -- (dec2);
draw [arrow] (dec2) -- (dec3);
draw [arrow] (dec3) -- (pro4);
draw [arrow] (pro4) -- (dec4);
draw [arrow] (dec4) -- (pro5);
draw [arrow] (pro5) -- (stop);
draw [arrow] (pro3a) -- (dec2a);

draw [arrow] (dec1) -- node[anchor=west] {Y} (dec2);
draw [arrow] (dec1.east) -- ++(1em,0) node[above] {N}
                          -- ++(1em,0) |- (pro1.east);
draw [arrow] (dec2) -- node[anchor=west] {Y} (dec3);
draw [arrow] (dec2.east) -- ++(2.5em,0) node[above] {N}
                          -- ++(2.5em,0) |- (pro1.east);
draw [arrow] (dec3) -- node[anchor=west] {Y} (pro4);
draw [arrow] (dec3.east) -- ++(2.5em,0) node[above] {N}
                          -- ++(2.5em,0) |- (pro1.east);
draw [arrow] (dec3.west) -| node[anchor=east] {N} (pro3a);
draw [arrow] (dec4) -- node[anchor=west] {Y} (pro5);
draw [arrow] (dec4.east) -- ++(4em,0) node[above] {N}
                          -- ++(4em,0) |- (pro1.east);  
draw [arrow] (dec2a.west) -- ++(-0.5em,0) node[above] {N}
                          -- ++(-0.5em,0) |- (pro1.west);
draw [arrow] (dec2a) |- node[anchor=south] {Y} (dec1);

end{tikzpicture}

end{document}

2 Answers

  • Your flowchart is based on an old example which use now deprecated syntax for defining flowchart elements syntax (tikzstyle instead of tikzset, without library arrows.meta).
  • Library arrows.meta enable customization of arrows heads (length, width, angle,
    fill, scale, etc). It is described in TikZ & PGF manual, section 16.3 Arrow Keys: Configuring the Appearance of a Single Arrow Tip, pp. 193 -- 206 (version 3.1.7a).
  • Shape border thickness can be increased by adding desired border width. In this you can use predefined widths: semithick, thick, very thick or ultra thick or define it by line width=<desired width>. In MWE below is selected semithick for arrows and thick` for nodes borders.
  • With use of the libraries positioning is possible to write more clean and shorter code without any manual tweek of position with xshift and yshit options.
  • Further simplification of code can be achieved by use of the chains library. Using its macro join can replace drawings most of the connections between nodes.

Considering aforementioned, The MWE of your flowchart can be:

documentclass[12pt,english]{article} % 14 pt not exist
usepackage{nopageno}
usepackage{blindtext}
usepackage[paperheight=13.1in,paperwidth=7.9in,margin=0.05in,heightrounded]{geometry}
usepackage{tikz}
usetikzlibrary{arrows.meta,
                chains,
                quotes,
                positioning,
                shapes.geometric}
tikzset{
        arr/.style = {-{Stealth[length=7pt]}, semithick},   % <--- defined arrows heads style
      base/.style = {draw, thick, % <---
                    text width=42mm, minimum height=8mm,
                     font=large, align=center},
 startstop/.style = {base, rounded corners},    %, fill=red!30
   process/.style = {base, rectangle},          %, fill=orange!30
        io/.style = {base, trapezium, trapezium stretches body,
                     trapezium left angle=70, trapezium right angle=110,
                     },                         %fill=blue!30
  decision/.style = {base, diamond, aspect=1.6, %fill=green!30,
                     inner xsep=-3pt},
        }

begin{document}
centering
    begin{tikzpicture}[
node distance=6mm and 8mm,
  start chain = going below
                        ]
% main branch
    begin{scope}[nodes={on chain, join=by arr}]
node (start)   [startstop] {Start};
node (pro1)    [process]   {Make};
node (pro2)    [process]   {Initialize};
node (pro3)    [process]   {Increment};
node (dec1)    [decision]  {satisfied?};
node (dec2)    [decision]  {satisfied?};
node (dec3)    [decision]  {Achieved?};
node (pro4)    [process]   {Store};
node (dec4)    [decision]  {Maximum reached?};
node (pro5)    [process]   {Select model with max};
node (stop)    [startstop] {Stop};
    end{scope}
% left branch
node (dec2a)   [decision, 
                 left=of dec1] {Thickness within maximum limit?};
node (pro3a)   [process,
                 at={(dec2a |- dec2)}]   {Increase};
% labels in main branch
path (dec1)    to ["Y"]    (dec2) 
      (dec2)    to ["Y"]    (dec3); 
% arrows and labels right from main branch
coordinate[right=of pro1 -| dec4.east] (aux1);
draw [arr] (dec1) -- node[pos=0.25, above] {N} (dec1 -| aux1);
draw [arr] (dec2) -- node[pos=0.25, above] {N} (dec2 -| aux1);
draw [arr] (dec3) -- node[pos=0.25, above] {N} (dec3 -| aux1);
draw [arr] (dec4) -| node[pos=0.25, above] {N} (aux1) 
                   -- (pro1);
% arrows and labels left from main branch
draw [arr] (dec2a.west) --  node[above] {N} ++(-8mm,0)  |- (pro1);
draw [arr] (dec2a) to ["Y"] (dec1);
draw [arr] (pro3a) -- (dec2a);
draw [arr] (dec3)  -| node[pos=0.1, above] {Y} (pro3a);
    end{tikzpicture}
end{document}

enter image description here

Correct answer by Zarko on January 16, 2021

Two suggestions:

  1. Add thick to your code: begin{tikzpicture}[node distance=1.5cm, thick], or any line width you prefer.
  2. Replace the arrows tikzlibrary with arrows.meta. Then you can scale your arrows with tikzstyle{arrow} = [-{Stealth[scale=1.2]}] (or whatever scaling factor you want).

Old:

enter image description here

New:

enter image description here

Answered by Sandy G on January 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP