2

I want to use \usepackage[sfdefault]{merriweather}, but without the oldstyle numbers. I wanted to change the font of Sans Serif numbers to Helvetica, Epigrafica, ..., so I can use lining numbers.

Maybe it is similar to here and here, but I could not adapt these solutions to my problem.

Also, I cannot use XeTeX or LuaTeX.

Update: It seems to be not possible to import some characters from other fonts in text mode, as appointed by @Davïd and @Henri-Menke. :/

Thanks everybody!

2 Answers2

1

This answer was shamelessly stolen from Alan Munn's answer in Lining numbers not working in certain fonts, and modified to the Merriweather font. Here, the numbers are replaced by Helvetica.

Note that this does require you to use the macro \lining to set the font. It would therefore not change every number, which I believe is what you are asking. Here you would have to use the macro in section numbers and basically everywhere. It is just a local change.

As others, and me, have pointed out in this and other posts, switching some symbols from fonts generally doesn't look very good. I'd either switch to a different font or accept the old style numbers included in the font.

\documentclass[11pt]{article}
\usepackage{fontspec}
 \usepackage[sfdefault]{merriweather}
 \newfontface\lining[Numbers=Lining]{Helvetica}
\begin{document}
Foo\lining 1234567890
\end{document}
Runar
  • 6,082
1

Does this fit your needs? (mostly copied from [Fischer (2010)])

\documentclass{article}
\usepackage[sfdefault]{merriweather}
\usepackage{mathastext}
\DeclareSymbolFont{numbers}{T1}{phv}{m}{n}
\SetSymbolFont{numbers}{bold}{T1}{phv}{bx}{n}
\DeclareMathSymbol{0}\mathalpha{numbers}{"30}
\DeclareMathSymbol{1}\mathalpha{numbers}{"31}
\DeclareMathSymbol{2}\mathalpha{numbers}{"32}
\DeclareMathSymbol{3}\mathalpha{numbers}{"33}
\DeclareMathSymbol{4}\mathalpha{numbers}{"34}
\DeclareMathSymbol{5}\mathalpha{numbers}{"35}
\DeclareMathSymbol{6}\mathalpha{numbers}{"36}
\DeclareMathSymbol{7}\mathalpha{numbers}{"37}
\DeclareMathSymbol{8}\mathalpha{numbers}{"38}
\DeclareMathSymbol{9}\mathalpha{numbers}{"39}
\begin{document}
Hello Text 1234

$Hello Math 1234$
\end{document}

enter image description here

Henri Menke
  • 109,596
  • I think O.T. needs to change the numbers everywhere, including section numbers, enumerate and basically just a global change. – Runar May 31 '16 at 20:52
  • Unfortunately, no, but almost... I need the lining figures outside the math environment. – Costa PR May 31 '16 at 20:53
  • @CostaPR Then you have to use another font for the whole document. Loading single charaters from a different font is not possible in text mode. (Barring some active character solution). – Henri Menke May 31 '16 at 21:09