0

First a minimal working sample is as follows.

\documentclass{ctexbook}
\usepackage{mathspec}

\begin{document}

Some words.

\end{document}

Compiling the tex file as above by XeLaTeX on MacTeX 2024 (the latest version), it will produce the error as follows.

Unknown option '\eu@zf@math' for package fontspec. ...Package[\eu@zf@math]{fontspec}[2008/08/09]

Then how to eliminate the error?

M. Logic
  • 4,214
  • 2
    I get errors with each tested version of TeX Live, that is, from 2015 to 2024. – egreg Mar 17 '24 at 23:08
  • Annoying error, I'd say, but innocuous. Anyway, I'd also recommend to avoid mathspec, because it does damages to fontspec – egreg Mar 17 '24 at 23:25
  • @egreg I get errors only from 2024. I found that fontspec was updated on 13th Feb., 2024. So the error may be related to it. – M. Logic Mar 18 '24 at 07:18
  • 1
    No, also with TL 2023 I get an error (albeit different). Where's the problem? It lies in the combination with ctexbook and mathspec. By the way, mathspec does “patch” fontspec and it's quite likely that updates to the latter can break the former. – egreg Mar 18 '24 at 08:19
  • @egreg Is there anyway to solve it? – M. Logic Mar 18 '24 at 10:48

1 Answers1

1

The mathspec package has problems with ctexbook. But it also has problems with fontspec because it patches it in possibly dangerous ways.

You can do the following at your own risk.

\PassOptionsToPackage{no-math}{fontspec}
\documentclass{ctexbook}

%%%% Fix the error \ExplSyntaxOn \NewCommandCopy{\kernelRequirePackage}{\RequirePackage} \RenewDocumentCommand{\RequirePackage}{O{}mo} { \str_if_eq:nnF { #2 } { fontspec } { \IfNoValueTF{#3}{\kernelRequirePackage[#1]{#2}}{\kernelRequirePackage[#1]{#2}[#3]} } } \ExplSyntaxOff \usepackage{mathspec} \RenewCommandCopy{\RequirePackage}{\kernelRequirePackage} %%%

\begin{document}

Some words.

\end{document}

Explanation: ctexbook already loads fontspec so I disable mathspec trying to load it (where the error happens) and pass it the no-math option at the beginning.

I see no real reason to use mathspec nowadays.

egreg
  • 1,121,712