I wanted to do this:
Crop jpeg into circular tikz node
but write with a variable width:
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\def\mywidth{2cm}
\tikz\node[circle,draw,minimum size=1.2*\mywidth
text=white,
path picture={
\node at (path picture bounding box.center){
\includegraphics[width=1.2\mywidth]{frog}
};
}]{I'm watching you!};
\end{document}
Why does this not work? The includegraphics command does not display the image in 1.2\mywidth but some arbitrary size. The circle is the right size.
Second examples
Code 1
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\def\firstwidth{1cm}
\def\secondwidth{2\firstwidth}
\tikz\node[circle,draw,minimum size=\firstwidth,
path picture={
\node at (path picture bounding box.center){
\includegraphics[width=\firstwidth]{blackbox.png}
};
}]{};
\end{document}
Result 1
Code 2
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\def\firstwidth{1cm}
\def\secondwidth{2\firstwidth}
\tikz\node[circle,draw,minimum size=\firstwidth,
path picture={
\node at (path picture bounding box.center){
\includegraphics[width=0.5\secondwidth]{blackbox.png}
};
}]{};
\end{document}



\definstead of\dev? – percusse Dec 02 '15 at 19:40*sign? – percusse Dec 02 '15 at 19:56minimum size=\mywidthand\includegraphics[width=4.4\mywidth]{...}. For test I useexample-imagefromgraphicxpackage. – Zarko Dec 02 '15 at 20:37\def\mywidth{2cm}try to use\newlength\mywidth \setlength\mywidth{2cm}and similarly at other lengths. This work fine at me. – Zarko Dec 02 '15 at 21:26