5

I have two problems with the siunitx package. After reading the documentation and searching the internet without success, I hope someone can help me:

\documentclass[12pt, 
        ]{scrreprt} 

\usepackage[ngerman]{babel} 
\usepackage[babel, german=quotes]{csquotes} 
\usepackage{amsmath} 

\usepackage{siunitx} 
\sisetup{ 
        mode = math, 
        detect-all, 
        exponent-product = \cdot, 
        number-unit-separator=\text{\,}, 
        output-decimal-marker={\text{,}}, 
}     

\usepackage{chemmacros} 
\usechemmodule{all} 
\chemsetup{greek = {fontspec}} 

\usepackage{fontspec} 

\usepackage{unicode-math} 
\setmainfont{Lucida Bright OT} 
\setmathfont{Libertinus Math} 

\begin{document} 

\SI{5}{\ohm} $\Omega$ 

\end{document}

Problem #1:

In the \sisetup part, I set the mode explicitly to math. Doing so, I would expect the both omegas, the Ohm and the math-mode-Omega, to look identical, i.e., using the same font (Libertinus Math in this case). Why isn't that the case?

Problem #2:

If I compile the given MWE with LuaLaTeX, the SI-Omega (\ohm) is not displayed. If I do one of the following three things, the \ohm is displayed (this means that the sign itself is available):

  • comment out the detect-all line inside the \sisetup;
  • change to another main font (what I definitely don't want to do);
  • comment out the three lines related to the chemmacros packet.

It seems strange to me, that other fonts don't have problems with either detect-all nor the chemmacros lines.

What could be the reason for this to issues or am I doing something basically wrong?

PS: I am using the Lucida Version from TUG as well as the latest version of TeXLive 2017 (all packages are up to date).

=====================UPDATE=====================

Yesterday here was an answer, which suggested reordering the commands. Unfortunately, this didn't solve the problem. Anyway, I tried something else: Switching to the Type-1 form of the Lucida font leads to the following code:

\documentclass[12pt,
               ]{scrreprt}
%\usepackage[T1]{fontenc} % for pdfLaTeX
\usepackage[ngerman]{babel}
\usepackage[babel, german=quotes]{csquotes}
\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{
        mode = math,
        detect-all,
        exponent-product = \cdot,
        number-unit-separator=\text{\,},
        output-decimal-marker={\text{,}},
}     

\usepackage{chemmacros}
\usechemmodule{all}

\usepackage{lucimatx}

\begin{document}
\SI{5}{\ohm} $\Omega$

\end{document}

If I compile this new code with LuaLaTeX and without \usepackage[T1]{fontenc} I get an Omega but in the LaTeX standard font (CMR). Compiling the code with pdfLaTeX and \usepackage[T1]{fontenc}, I get the \ohm-Omega in the right font (Lucida). So, maybe the problem is rather an encoding issue than a package issue?

  • 2
    Welcome to TeX.SX! Why Libertinus Math instead of Lucida Bright Math? Anyway, the issue seems to be with chemmacros – egreg Apr 1 '18 at 10:26
  • 1
    You may want to consider asking only one question per question. That makes your question easier to answer and more useful for others. Following our discussion in golatex.de/zwei-probleme-mit-siunitx-t20542.html there is github.com/josephwright/siunitx/issues/334 for the first issue. – moewe Apr 1 '18 at 11:10
  • When I try to complile you MWE with LuaLaTeX, it does not seem to find the Lucida Bright OT font. If I change it to times for instance, everything appears on the pdf document. Could you have a look at the log when running lualatex doc.tex in a terminal ? – BambOo Apr 1 '18 at 12:29
  • @egreg The different fonts are for showing you issue #1. How can you say that this is related to chemmacros, since deleting detect-all also works? @ BambOo the log rises no errors or warnings. The Lucida font is a commercial one, you have to buy it. But as I wrote in the starting post, other fonts seems to work. – Stan Apr 1 '18 at 13:07
1

I've found a workaround, at least I would consider this as a workaround since the \micro symbol works without any changes.

By adding

    math-ohm = \ensuremath{\upOmega},
    text-ohm = Ω,

to the \sisetup it works as expected. Nevertheless, I would appreciate a more fundamental answer to the generell problem (especially why does the \micro symbol work?). Interestingly, I've tried this version (since it is recommended in the \siunitxmanual (for XeTeX)) before making the initial post and it had not worked... Maybe some typing error. Since I use Lucida as text font as well as for math, any difference should be irrelevant in my special case.

| improve this answer | |

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.