summaryrefslogtreecommitdiff
path: root/graphics/pgf/base/tex/pgfmathparser.code.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-09-29 03:02:54 +0000
committerNorbert Preining <norbert@preining.info>2020-09-29 03:02:54 +0000
commitd043a18e288914d3c46a1b10af1f30ce2df00588 (patch)
tree888d8c0677d7b328602f1ec5c09d324a325043ec /graphics/pgf/base/tex/pgfmathparser.code.tex
parent34310603e5253ef5742542e3f0123b341a70ee20 (diff)
CTAN sync 202009290302
Diffstat (limited to 'graphics/pgf/base/tex/pgfmathparser.code.tex')
-rw-r--r--graphics/pgf/base/tex/pgfmathparser.code.tex22
1 files changed, 21 insertions, 1 deletions
diff --git a/graphics/pgf/base/tex/pgfmathparser.code.tex b/graphics/pgf/base/tex/pgfmathparser.code.tex
index e50dfd615e..439e62e437 100644
--- a/graphics/pgf/base/tex/pgfmathparser.code.tex
+++ b/graphics/pgf/base/tex/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}}%