
我使用該titlesec
包來自訂我的章節標題。我想使用librebodoni
包中的字體已安裝(命令\usepackage{LibreBodoni}
工作正常,但更改了整個文件中的字體)。
我嘗試過,\fontfamily{librebodonifamily}\selectfont
因為這似乎是 中定義的字體系列的名稱librebodoni.sty
,但它不起作用並返回以下訊息:
LaTeX 字體警告:
T1/librebodonifamily/bx/n' undefined (Font) using
輸入行 1 上的字體形狀為 T1/librebodonifamily/m/n'。LaTeX 字體警告:字體形狀
T1/librebodonifamily/bx/it' undefined (Font) using
T1/librebodonifamily/bx/n' 位於輸入行 1 上。
我嘗試了其他合理的姓氏,但沒有一個有效...有人知道如何解決這個問題嗎?提前致謝。
我用pdflatex
。
答案1
您可以定義一個新命令來切換字體。本例中,\librebodoni
切換到字體,同時在字體中\textlb{<text>}
排版。<text>
\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}
請注意,根據您的預設文件字體,您可能不希望使用粗體。例如與Computer Modern相比,Libre Bodoni的常規字重就已經顯得很大膽了,而且這種粗體確實非常喧鬧。當然,如果您的預設字體較重,情況可能並非如此。