如何使用 titlesec 实现小节标题中标签和文本的不同格式

如何使用 titlesec 实现小节标题中标签和文本的不同格式

如何使用 titlesec 获取小节标签和文本的不同格式?

原因:小节标题中的斜体数字伤害了我的眼睛,应不惜一切代价避免,小节的标签应为普通罗马字体,而文本应为斜体

首先,我使用 fontspec 定义文档章节和小节标题的字体:

\usepackage{fontspec}
\usepackage{titlesec}
\newfontfamily\sectionfont[LetterSpace=16.0,Path=C:/fonts/]{LTe50383.pfb} %sectionfont in Sabon Roman
\newfontfamily\subsectionfont[Path=C:/fonts/]{LTe50384.pfb} %subsection font is Sabon Italic

在此之后我定义了标题格式:

\titleformat{\section}{\sectionfont}{\thesection.}{1em}{\MakeUppercase}{}
\titleformat{\subsection}{\subsectionfont}{\thesubsection.}{1em}{}{}

是否有可能改变格式?正如 titlesec 手册中所述:

format 是应用于整个标题(标签和文本)的格式。此部分可以包含垂直材料(以及带有某些形状的水平材料),这些材料排版在标题上方的空间之后。

答案1

\titleformat{\subsection}{\subsectionfont}{\sectionfont\thesubsection.}{1em}{}{}

应该可以解决问题。

相关内容