![参考文献中的数学符号导致 xr-hyper 崩溃](https://linux22.com/image/475000/%E5%8F%82%E8%80%83%E6%96%87%E7%8C%AE%E4%B8%AD%E7%9A%84%E6%95%B0%E5%AD%A6%E7%AC%A6%E5%8F%B7%E5%AF%BC%E8%87%B4%20xr-hyper%20%E5%B4%A9%E6%BA%83.png)
我想使用 排版来自外部文档的交叉引用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
会导致错误。(或者我错了?)