This question is inspired by Jake's answer to this question. The problem is illustrated by this MWE:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\def\ri{1.0cm} % define inner diameter
\def\ro{2.0cm} % define outer diameter
\begin{tikzpicture}
\pgfmathsetmacro{\dr}{\ro-\ri} % compute width
\pgfmathsetmacro{\rm}{(\ri+\ro)/2} % compute mean diameter
\draw[red,line width=\dr] (0:\ro) arc (0:360:\ro);
\draw[black] (0,0) circle (\ro) circle (\ri);
\end{tikzpicture}
\end{document}
This produces the following output:
But this is not what I want, which is that the red strip should be between the two black circles. I expected that I could achieve this by replacing the first \draw command by
\draw[red,line width=\dr] (0:\rm) arc (0:360:\rm);
but then I get a non-sensical result in which the red strip is far too large:
This is not surprising given the remarks in Section 94.1.2 "Considerations concerning units" in the pgf manual (v3.1.2). What does surprise me is that simply adding cm like this
\draw[red,line width=\dr] (0:\rm cm) arc (0:360:\rm cm);
does not work - in the sense that there is no change in the output. However, in Jake's answer, he adds pt which seems to work (as witnessed by his comment Somehow, the [...] units got lost, so we add 'pt' at the end. Not nice...).
So my questions are:
- Why does adding
ptwork in Jake's answer but not when I addcm? - I cannot make sense of Section 94.1.2. There seem to be commands for checking whether units are "declared" but there do not seem to be any commands for "adding them back" to a result. What good is it to be able to check for units but not "adding them back"?



