What happened?
When TikZ processes a label
it needs to find the appropriate point on the border of the labeled node. A direction of left
sets the anchor to the angle of 180
. Later down in this process the macro \pgf@sh@reanchor
is used to find the actual coordinates of this point on the border.
This macro first checks if 180
is a named anchor for this shape (like north west
or base
), if it isn’t it is checked whether the anchor is a generic one. If it isn’t even a generic anchor it only can be a angular point on the border. 180
is then evaluated by \pgfmathsetcounter
). The result is stored in the count register \c@pgf@counta
(i.e. the LaTeX counter pgf@counta
).
\c@pgf@counta
is then directly used on \pgfqpointpolar
. The q
denotes a “quick” version of the \pgfpointplar
macro which (the q
uick version that is) does not parse its arguments but directly sends them to the the trigonometric functions. Usually this parsing and evaluating is done by PGF math which automatically detects registers like counts/counters, dimens and lengths/skips and properly expands them to their value (stripping away any units).
But the fixedpointarithmetic
library and its option directly maps these trigonometric functions to their fp
counterparts. fp
does not tolerate registers.
A bug?
I consider this a bug in the definition of \pgf@sh@reanchor
as seemingly every other use of \pgfqpointpolar
of PGF uses directly numbers or content that expands to a number.
How to fix it?
A simple fix using the etoolbox
package is:
\usepackage{etoolbox}
% You should have loaded tikz before this line!
\patchcmd\pgf@sh@reanchor{\c@pgf@counta}{\the\c@pgf@counta}{}{}
This also fixes the direct use of angular anchors as in (keeping with your example):
\node at (P.90) {}; % or
\node[anchor=270] {};
west
instead of left
For circular unrotated nodes you can actually use the compass anchors without a problem as they map directly to the directions. So instead of left
you can use west
. This will trigger the named anchors and avoids \pgfqpointpolar
.
This usually does not work for other shapes, at least for the diagonal directions, as can be seen in the second TikZ picture.
Or you don’t use fixed point arithmetic
for labels.
Of course, for this little task the fp
package and its precision are not needed, so if you can avoid it, use fixed point arithmetic
only on paths where you actually need it, say
\path[fixed point arithmetic] let <fancy calculations> in …;
If needed, you can construct a short-cut to that long option, say:
\tikzset{fp/.style={fixed point arithmetic={#1}},fp/.default=}
Code
\documentclass[convert = false, tikz]{standalone}
\usepackage{fp}
\usetikzlibrary{fixedpointarithmetic}
\usepackage{etoolbox}
\makeatletter
\patchcmd\pgf@sh@reanchor{\c@pgf@counta}{\the\c@pgf@counta}{}{}
\makeatother
\begin{document}
\begin{tikzpicture}[fixed point arithmetic,
every label/.append style = {font = \scriptsize},
dot/.style = {inner sep = +0pt, shape = circle,
draw = black, label = {#1}},
small dot/.style = {minimum size = .05cm, dot = {#1}},
big dot/.style = {minimum size = .1cm, dot = {#1}},
]
\node[font = \scriptsize, small dot = {left: \(1\)}] (P) at (203.16381:3cm)
{};
\end{tikzpicture}
\begin{tikzpicture}
\node[fill,minimum width=1cm,label = {[red]north west:nw}, label = {[green]above left:al}, label=north:n] (a){};
\foreach \sty/\an in {white/north, green/135, red/north west}\path[draw=\sty,fill=black] (a.\an) circle [radius=.8pt];
\end{tikzpicture}
\end{document}
Output


fp
? On the labeled node path? Thelabel
key does some computations that are apparently forwarded tofp
. You can move thefixed point arithmetic
as an option to a path, i.e.\path[fixed point arithmetic] <fancy calculations>;
, and don't use it on a node/a label. – Qrrbrbirlbel Jul 24 '13 at 20:06draw let ... in
but shouldn't this not have a problem with a node? I would think it should know where calculations occur. – dustin Jul 24 '13 at 20:08fixed point arithmetic
replaced all (?) PGF math functions with theirfp
counterparts (as a wrapper around the\FP…
macros). Thelabel
key accesses the angular border of the node (it needs to know where to place the label). This uses thecos
andsin
functions (this is the reason you get the error message twice). The angle is calculated and result is stored in\c@pgf@counta
. This\c@pgf@counta
will be passed through the trigonometric functions tofp
which doesn't like that. If you needfp
only on thelet … in
part, use it only there. – Qrrbrbirlbel Jul 24 '13 at 21:14\coordinate (x) at (1, 0); \draw (0, 0) -- (x) node[above] {x};
– dustin Jul 24 '13 at 23:30above
which setsanchor=south
doesn’t need to calculate a polar coordinate. Usinganchor=270
(even though the result is the same) triggers the error. For labels on circular unrotated nodes you can use the anchors instead of the compass directions, e.g.north
instead ofabove
(the default direction that is set withlabel position
),north west
instead ofabove left
. – Qrrbrbirlbel Jul 25 '13 at 0:01