5

Using the SIunitx package with montserrat package doesn't produce the desired result:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[defaultfam,light,scale=0.85]{montserrat}
\usepackage{siunitx}
\sisetup{%
 mode = math, % Same error if mode = text is used
% detect-all, % When, uncommented, the error described below occurs
% detect-weight,  % When, uncommented, the error described below occurs
}  

\begin{document}
This is the weight and family of text desired but when siunitx shows heavier weight: \SI{75}{\micro\metre}
\end{document}

Produces:

Image showing incorrect font weight for units and number.

When options detect-weight or detect-all are used, the following error is produced:

[no file]:18: Undefined control sequence. [...hows heavier weight: \SI{75}{\micro\metre}]
[no file]:18: Undefined control sequence. [...hows heavier weight: \SI{75}{\micro\metre}]

The PDF, notwithstanding the compilation error, the PDF shows the desired result:

Desired results

The log file indicates:

Package: siunitx 2018-05-11 v2.7q A comprehensive (SI) units package

and reports the following error:

! Undefined control sequence.
\__siunitx_font_weight: ->\lseries 

l.18 ...hows heavier weight: \SI{75}{\micro\metre}
  • 1
    Do you need mode = math? With mode = text it works without errors. – Ralf Stubner Jul 4 '19 at 14:52
  • @RalfStubner If you uncomment detect-weight and set math = text in the MWE, the same error occurs. I have updated the MWE to indicate this. – Martin Clouthier Jul 4 '19 at 14:57
  • Indeed. But there is no error and the right fonts if you only use mode = text without any of the detect-* options. – Ralf Stubner Jul 4 '19 at 14:58
  • @RalfStubner your suggestion works. – Martin Clouthier Jul 4 '19 at 15:00
  • 1
    @RalfStubner - There may be valid reasons (which the OP hasn't pointed out so far) for setting mode=math. (See, e.g., p. 77 of the user guide of the siunitx package.) The work-around for this contingency is set set detect-mode (but certainly not detect-all) when loading siunitx. – Mico Jul 4 '19 at 15:02
4

Provide a definition for the missing command:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[defaultfam,light,scale=0.85]{montserrat}
\usepackage{siunitx}
\sisetup{%
 mode = math, % Same error if mode = text is used
 detect-all, % When, uncommented, the error described below occurs
 %detect-weight,  % When, uncommented, the error described below occurs
}

\DeclareRobustCommand\lseries{\fontseries{l}\selectfont}

\begin{document}
This is the weight and family of text desired but when siunitx shows heavier weight: \SI{75}{\micro\metre}
\end{document}
| improve this answer | |
3

You need to load siunitx with the option detect-mode. (Please see the bottom of p. 17 and the top of p. 18 of the user guide of the siunitx package for the differences between detect-mode, detect-weight, etc.)

enter image description here

\documentclass{article}
\usepackage{geometry} % optional
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[defaultfam,light,scale=0.85]{montserrat}
\usepackage{siunitx}
\sisetup{ mode = math , detect-mode }  

\begin{document}
This is the weight and family of text desired. siunitx now shows the correct, i.e, thin weight: \SI{75}{\micro\metre}
\end{document}
| improve this answer | |
1

You could use mode = text without any any detect-* options giving you the same output even when the unit is used in math mode:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[defaultfam,light,scale=0.85]{montserrat}
\usepackage{siunitx}
\sisetup{ mode = text }

\begin{document}
This is the weight and family of text desired but when siunitx shows
heavier weight: \SI{75}{\micro\metre} $\SI{75}{\micro\metre}$
\end{document}

enter image description here

| 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.