I can use \widthof{text}
to fix a minimum width
of a TikZ's node. I would like to use \heightof{text}
to fix its minimum height
but it doesn't work.
I just want to fill my nodes with one word but I want to draw some empty nodes with same height as filled ones. But I would like not to use a trial and error system to fix it's size.
Next code shows what I want to do. I've tried uncommenting \usepackage{calc}
but nothing changed. .log
file doesn't show any error about knowing or not command \heightof
.
A possible solution would be to use \vphantom{text}
inside empty nodes, but I would like to know what's wrong with this one.
\documentclass[tikz,border=1mm]{standalone}
%\usepackage{calc}
\usetikzlibrary{positioning}
\tikzset{
box/.style={draw,%
minimum width=5mm,%
minimum height=\heightof{Cap},%
align=center},
}
\begin{document}
\begin{tikzpicture}[font=\small\sffamily]
\node[box] (h0) {Cap};
\foreach \i [remember=\i as \lastx (initially 0)] in {1,...,6}
\node[box,right= 0mm of h\lastx] (h\i) {};
\node[box,right=0mm of h\lastx] {cua};
\end{tikzpicture}
\end{document}
This is the result. You can see that minimum height
is not fixed with \heightof
. Why?
minimum height
(or add\depthof
to\heightof
). Usetext depth
andtext height
. For example:text height=1em,text depth=.2em
. – Paul Gaborit Oct 19 '12 at 9:52text height=\heightof{Cap}
andtext depth=\depthof{Cap}
I obtain equal height nodes, but whyminimum height=\heightof{Cap}
doesn't work? As you can see in my result empty nodes are shorter thanC
. – Ignasi Oct 19 '12 at 10:38minimum heigth
I must includeinner sep
in it for empty nodes. – Ignasi Oct 19 '12 at 11:08