From cec3cd6acbd30a118c9547d06262db63e58309d3 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Wed, 16 Mar 2016 08:44:11 +0900 Subject: [PATCH] fix "Command `\colon' already defined" error when fontspec is loaded without no-math option --- src/patches/lltjp-fontspec.sty | 42 ++++++++++++++++++++++++++++++++++++++++++ src/patches/lltjp-xunicode.sty | 1 + 2 files changed, 43 insertions(+) diff --git a/src/patches/lltjp-fontspec.sty b/src/patches/lltjp-fontspec.sty index 4ba873b..d98ff2f 100644 --- a/src/patches/lltjp-fontspec.sty +++ b/src/patches/lltjp-fontspec.sty @@ -23,5 +23,47 @@ \@ifstar\__fontspecsverb\@verb } + +\cs_set_eq:NN \ltj_orig_fontspec_setup_maths: \fontspec_setup_maths: +\cs_set:Nn \fontspec_setup_maths: + { + \group_begin: + \cs_set:Npn \DeclareMathSymbol##1##2##3##4{% + \expandafter\in@\csname sym##3\expandafter\endcsname + \expandafter{\group@list}% + \ifin@ + \begingroup + \count\z@=##4\relax + \count\tw@\count\z@ + \divide\count\z@\sixt@@n + \count@\count\z@ + \multiply\count@\sixt@@n + \advance\count\tw@-\count@ + \if\relax\noexpand##1% is command? + \edef\reserved@a{\noexpand\in@{\string\mathchar}{\meaning##1}}% + \reserved@a + \ifin@ + \expandafter\set@mathsymbol + \csname sym##3\endcsname##1##2% + {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% + \@font@info{Redeclaring math symbol \string##1}% + \else + \expandafter\set@mathsymbol + \csname sym##3\endcsname##1##2% + {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% + \fi + \else + \expandafter\set@mathchar + \csname sym##3\endcsname##1##2 + {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% + \fi + \endgroup + \else + \@latex@error{Symbol font `##3' is not defined}\@eha + \fi + } + \ltj_orig_fontspec_setup_maths: + \group_end: + } \ExplSyntaxOff \endinput diff --git a/src/patches/lltjp-xunicode.sty b/src/patches/lltjp-xunicode.sty index 21ce7c9..bff08c3 100644 --- a/src/patches/lltjp-xunicode.sty +++ b/src/patches/lltjp-xunicode.sty @@ -79,6 +79,7 @@ % Therefore temporarily set \hbar=\relax. \let\ltj@tmpa\hbar \let\hbar\relax + \let\ltj@tmpb\iftipaonetoken \let\iftipaonetoken\relax \typeout{UTFencname: \UTFencname} -- 2.11.0