1

I am trying to change a small selection of font to Linux Libertine Sans Serif. However, the serif font works properly but the sans serif one fails.

I am following the method proposed in How do I use a particular font for a small section of text in my document? and I do not want to use XeLaTeX's fontspec because I hope my code can work globally on any machine. Please consider the following MWE:

\documentclass{article}

\begin{document}
Computer Modern Serif

{\sffamily Computer Modern Sans Serif}

{
    \fontfamily{LinuxLibertineT-OsF}\selectfont % set font as Linux Libertine
    Linux Libertine Serif
    
    {\sffamily This however is not Linux Libertine Sans Serif}
}
\end{document}

which gives

Result

4
  • 1
    You will need a \fontfamily.... command for the Libertine sf family. The default is lmsans (do a \fontname\font, to see) - the default font families for rm/sf/tt are set up by the class.
    – Cicada
    Mar 26 at 12:27
  • 2
    \fontfamily{LinuxBiolinumT-OsF}\selectfont
    – user22108
    Mar 26 at 13:25
  • @Cicada Thanks for pointing out that. Now I know I have to specify the sans serif font. Mar 26 at 13:34
  • @user22108 That's such a quick fix! Thank you! I did not realize that the sans serif font complement of Linux Libertine is called that. (I used to use that package and everything went on smoothly.) You can put that as the answer and I will accept it. :-) Mar 26 at 13:36

1 Answer 1

0

The \fontfamily needs to specify its sans serif font. As is pointed out by Cicada, the default font families for rm/sf/tt are set up by the class.

Here is a list of the most common fonts, and their codes: (From How do I use a particular font for a small section of text in my document?)

Family                 Font Name
pag                    Avant Garde
fvs                    Bitstream Vera Sans
pbk                    Bookman
bch                    Charter
ccr                    Computer Concrete
cmr                    Computer Modern
pcr                    Courier
mdugm                  Garamond
phv                    Helvetica
fi4                    Inconsolata
lmr                    Latin Modern
lmss                   Latin Modern Sans
lmtt                   Latin Modern Typewriter
LinuxBiolinumT-OsF     Linux Biolinum (formerly 'fxb' in older package versions)
LinuxLibertineT-OsF    Linux Libertine (formerly 'fxl' in older package versions)
pnc                    New Century Schoolbook
ppl                    Palatino
qag                    TeX Gyre Adventor 
qbk                    TeX Gyre Bonum 
qzc                    TeX Gyre Chorus
qcr                    TeX Gyre Cursor
qhv                    TeX Gyre Heros
qpl                    TeX Gyre Pagella 
qcs                    TeX Gyre Schola
qtm                    TeX Gyre Termes
ptm                    Times
uncl                   Uncial
put                    Utopia
pzc                    Zapf Chancery

So what is the name of Linux Libertine sans serif? Well, according to Wikipedia

There is also a complementary humanist sans-serif face, Linux Biolinum, similar to Optima or Candara. It is available in bold and italic styles.

It has a different name Linux Biolinum! This was pointed out by user22108, and I tested this font and it looked exactly like the sans serif font in package libertine.

Here is a MWE to test:

\documentclass{article}

\begin{document}
Computer Modern Serif (\fontname\font)

{\sffamily Computer Modern Sans Serif  (\fontname\font)}

\fontfamily{LinuxLibertineT-OsF}\selectfont
Linux Libertine Serif (\fontname\font)
    
\fontfamily{LinuxBiolinumT-OsF}\selectfont
Linux Biolinum (\fontname\font)

\end{document}

which gives the output:

output

1
  • I expected user22108 to put the answer here but I think it is my obligation to get this question out of the unanswered so I answered my own question which was solved in comments. Mar 28 at 0:45

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.