使用 titlesec 在章節標題後新增規則

使用 titlesec 在章節標題後新增規則

我一直在嘗試使用章節標題格式,titlesec但我似乎找不到在章節標題下方添加規則的正確方法。閱讀文件後,我發現\titleline確實如此,但我不確定\titleformat將其放置在語法中的何處。

答案1

這是一個可能的解決方案,使用最後一個可選參數來\titleformat插入一些垂直間距和規則:

\documentclass{book}
\usepackage{titlesec}

\titleformat{\chapter}[display]
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}[\vspace{2ex}\titlerule]

\begin{document}

\chapter{Test Chapter}

\end{document}

相關內容