I have a trapezium node in TikZ that I would like to maintain consistent dimensions no matter how many times it is called in the \tikzpicture
.
\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\tikzstyle{object} = [draw, trapezium, trapezium left angle=70, trapezium right angle=-70, minimum width=3cm, minimum height=1cm, text centered, draw=black]
\begin{document}
\begin{tikzpicture}[node distance=2cm]
\node(n1)[object]{a};
\node(n2)[object, right of=n1, xshift=1cm]{ab};
\node(n3)[object, right of=n2, xshift=1cm]{abc};
\end{tikzpicture}
\end{document}
Setting the minimum height and width seems to be the go-to for a lot of questions related to this topic but it has unexpected results on my end.
The trapeziums are of different dimensions from each other and seem to grow in height the less character it has inside of them. Why does the node keep getting taller with fewer characters? What is it trying to accommodate? I would expect to get taller to house more texts by trying to keep the width constant.
% Same as before
\tikzstyle{object} = [draw, trapezium, trapezium left angle=70, trapezium right angle=-70, text width=3cm, text height=1cm, text centered, draw=black]
% Same as before
Using text height
and text width
instead of the minimum
variants has the text off-center even after using text centered
. Using both of them simultaneously results in the same image.
I have also tried setting inner sep
to various values but that does not work as well. Any solution is appreciated.
text depth=<value>
, where value is a length established by trial to put the content of the node where you want.text depth
changes the trapezium size in the second attempt and does not work for the first attempt.trapezium stretches=false
does not stop the trapezium from stretching like I have hoped it would.