Configurable default `unit-font-command` when using beamer
tovrstra opened this issue · 4 comments
In beamer, you can use sans text fonts and roman math font, e.g., with \usefonttheme[onlymath]{serif}
or with fontspec
's \setmathfont
. In this case, siunitx formats units with a sans font in math mode, which is not very readable, but it seems from #516 that some prefer this style. I would argue that this preference is not universal. :)
The current implementation in 6e4263c conditionally overwrites \sisetup{unit-font-command=\mathrm}
with unit-font-command=\mathsf
. When this happens, the user-specified of unit-font-command
gets ignored. Would it be possible to implement the default value of unit-font-command
so that it can still be set with \sisetup
in all cases?
P.S. When putting \sisetup{unit-font-command=\mathrm}
after \begin{document}
, it does get honored, but I'm not sure if that is the right way to use it?
I'll fix - this is clearly a bug - user changes should be respected.
In beamer, you can use sans text fonts and roman math font, e.g., with
\usefonttheme[onlymath]{serif}
or withfontspec
's\setmathfont
. In this case, siunitx formats units with a sans font in math mode, which is not very readable, but it seems from #516 that some prefer this style. I would argue that this preference is not universal. :)
Well I can only do so much to try to work out what the user is up to - if the body font is sanserif, it's not unreasonable I hope to go with 'this is an all-sans document' :)
@josephwright Thanks for the quick fix! I've tested the hotfix, but it seems there is some issue with the newly added conditional. I get the following error message:
! Undefined control sequence.
<argument> \tl_if_eq:VnT
\l_siunitx_unit_font_tl {\mathrm }{\keys_set:nn {si...
l.5 \begin{document}
?
! Emergency stop.
<argument> \tl_if_eq:VnT
\l_siunitx_unit_font_tl {\mathrm }{\keys_set:nn {si...
l.5 \begin{document}
The document I'm compiling also shows this error when just using \usepackage{siunitx}
without any options nor any \sisetup
.
When I run l3build check
in the repository, I also get some errors:
Running checks on
siunitx-abbreviation (1/41)
siunitx-all-sanserif (2/41)
siunitx-angle (3/41)
--> failed
siunitx-binary (4/41)
siunitx-cls-beamer (5/41)
--> failed
siunitx-cls-beamer-custom (6/41)
--> failed
siunitx-cls-revtex4-2 (7/41)
siunitx-command (8/41)
siunitx-command-argument (9/41)
siunitx-command-overwrite (10/41)
siunitx-command-space (11/41)
siunitx-command-xspace (12/41)
siunitx-complex (13/41)
--> failed
siunitx-compound (14/41)
--> failed
siunitx-compound-markers (15/41)
siunitx-emulation (16/41)
--> failed
siunitx-emulation-overwrite (17/41)
siunitx-locale (18/41)
siunitx-number (19/41)
--> failed
siunitx-pdfstring (20/41)
--> failed
siunitx-pkg-bidi (21/41)
--> failed
siunitx-pkg-cellspace (22/41)
--> failed
siunitx-pkg-fixmath (23/41)
siunitx-pkg-fourier (24/41)
siunitx-pkg-kmath (25/41)
siunitx-pkg-kotex (26/41)
siunitx-pkg-libertine (27/41)
siunitx-pkg-open-sans (28/41)
siunitx-pkg-realscripts (29/41)
siunitx-pkg-sansmath (30/41)
siunitx-pkg-soulpos (31/41)
--> failed
siunitx-pkg-unicode-math (32/41)
--> failed
siunitx-pkg-xfrac (33/41)
siunitx-print (34/41)
siunitx-quantity (35/41)
siunitx-symbol (36/41)
siunitx-symbol-active (37/41)
siunitx-table (38/41)
siunitx-table-column (39/41)
siunitx-table-header (40/41)
siunitx-unit (41/41)
--> failed
(I'm not sure if that is related.)