3

Consider the following example:

\documentclass{article}
\usepackage{mathspec}
\usepackage{siunitx}

\begin{document}
\ang{30}, \SI{20}{\celsius}
\end{document}

Compiling with XeLaTex, I get:

Missing degree

The angle misses the degree symbol. With the package fontspec instead of mathspec it works fine (but I need mathspec).

Is there any solution?

2
  • Have you tried \textdegree from textcomp package?
    – AboAmmar
    Commented Jan 3, 2019 at 14:27
  • 2
    With recent version of siunitx (v3.1.8, last revised 2022-10-04.) your MWE gives desired result.
    – Zarko
    Commented Oct 30, 2022 at 6:09

2 Answers 2

4
\documentclass{article}
\usepackage{mathspec}
\usepackage{textcomp}
\usepackage{siunitx}

\sisetup{math-degree=\mbox{\textdegree},text-degree=\textdegree}
\sisetup{math-celsius=\mbox{\textdegree}C,text-celsius=\textdegree C}

\begin{document}
\ang{30}, \SI{20}{\celsius}
\end{document}

enter image description here

0
4

You can use the right Unicode character:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\usepackage{siunitx}

\sisetup{
  text-degree=°,
  math-degree=\textup{°},
  text-celsius=℃,
  math-celsius=\textup{℃},
}

\begin{document}
\ang{30}, \SI{20}{\celsius}
\end{document}

enter image description here

With siunitx version 3 it's even simpler:

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathspec}
\usepackage{siunitx}

\DeclareSIUnit{\degreeCelsius}{\textup{℃}}

\begin{document}

\ang{30}, \SI{20}{\degreeCelsius}

\end{document}
2
  • FYI: Checking today, I found that siunitx has removed those options. The error messages are like "Option "text-degree" has been removed in this (siunitx) release." I use texlive 2021, constantly updated via tlmgr.
    – Ryo
    Commented Sep 13, 2021 at 7:10
  • 1
    @Ryo I added the code for siunitx version 3
    – egreg
    Commented Sep 13, 2021 at 10:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .