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!

  • 1
    From the Readme: »The only figure style supported is proportional semi-oldstyle.« Sorry, but it seems you are out of luck. You could substitute the lining number from another font, but that would look very awkward. – Henri Menke May 31 '16 at 20:35
  • Indeed, "lining" numbers are not included in the glyph set. You could perhaps note your interest on the github issue tracker. – Dɑvïd May 31 '16 at 20:37
  • You could also switch to another font. Chaparral Pro comes to my mind, which is unfortunately commercial but a superb slab serif type face. A subset comes bundled with Adobe InDesign and Adobe Illustrator. If you have one of the programs, you have the font and may legally use it. – Henri Menke May 31 '16 at 20:44
  • And possibly related, see an earlier question (that got no real answer, perhaps because there isn't one): "Two different 'main fonts' in use; use only one for numbers." – Dɑvïd May 31 '16 at 20:54
  • If you are able to use a different font, then XCharter (+ on CTAN) gets you some of the character of Merriweather, imo. (So would Vollkorn, but I don't think there's a "package" for it?) – Dɑvïd May 31 '16 at 21:23
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}
|improve this answer|||||
  • Thanks again :), but this code changes the style for page and Chapter/Section numbering? – Costa PR May 31 '16 at 20:40
  • Sorry, no, this doesn't – Runar May 31 '16 at 20:43
  • Also, I need to use pdfLatex.. :/ – Costa PR May 31 '16 at 20:43
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

|improve this answer|||||
  • 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

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.