From 00f4e8d4154dcb3133ed4a106b6254b8faf874e2 Mon Sep 17 00:00:00 2001 From: Henri Menke Date: Sun, 27 Jan 2019 22:42:08 +1300 Subject: [PATCH] Ignore spaces in #3 of \pgfmathdeclarefunction #509 --- tex/generic/pgf/math/pgfmathfunctions.code.tex | 11 +++++++++-- .../math/pgfmathfunctions.integerarithmetics.code.tex | 8 ++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tex/generic/pgf/math/pgfmathfunctions.code.tex b/tex/generic/pgf/math/pgfmathfunctions.code.tex index 7047a2d64..292c35050 100644 --- a/tex/generic/pgf/math/pgfmathfunctions.code.tex +++ b/tex/generic/pgf/math/pgfmathfunctions.code.tex @@ -15,12 +15,13 @@ % % Use \pgfmathdeclarefunction* to force a redefinition if the function exists already. \def\pgfmathdeclarefunction{\pgfmath@ifnextchar*\pgfmathdeclarefunction@force\pgfmathdeclarefunction@check} -\def\pgfmathdeclarefunction@check#1#2#3{% +\def\pgfmathdeclarefunction@check#1{% \expandafter\ifx\csname pgfmath@function@#1\endcsname\relax% - \pgfmath@declarefunction{#1}{#2}{#3}% + \def\pgf@marshal{\pgfmath@declarefunction{#1}}% \else% \pgfmath@error{The function `#1' already exists}{}% \fi% + \pgf@marshal% } \def\pgfmathdeclarefunction@force*{\pgfmath@declarefunction}% @@ -53,6 +54,11 @@ {\expandafter\noexpand\csname pgfmath#1@\endcsname}% {\csname pgfmath@operation@#1@arity\endcsname}% }% + \begingroup% + \catcode`\^^I=9\relax% + \catcode`\ =9\relax% + \catcode`\~=10\relax% + \endlinechar=`\ \relax \pgfmath@marshal% } @@ -62,6 +68,7 @@ % #4 - code for function . % \def\pgfmath@@declarefunction#1#2#3#4{% Function of arity 0 - 9. + \endgroup% \ifcase#3\relax% \def#1{#2}% \def#2{#4}% diff --git a/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex b/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex index 072b75c5c..ab8f4e6d3 100644 --- a/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex +++ b/tex/generic/pgf/math/pgfmathfunctions.integerarithmetics.code.tex @@ -11,18 +11,18 @@ \pgfmathcontinuelooptrue \pgfmath@xa=#1pt \pgfmath@xb=#2pt - \ifdim\pgfmath@xa=0pt + \ifdim\pgfmath@xa=0pt\relax \pgfmathcontinueloopfalse \pgfmath@xa=\pgfmath@xb \fi - \ifdim\pgfmath@xb=0pt + \ifdim\pgfmath@xb=0pt\relax \pgfmathcontinueloopfalse \pgfmath@xb=\pgfmath@xa \fi - \ifdim\pgfmath@xa<0pt + \ifdim\pgfmath@xa<0pt\relax \pgfmath@xa=-\pgfmath@xa \fi - \ifdim\pgfmath@xb<0pt + \ifdim\pgfmath@xb<0pt\relax \pgfmath@xb=-\pgfmath@xb \fi \loop