I wish to reproduce an object by drawing with tikz
. My concept is measuring the coordinates of a raster image then reproduce the image with tikz
\draw
. Finally I wish replace absolute unit (cm or pt or etc) with a scale factor and integrate the object into a macro.
My MWE:
\documentclass{memoir}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,positioning,calc,patterns}
\usepackage{tikzpagenodes}
\usepackage{calc}
\newcommand{\fsymbolI}[5]{%
\def\aII{0.013797449*#1 }
\begin{tikzpicture}[rotate=#4,overlay, remember picture, -latex]%
\node[shift={(#2,#3)}] at (current page.north west){%
\begin{tikzpicture}[rotate=180,overlay, remember picture]%
\begin{scope}[xshift=-11.7cm,yshift=1.1cm]%
\draw[#5,-] (6.4cm,15cm) -- (6.4cm,15.6cm) -- (11.6cm,11.8cm) -- (11.6cm,4.1cm) arc (0:-90:5.1cm) -- (6.4cm,4.1cm) -- (6.4*\aII,8.6*\aII) arc (270:360: 3.6cm and 2.1cm) -- cycle ;%
\draw[#5,-] (5.8cm,10.7cm) ellipse (1.05cm and 0.85cm);
\end{scope}%
\end{tikzpicture}%
};%
\end{tikzpicture}%
}
\begin{document}
\fsymbolI{1cm}{0mm}{0mm}{0}{green}
\end{document}
works fine. But:
My idea is replace all the 'cm' with '*\aII' (defined in the macro fsymbolI by \def\aII{0.013797449*#1 }
). Working fine except when I wish to change the 3rd param. of ellipse
. So
\draw[#5,-] (5.8*\aII,10.7*\aII) ellipse (1.05cm and 0.85*\aII);
works fine but
\draw[#5,-] (5.8*\aII,10.7*\aII) ellipse (1.05*\aII and 0.85*\aII);
causes an error:
! Package PGF Math Error: Unknown operator
a' or
an' (in '1.05*0.013797449*1cm and 0.85*0.013797449*1cm ').
I've added a white space in definition '\aII' but it didn't sole the problem.
Any help will be welcomed.