Skip to content

Commit

Permalink
Ignore spaces in #3 of \pgfmathdeclarefunction #509
Browse files Browse the repository at this point in the history
  • Loading branch information
hmenke committed Jan 27, 2019
1 parent 9cd8465 commit 00f4e8d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions tex/generic/pgf/math/pgfmathfunctions.code.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}%

Expand Down Expand Up @@ -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%
}

Expand All @@ -62,6 +68,7 @@
% #4 - code for function <name>.
%
\def\pgfmath@@declarefunction#1#2#3#4{% Function of arity 0 - 9.
\endgroup%
\ifcase#3\relax%
\def#1{#2}%
\def#2{#4}%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 00f4e8d

Please sign in to comment.