我想使用 排版来自外部文档的交叉引用xr-hyper
。一旦外部文档中某些引用的文本中出现数学符号,就会引发错误。
以下是我最初得到的错误的 MWE 重现情况。
% FILE PREAMBLE.TEX
\usepackage{xr-hyper}
\usepackage{mathtools}
\usepackage[stixtwo]{fontsetup}
\usepackage{cleveref}
% FILE EXTERNAL.TEX
% !TeX TS-program = xelatex
\documentclass{article}
\input{preamble}
\begin{document}
Here's an equation:
\begin{equation} \label{my-equation}
0 = 1 \tag{$\Gamma$}
\end{equation}
\end{document}
% FILE MAIN.TEX
% !TeX TS-program = xelatex
\documentclass{article}
\input{preamble}
\externaldocument{external}
\begin{document}
Hello world, see \cref{my-equation}.
\end{document}
中的错误main.log
如下:
! Undefined control sequence.
<argument> {{$\mitGamma
$}}{1}
l.5
The control sequence at the end of the top line
of your error message was never \def'ed. (...)
! Undefined control sequence.
<argument> {[equation][2147483647][]{$\mitGamma
$}}{[1][1][]1}
l.5
The control sequence at the end of the top line
of your error message was never \def'ed. (...)
(./main.aux)
\openout1 = `main.aux'.
看起来好像xr-hyper
没看到unicode-math
已经加载(通过 fontsetup
)。我说得对吗?有什么解决办法吗?
答案1
\externadocument
我刚刚发现\begin{document}
可以解决问题,IE
% FILE MAIN.TEX
% !TeX TS-program = xelatex
\documentclass{article}
\input{preamble}
\begin{document}
\externaldocument{external}
Hello world, see \cref{my-equation}.
\end{document}
unicode-math
\mitGamma
似乎仅在 处定义\begin{document}
,因此从 之前导入引用external.aux
会导致错误。(或者我错了?)