4

I am trying to use old-style numbers in my LuaLaTeX document. My main font is "Cambria", which I do not want to change.

old-style figures

As you can see in this picture (line 2) there is a change in font. I do not want that change to happen if using the \oldstylenums command. The strange thing is that the normal text uses the right numbers. How can I easily change the style of that command too?

\documentclass{article}

\usepackage{fontspec}
\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}%
\usepackage{MnSymbol}%
\setmainfont[Numbers={OldStyle,Proportional}]{Cambria}%
\setsansfont{Calibri}%
\setmonofont{Consolas}%
\setmathfont[range={it,sfit}]{Cambria Italic}%
\setmathfont[range={bfit,bfsfit}]{Cambria Bold Italic}%
\setmathfont{Cambria Math}%

\begin{document}
    \section{This should have an old-style figure}
    This is a text containing some figures: 123456. They should be old-style and not lining. This is specifically old-style: \oldstylenums{123456}. And this is lining: \liningnums{123456}. And in math it shall be lining: \( 123456\)
\end{document}

Update: As you can see in the next picture there is a ordinary LaTeX font used in that document which is not supposed to be there.

fonts in document

9
  • 1
    the sfrm is coming from \usepackage{MnSymbol} if I remove that I just get opentype fonts (what do you want mnsymbol to do in this context) Commented Feb 17, 2017 at 18:48
  • @DavidCarlisle Thanks for helping localizing the problem. I use MnSymbol in my main document to have nicer symbols (e.g. arrows). Do you know an elegant solution to not use MnSymbol for that macro?
    – TeXnician
    Commented Feb 17, 2017 at 18:52
  • well certainly loading a package that sets up math for 8bit font encodings after loading unicode-math is going to break something. hard for me to say, do you need unicode-math or can you just use the mnsymbol setup, or alternatively what's wrong with cambria math arrows... Commented Feb 17, 2017 at 18:55
  • Try loading MnSymbol before fontspec. Commented Feb 17, 2017 at 18:56
  • 3
    @DavidCarlisle it is textcomp that redefines \oldstylenums. Commented Feb 17, 2017 at 19:04

1 Answer 1

3

To sum up the discussion in the comments, there is one main problem with the code: It uses MnSymbol. That loads, among others, textcomp, a package not intended for use with unicode fonts. The issue is resolved not loading the MnSymbol package.

Probably that is no real disadvantage, because the unicode-math provided font support is sufficient, especially using a font like "Cambria Math".

correct fonts

6
  • 2
    Why should textcomp be deprecated? It isn't. To the contrary it's part of base LaTeX. It doesn't make sense to load MnSymbol along with unicode-math to begin with.
    – egreg
    Commented Feb 17, 2017 at 22:52
  • I was just going to say this, when I found @egreg said it first. No reason at all not to use textcomp. Plenty of reason not to use it with unicode fonts.
    – cfr
    Commented Feb 18, 2017 at 0:45
  • @egreg CTAN marks it as "obsolete".
    – TeXnician
    Commented Feb 18, 2017 at 6:05
  • 1
    @TeXnician That's an old version of the package, that obviously became obsolete when a new one was made part of the base distribution..
    – egreg
    Commented Feb 18, 2017 at 9:53
  • @TeXnician The location of textcomp.sty in my TeX Live is /usr/local/texlive/2016/texmf-dist/tex/latex/base/textcomp.sty
    – egreg
    Commented Feb 18, 2017 at 10:10

You must log in to answer this question.

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