summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-09-28 20:57:36 +0000
committerKarl Berry <karl@freefriends.org>2020-09-28 20:57:36 +0000
commite752903a9ad1c74190305384230882402822846a (patch)
tree8d60a64b66091d1c8e34e5af76d413268603b25d /Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
parentc452dea4584e1a0650f1ba1f87262a85b511057c (diff)
pgf (28sep20)
git-svn-id: svn://tug.org/texlive/trunk@56462 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex')
-rw-r--r--Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex22
1 files changed, 21 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
index e50dfd615e3..439e62e4370 100644
--- a/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
+++ b/Master/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex
@@ -235,6 +235,16 @@
\pgfmath@tokens@make{dimexpr}{\dimexpr\glueexpr}
\fi
\pgfmath@tokens@make{unit}{{bp}{cc}{cm}{dd}{em}{ex}{in}{mm}{pc}{pt}{sp}}
+\ifx\pdftexversion\@undefined\else % for pdfTeX
+ \pgfmath@tokens@make{unit}{{nc}{nd}{px}}
+\fi
+\ifx\directlua\@undefined\else % for LuaTeX
+ \pgfmath@tokens@make{unit}{{nc}{nd}{px}}
+\fi
+\ifx\kanjiskip\@undefined\else % for pTeX, upTeX
+ \pgfmath@tokens@make{unit}{{H}{Q}{zh}{zw}}
+\fi
+%
\pgfmath@tokens@make{mathunit}{{mu}}
\pgfmath@tokens@make{numeric}{.0123456789}
\pgfmath@tokens@make{number}{0123456789}
@@ -460,7 +470,10 @@
\else%
\expandafter\ifx\csname pgfmath@token@numeric@\expandafter\string\pgfmath@token\endcsname\relax%
% It isn't numeric (i.e., 012345679.), so it might be units...
+ % first double-character units...
\expandafter\ifx\csname pgfmath@token@unit@\pgfmath@token\expandafter\string\pgfmath@token@next\endcsname\relax%
+ % then single-character units...
+ \expandafter\ifx\csname pgfmath@token@unit@\pgfmath@token\endcsname\relax%
% ...or the exponent characters...
\expandafter\ifx\csname pgfmath@token@exponent@\pgfmath@token\endcsname\relax%
% ...or a base prefix...
@@ -498,7 +511,14 @@
\else% ... and here, it is the exponent characters.
\let\pgfmath@parse@next=\pgfmath@parse@exponent%
\fi%
- \else% ...but here it is units.
+ \else% ...but here it is single-character units.
+ \global\pgfmathunitsdeclaredtrue%
+ \pgfmath@dimen=\pgfmath@number\pgfmath@token\relax%
+ \edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@dimen}}%
+ \expandafter\pgfmath@stack@push@operand\expandafter{\pgfmathresult}%
+ \let\pgfmath@parse@next=\pgfmath@parse@@operator%
+ \fi%
+ \else% ...but here it is double-character units.
\global\pgfmathunitsdeclaredtrue%
\pgfmath@dimen=\pgfmath@number\pgfmath@token\pgfmath@token@next\relax%
\edef\pgfmathresult{\pgfmath@tonumber{\pgfmath@dimen}}%