[Tex/LaTex] Drawing parallelogram with fixed angle, width and height

nodestikz-pgf

I want to draw parallelograms with fixed angle, width and height, but it seems that trapezium in PGF/TikZ cannot specific the height without changing angles.

\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[trapezium, draw, minimum width=3cm,
trapezium left angle=120, trapezium right angle=60]

\node[trapezium stretches body]
    at (0,0) {A};

\node[trapezium stretches body, rotate=-30]
    at (0,1.5) {A rotate $-30^\circ$};

\node[minimum height=1cm, trapezium stretches body]
    at (5,0) {B};

\node[minimum height=1cm, trapezium stretches body, rotate=-30]
    at (5,1.8) {B rotate $-30^\circ$};

\node[minimum height=1cm]
    at (0,-2) {C};

\node[minimum height=1cm, rotate=-30]
    at (0,-4) {C rotate $-30^\circ$};

\node[minimum height=1cm, trapezium stretches]
    at (5,-2) {D};

\node[minimum height=1cm, trapezium stretches, rotate=-30]
    at (5,-4) {D rotate $-30^\circ$};

\end{tikzpicture}
\end{document}

The output:enter image description here

I want a vertically fat version of A with the same width.

A and B have different angles, just adding "minimum height".
Rotated version of A has vertical west/east sides, that's what I need.
Rotated version of B does not have vertical west/east sides, however, I do need a "higher" parallelogram with the same angles and width as A.

C: Removing "trapezium stretches body" results in a parallelogram whose width and height out of control.
D: Replacing "trapezium stretches body" with "trapezium stretches" helps nothing.

Best Answer

Maybe the following can explain better what is happening. The strange thing happening when the text is getting shorter and the node is getting higher and getting shorter as the text gets longer is due to the constraints being respected.

\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}
\tikzstyle{every node}=[trapezium, draw, minimum width=3cm,
trapezium left angle=120, trapezium right angle=60]

\node[trapezium stretches=false,minimum height=1cm]
    at (0,0) {A};

\node[trapezium stretches=false,minimum height=1cm]
    at (0,1.5) {\fbox{A long }};

\node[trapezium stretches=false,minimum height=1cm]
    at (0,3) {\fbox{A long text}};

\draw[thick,green,|-|] (-1.5,-.5) -- (1.5,-0.5);
\draw[thick,green,|-|] (-1.5,0.5) -- (-1.5,-0.5);

\draw[thick,blue,|-|] (-1.5,1) -- (1.5,1);
\draw[thick,blue,|-|] (-1.5,1) -- (-1.5,2);

\draw[thick,red,|-|] (-1.5,2.5) -- (1.5,2.5);
\draw[thick,red,|-|] (-1.5,2.5) -- (-1.5,3.5);

\end{tikzpicture}
\end{document}

without the body stretch

We see that the minimum width and minimum height is respected and then if there is any room then the node is getting higher because there is no constraint for that. In other words there is only constraint on the minima not maxima hence in the bottom example minima is respected and then the angles are tried to match. If the node is shorter and the angles are fixed then minimum height won't be respected etc. Hence for this there are some options are proposed namely the stretch options. If we turn all the false keys to true, we get

enter image description here

So the angel of the shape is deformed to comply with the constraints. Similarly the trapezium stretches body key only stretches the width. But if the angle is set then it's a matter of respecting the constraints and then checking if the angle is feasible. So a different type of constraint is needed. This might be using labels at the center anchor or drawing it on top of the nodes regardless of the size etc.