5

Here is the code:

\documentclass{article}
\usepackage[vmargin=1in]{geometry}
\usepackage{xfrac,fontspec,unicode-math}
\setmathfont[version=lm]{Latin Modern Math}
\setmathfont[version=cambria]{Cambria Math}
\usepackage{xgreek}
\usepackage{exsheets}
\begin{document}

\setmainfont{Latin Modern Roman}
\mathversion{lm}
\section*{Latin Modern}
There follows a question
\begin{question}
This is the first question
\end{question}\\
\begin{question}[name=Problem]
This is the second question
\end{question}


\setmainfont{Cambria}
\mathversion{cambria}
\section*{Cambria, Cambria Math}
There follows a question 
\begin{question}
This is the first question
\end{question}\\
\begin{question}[name=Problem]
This is the second question
\end{question}
\end{document}

and the output is

enter image description here

Does anybody has a solution?

*Exsheets works fine with xelatex if unicode-math is not in the preamble

  • Thnx, it works fine, but only with \NewQuSolPair{exercise}{answer} . The command \RenewQuSolPair{question}{solution} does not do anything. – Yiannis Kiouvrekis Nov 23 '13 at 10:27
  • 1
    \AtBeginDocument{\RenewQuSolPair{question}{solution}} (in the preamble) works for me. By the way: the \` after \end{question}` is wrong... – clemens Nov 23 '13 at 10:33
  • This should read: »the \\ after \end{question}« – clemens Nov 23 '13 at 10:46
  • Can you post your preamble? – Yiannis Kiouvrekis Nov 23 '13 at 10:54
5

This is a known issue. The file unicode-math-table.tex that is loaded by unicode-math contains the following line:

\UnicodeMathSymbol{"0003F}{\question}{\mathord}{question mark}%

This means that at begin document \question gets defined or redefined (unicode-math does \AtBeginDocument{\um_define_math_chars:} which supposedly initiates the definition...) The file

\documentclass{article}
\usepackage{unicode-math}
\show\question
\begin{document}
\show\question
\end{document}

produces in the log

> \question=undefined.
l.3 \show\question

and

> \question=the character ?.
l.5 \show\question

And the character ? is exactly what you're seeing when you use exsheets' \begin{question}. (Remember that \begin{foo} amongst other things calls the command \foo.)

There are two solutions for this:

  1. redefine \question again at begin document by adding

    \AtBeginDocument{\RenewQuSolPair{question}{solution}}
    

    after loading both unicode-math and exsheets. You'll lose unicode-math's \question then.

  2. Use another exercise environment by defining a new one, e.g.,

    \NewQuSolPair{exercise}{answer}
    

Here's an example for the first version:

\documentclass{article}
\usepackage{unicode-math}
\usepackage{exsheets}
\AtBeginDocument{\RenewQuSolPair{question}{solution}}
\begin{document}
\begin{question}
  This is a question.
\end{question}
\begin{solution}[print]
  This is a solution.
\end{solution}
\end{document}

Here's an example for the second possibility:

\documentclass{article}
\usepackage{unicode-math}
\usepackage{exsheets}
\NewQuSolPair{exercise}{answer}
\begin{document}
\begin{exercise}
  This is a question.
\end{exercise}
\begin{answer}[print]
  This is a solution.
\end{answer}
\end{document}

Both give

enter image description here

  • Yes, because i want to use unicode-math and exsheets together. Thnx again – Yiannis Kiouvrekis Nov 24 '13 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.