3

If I change minimum height=... of a trapezium node, also the width changes.

It doesn't happen with standard rectangle nodes.

\documentclass[border=0pt]{standalone}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning, shapes.geometric, shapes.misc, matrix}
\begin{document}
\begin{tikzpicture}[
    basenode/.style={
        draw=lightgray, align=center,
        text=black, very thick, 
        text height=1.75ex, text depth=.25ex,
        text width=7em, 
    },
    inout/.style={
        basenode,
        minimum height=5ex,
        trapezium,
        trapezium left angle=60, 
        trapezium right angle=120,
    },
    inout2/.style={
        basenode,
        minimum height=7ex,
        trapezium,
        trapezium left angle=60, 
        trapezium right angle=120,
    },
    instruction/.style={
        basenode,  
        minimum height=5ex,
        rounded corners,
    },
    instruction2/.style={
        basenode,  
        minimum height=7ex,
        rounded corners,    
    },
]
\matrix[
    matrix of nodes, row sep=7ex, column sep=7em,
    anchor=base
    ]{
    |[inout]|\texttt{trapezium} & with \texttt{minimum height=5ex}\\
    |[inout2]|\texttt{trapezium} & with \texttt{minimum height=7ex}\\
    |[instruction]|\texttt{rectangle} & with \texttt{minimum height=5ex}\\
    |[instruction2]|\texttt{rectangle} & with \texttt{minimum height=7ex}\\
};
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    see, what happen if you to trapezium parameters add trapezium stretches. (see manual, page 697). – Zarko Jan 12 '18 at 22:48
  • @Zarko Works perfectly, thank you! If you would like to add an answer I'll accept it. – CarLaTeX Jan 12 '18 at 22:51
3

this is known issues. in tikz & pgf manual you can find on page 697 the folowing:

/pgf/trapezium stretches=boolean (default true)

This key controls whether pgf allows the width and the height of the trapezium to be enlarged independently, when considering any minimum size specification. This is initially false, ensuring that the shape “looks the same but bigger” when enlarged.

By setting hbooleani to true, the trapezium can be stretched horizontally or vertically.

an example from there:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{tikzpicture}[
my node/.style={trapezium, fill=#1!20, draw=#1!75, text=black},
trapezium stretches=true % <---
                    ]
\draw [help lines] grid (3,2);
\node [my node=red] {A};
\node [my node=green, minimum height=1.5cm] at (1, 1.25) {B};
\node [my node=blue, minimum width=1.5cm] at (2, 0) {C};
\end{tikzpicture}
\end{document}

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.