I wanted to use the exercise package in a LaTeX-document that is processed with LuaLaTeX. In this case, I encountered the problem that numbering and formatting of questions does not work correctly.
How can I use both package, i.e. how do I debug and fix such an incompatibility?
I reduced this problem to a MWE which is as follows:
\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}
Processing this with lualatex
(or xelatex
-- both using the -8bit
option) yields a document where the questions are not numbered correctly.
Omitting the \usepackage{unicode-math}
and the \setmathfont{...}
(which requires unicode-math
), then the output is as expected.