Presence of 'pgfplots' package breaks 'forest' environment w/ 'folder' option enabled (due to FPU)

For a very crude temporary hack, you can redirect the meaning of Mod to mod and accept the risk of getting a negative number out of mod

Hence add

\let\pgfmathMod=\pgfmathmod\relax

But if I could find where to uninstall the fpu version of Mod, I guess adding this would fix that issue. That requires a fpu library change though.

\def\pgfmathfloatMod@#1#2{%
    \begingroup%
    \pgfmathfloatmod@{#1}{#2}%
    \let\pgfmathfloat@loc@TMPa=\pgfmathresult%
    \pgfmathfloatifflags{\pgfmathresult}{-}{\pgfmathfloatadd@{\pgfmathfloat@loc@TMPa}{#2}%
    \pgfmath@smuggleone\pgfmathresult%
    \endgroup%
}

However, Christian Feuersänger is the one that can resolve this.


The root cause is an old bug in the FPU library: it fails to uninstall those commands for which it comes with an error message "this is not implemented".

The problem became apparent with the latest stable of pgfplots which calls "activate fpu ... deactivate fpu" at global scope -- and the deactivation fails.

I will take care of it.

A workaround for the problem at hand is

\documentclass{standalone}

% NOTE: [edges] option required to enable 'folder' option in
% 'forest' environment below.
\usepackage[edges]{forest}%

\makeatletter
\let\pgfmathModX=\pgfmathMod@
\usepackage{pgfplots}%
\let\pgfmathMod@=\pgfmathModX
\makeatother

\begin{document}

\begin{forest}%
  for tree={folder}% NOTE: Problem only occurs with this option enabled
  [foo%
    [bla]%
    [moo]%
  ]%
\end{forest}%

\end{document}

Note that this affects the following operations:

isprime iseven gcd frac random setseed Mod div real