Search code examples
latextikz

Latex Diamond Symbol in Algorithm Flowcharts


\tikzstyle{decision2} = [diamond, minimum width=8cm, minimum height=1cm, text centered, text width=4cm, draw=black, fill=green!30]

In this image we can see the Diamond from the Flow chart, generated by the code above

As you can see the diamond is larger than it should be. As the width is alright, the height of the diamond symbol is a bit too high. How can we reduce the height so that this diamond symbol looks a bit "slimmer", yet still fits the text inside? Or how can we reduce the height of the diamond symbol and increase the width of the diamond symbol simultaneously so that the text inside still fits?

Possible goal: This diamond here looks a bit "slimmer, but still fits the text inside"


Solution

  • The aspect option allows you to change the ratio of height and width of the diamond shape.

    \documentclass{article}
    \usepackage{tikz}
    \usetikzlibrary{shapes.geometric}
    
    \begin{document}
    \begin{tikzpicture}
        \node [draw, diamond, aspect=2] at(0,0){Decision};
        \node [draw, diamond, aspect=1] at(3,0){Decision};
    \end{tikzpicture}
    
    \end{document}
    
    

    The left one (with aspect=2) is probably the one you are looking for, the right one is with the standard setting:
    enter image description here