Open xiehao opened 4 years ago
The theme defines internally a font \x for testing purpose, and the math library chokes on it. But imho this is a tikz problem: https://github.com/pgf-tikz/pgf/issues/847
I agree that this is a bug in PGF, but I'd also argue that using public names like \x
for internal testing macros is really bad practice. Surely there will be more packages and user macros where this breaks.
Related source lines are https://github.com/matze/mtheme/blob/3e1381f83c8ea64fbb6a7db9643849fbce3d3ee6/doc/metropolistheme.dtx#L30-L38
A quick workaround is to un-defefine \x
after theme metropolis
is loaded:
\documentclass{beamer}
\usetheme{metropolis}
\usepackage{tikz}
\usetikzlibrary{math}
\usepackage{pgfplots}
% \undef is defined in etoolbox package, which is loaded by beamer
\undef\x
\begin{document}
...
\end{document}
The following MWE shows this case:
As shown in the comment, the function declared by
evaluate
(say, functionf
) cannot pass and shows errors; while the function declared bydeclare function
(say, functiong
) works fine.The error output:
Once the line using
metropolis
theme (line 2) is commented, it works fine.