LaTeX 中所有标题的字体不同
我想将章节/小节/小节标题设置为使用无衬线字体,但保留正文的衬线字体。 如何才能做到这一点?
I would like to set my chapter/section/subsection headings to use a sans-serif font, but keep the serif font for the body text. How can this be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用
sectsty
LaTeX 包。把这个放在序言中:
You can use the
sectsty
LaTeX package.Put this in the preamble:
您还可以使用 titlesec 包,它比 sectsty 具有更大的定制灵活性。
You can also use the titlesec package, which allows greater flexibility of customisation than sectsty.
对于那些想知道为什么这必须与普通文本不同的人。 这是因为健壮命令和脆弱命令之间的区别。 标题不允许脆弱的命令,所以你必须明确告诉乳胶它是健壮的。
此链接进一步解释了这一点,并且此链接显示了另一种替代方法。
For the people who want to know why this has to be done differently from e.g. normal text. It is because of the distinction between robust commands and fragile commands. Headings do not allow fragile commands, so you have to specifically tell latex it is robust for example.
This link explains this further, and this link shows another alternative to do it.
我想到的第一个可能性是使用 KOMA-script 包中的文档类,他们将此设置为默认值。
The first possibility that comes to my mind is to use a document class from the KOMA-script package, they have this set up as a default.