36

I'm trying to find a way to tame decision nodes (diamond shape) but I just can't do a thing! If I put a formula inside the diamond and if that formula is a little big the shape just grows like a square and becomes to high.

I want the decision node to look like this

http://sixsigmaspc.com/protectedimages/blockdiagram-flowchart-symbols.gif

and not like this:

enter image description here

\documentclass{article}
\usepackage{amsmath,tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\tikzstyle{decision} = [diamond, draw, text badly centered, inner sep=3pt]

\begin{tikzpicture}
    \node [decision] {$\lVert f(\mathbf{x}^{0}) \rVert < \varepsilon_{g}$};
\end{tikzpicture}
\end{document}
4
  • 1
    Please provide a minimal example that is compilable as provided. Apr 28, 2011 at 16:27
  • See aspect ratio at page 177 of pgfmanual
    – Azoun
    Apr 28, 2011 at 16:34
  • 1
    The key is named shape aspect (or just aspect), not aspect ratio.
    – Caramdir
    Apr 28, 2011 at 16:39
  • 5
    link is now broken..
    – Georges
    Jul 8, 2016 at 4:58

1 Answer 1

58

There is an aspect option for the diamond shape, which sets the target ration of the height and width. By default it is one. See section 48.3 “Geometric Shapes” in the manual (v2.10).

\documentclass{article}
\usepackage{amsmath,tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{tikzpicture}
    \node [draw, diamond, aspect=2] {$\lVert f(\mathbf{x}^{0}) \rVert < \varepsilon_{g}$};
\end{tikzpicture}
\end{document}

result

You must log in to answer this question.

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