Let us assume that we have a JPEG file of mushrooms given in the following link: mushroom Regarding how to put a rounded node at a certain position I appreciate the complete answer of frougon in the link, frougon. frougon also used simple \getxlength and \getylength macros to allow easy storing of the current lengths of the /tikz/x and /tikz/y vectors, expressed in points. On the meaning of \the and \pgf@xx in \edef#1{\the\pgf@xx}, I searched in Tikz manual and could not find anything. My Question:
- What is the meaning of \the and \pgf@xx in \edef#1{\the\pgf@xx}
- In which CTAN package we can find the explanation of \the and \pgf@xx in \edef#1{\the\pgf@xx}?
Below is the code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc, shapes.misc}
\newcommand{\midfont}{\fontsize{15}{18}\usefont{T1}{lmss}{m}{n}}
\makeatletter
% These assume that the /tikz/x vector is “horizontal” and /tikz/y “vertical”.
\newcommand*{\getxlength}[1]{\edef#1{\the\pgf@xx}}
\newcommand*{\getylength}[1]{\edef#1{\the\pgf@yy}}
\makeatother
\begin{document}
\centering
\begin{tikzpicture}
\node[anchor=south west, inner sep=0] (image) at (0,0)
{\includegraphics[width=0.9\textwidth]{mushrooms.jpg}};
\begin{scope}[x={(image.south east)}, y={(image.north west)}]
\draw[help lines, xstep=.1, ystep=.1] (0,0) grid (1,1);
\foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10, 0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0, \y/10) {0.\y}; }
% Get the unit vector lengths in points
\getxlength{\xLen} \getylength{\yLen}
\node[draw, red, line width=1pt, shape=rounded rectangle, inner sep=0,
minimum width=0.2*\xLen, minimum height=0.2*\yLen]
at (.5,.5) (rect) {};
\node[red, font=\midfont] at (0.5-0.2, 0.5+0.2) (text) {Center is here};
\draw[line width=1pt, red, ->] (text) -- (rect);
\end{scope}
\end{tikzpicture}
\end{document}