我想在用 LuaLaTeX 处理的 LaTeX 文档中使用练习包。在这种情况下,我遇到了问题,即问题的编号和格式无法正确工作。
我如何使用这两个包,即如何调试和修复这种不兼容性?
我将这个问题简化为MWE,如下所示:
\documentclass{book}
\usepackage{amsmath}
\usepackage[lastexercise,answerdelayed]{exercise}
\usepackage{polyglossia}
\setmainlanguage{english}
\usepackage{unicode-math}% Incompatible with exercise package
\usepackage{fontspec}% I want to select a different font
\setmainfont{Linux Libertine O}
\setmathfont{Tex Gyre Pagella Math}% this requires unicode-math
\begin{document}
\chapter{List of problems}
\begin{ExerciseList}
\Exercise Prove Bernoulli's inequality
\[
(1+x)^n \geq 1+nx, \text{ for } x\geq -1 \text{ and } n\geq 0.
\]
\Exercise Find out if the following equations are true.
\Question $(1 + 5)^2 \geq 11$
\Question $1 < 5$
\Question $1 > 5$
\end{ExerciseList}
\end{document}
处理它lualatex
(或xelatex
——都使用-8bit
选项)会产生一个问题编号不正确的文档。
省略\usepackage{unicode-math}
和\setmathfont{...}
(这需要unicode-math
),则输出将符合预期。
答案1
该unicode-math
包将其定义\Question
为数学符号,确切地说是 U+2047 双问号,即 ⁇。
\documentclass{book}
\usepackage{amsmath}
\usepackage[lastexercise,answerdelayed]{exercise}
\usepackage{polyglossia}
\usepackage{unicode-math}
\setmainlanguage{english}
\setmainfont{TeX Gyre Pagella}
\setmathfont{TeX Gyre Pagella Math}% this requires unicode-math
\let\exerciseQuestion\Question
\AtBeginDocument{%
\let\mathQuestion\Question
\let\Question\exerciseQuestion
}
\begin{document}
\chapter{List of problems}
\begin{ExerciseList}
\Exercise Prove Bernoulli's inequality
\[
(1+x)^n \geq 1+nx, \text{ for } x\geq -1 \text{ and } n\geq 0.
\]
\Exercise Find out if the following equations are true.
\Question $(1 + 5)^2 \geq 11$
\Question $1 < 5$
\Question $1 > 5$
\end{ExerciseList}
\end{document}