0

I use the titlesec package to custom my chapter titles. I want to use a font from the librebodoni package that is already installed (the commande \usepackage{LibreBodoni} works fine but changes the font in the whole document).

I tried \fontfamily{librebodonifamily}\selectfont as this seems to be the name of the font family defined in librebodoni.sty, but it did not work and returned the following message:

LaTeX Font Warning: Font shape T1/librebodonifamily/bx/n' undefined (Font) usingT1/librebodonifamily/m/n' instead on input line 1.

LaTeX Font Warning: Font shape T1/librebodonifamily/bx/it' undefined (Font) usingT1/librebodonifamily/bx/n' instead on input line 1.

I tried other reasonable family names but none is working... Does anyone have a clue how to solve this problem? Thanks by advance.

I use pdflatex.

  • librebodonifamily is not the right name. Can you please add a minimal example of code? – egreg Feb 23 '18 at 0:06
  • The right name of the family for pdflatex seems to be LibreBodoni-TLF (there are two other families for superior and inferior figures, but most likely you won't need them in section titles). – Bernard Feb 23 '18 at 0:16
0

You can define a new command to switch to the font. In this example, \librebodoni switches to the font, while \textlb{<text>} typesets <text> in the font.

\documentclass{article}
\usepackage[T1]{fontenc}% you seem to be using this encoding
\makeatletter
\DeclareRobustCommand\librebodoni{\not@math@alphabet\librebodoni\relax\fontencoding{T1}\fontfamily{LibreBodoni-TLF}\selectfont}
\makeatother
\DeclareTextFontCommand\textlb{\librebodoni}
\begin{document}
Some text in ordinary serif.

\textlb{A short text in Libre Bodoni}

Back to default.

{\librebodoni
  A longer text with more than one paragraph.

  This is the other one.%
}

Back to default.
\end{document}

switching to Libre Bodoni

Note that, depending on your default document font, you may not wish to use the bold. In comparison with Computer Modern, for example, the regular weight of Libre Bodoni already looks bold, and the bold is really extremely shouty. Of course, if your default fonts are heavier, this may not be the case.

shoutier bold

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.