I am desperately trying to draw two boxes, with some right aligned text which should eventually resemble a progress bar. My problem is that there is some space between the outer and the inner rectangle which I cannot get rid of. If I set the minimum height large enough the box align at least vertically. That is my minimum height (width) is too small. Ideally I want to set the height such that the text fits with the default inner sep
and the width should be \dimexpr.7\linewidth\relax
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{xcolor}
\pagecolor{black!10} %% just to see the gap a bit better
\newlength{\mywidth}
\newlength{\myheight}
\begin{document}
\setlength{\mywidth}{\dimexpr.5\linewidth\relax}
\setlength{\myheight}{\baselineskip}
\begin{tikzpicture}
\node[fill=yellow!30,
minimum width=\dimexpr\mywidth+\pgfkeysvalueof{/pgf/inner xsep}\relax,
minimum height=\myheight] (inner){};
\node[draw=blue,
very thick,
minimum width=\mywidth,
text width=\mywidth,
minimum height=\myheight,
anchor=west,
align=right] (main) at (inner.west) {\hfill TEXTy};
\end{tikzpicture}
\setlength{\myheight}{5cm}
\begin{tikzpicture}
\node[fill=yellow!30,
minimum width=\mywidth,
minimum height=\myheight] (inner){};
\node[draw=blue,
very thick,
minimum width=\mywidth,
text width=\mywidth,
minimum height=\myheight,
anchor=west,
align=right] (main) at (inner.west) {\hfill TEXT};
\end{tikzpicture}
\par
\end{document}