tud-cd / tudscr

TUD-Script

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting `cdmath=false` when using unicode-math package breaks typesetting of math operators

sfo opened this issue · comments

Setting cdmath=false as class option when using the unicode-math package leads to issues in typesetting of math operators like \ln and \exp, which are now italicized.

This MWE:

\documentclass[
  cdmath=false,
]{tudscrartcl}

\usepackage{unicode-math}

\begin{document}
Hello, Math: $x = \ln (σ) + \exp (μ)$
\end{document}

leads to:
math_wrong

This issue seems to go into the same direction as #22. The workaround is also the same:

\documentclass[
  % cdmath=false, % do NOT specify here
]{tudscrartcl}

\usepackage{unicode-math}

\begin{document}
\TUDoptions{cdmath=false} % but here

Hello, Math: $x = \ln (σ) + \exp (μ)$

\end{document}

Another observation: When using the subfiles package it's required to set \TUDoptions{cdmath=false} explicitly after \begin{document} in each file. Setting it in \AtBeginDocument{} does not work.

The font selection mechanism needs to be refactored in various places and an improved interaction with unicode-math is on my list. Currently, the actual font selection is delayed to the end of the preamble an especially the math font selection is done even after the begindocument hook. Maybe using \AfterEndPreamble{...} would help for the subfiles issue. Unfortunately, I do not have time to work on the next major release so please do not expect any improvements in the near future.