\titleformat:規則底線

\titleformat:規則底線

我修改了 \section 格式以新增底線。如何減少節名和底線之間的間距?我使用的程式碼如下。

\usepackage{titlesec} % Allows creating custom \section's

\titleformat{\section}{\large\scshape\raggedright}{}{0em}{}[\rule{\linewidth}{1pt}]

在此輸入影像描述

答案1

使用titlerulevspace

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usepackage{titlesec}

\titleformat{\section}{\large\scshape\raggedright}{}{0em}{} [{\vspace{1cm}\titlerule[1pt]}]

\begin{document}
\section{TEST}
Bla bla

\titleformat{\section}{\large\scshape\raggedright}{}{0em}{} [{\vspace{0cm}\titlerule[1pt]}]
\section{TEST2}
Bla bla2

\titleformat{\section}{\large\scshape\raggedright}{}{0em}{} [{\titlerule[1pt]}]
\section{TEST2}
Bla bla3

\end{document}

在此輸入影像描述

相關內容