Wie behebe ich die Inkompatibilität von Übungs- und Unicode-Mathematikpaketen?

Wie behebe ich die Inkompatibilität von Übungs- und Unicode-Mathematikpaketen?

Ich wollte das Übungspaket in einem LaTeX-Dokument verwenden, welches mit LuaLaTeX verarbeitet wird. Dabei trat das Problem auf, dass die Nummerierung und Formatierung der Fragen nicht korrekt funktionierte.

Wie kann ich beide Pakete verwenden, d. h. wie kann ich eine solche Inkompatibilität debuggen und beheben?

Ich habe dieses Problem auf ein MWE reduziert, das wie folgt lautet:

\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}

Die Verarbeitung mit lualatex(oder xelatex– beides unter Verwendung der -8bitOption) führt zu einem Dokument, bei dem die Fragen nicht richtig nummeriert sind.

Wenn Sie das \usepackage{unicode-math}und das weglassen \setmathfont{...}(was erfordert unicode-math), ist die Ausgabe wie erwartet.

Antwort1

Das unicode-mathPaket definiert \Questionals mathematisches Symbol genau U+2047 DOUBLE QUESTION MARK, also ⁇.

\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}

Bildbeschreibung hier eingeben

verwandte Informationen