行间标题

行间标题

因此,我想在章节标题上方和下方各显示一行scrreprt,例如:

_________________________________________________
1. Introduction
_________________________________________________

但行与标题之间的间距相同。

这就是我对这个包所做的尝试titlesec

\titleformat{\section}[display]
{}
{}
{}
{\titlerule
  \vspace{0.2pc}%
\thesection\bfseries\hspace{5pt}\filright}
[\vspace{0.1pc}%
  \titlerule]

但它仍然不能正常工作,例如在新页面上某一章节的开头,上边距和章节名称之间有很大空间,而我只能使用 才能在良好的位置获得章节编号\hspace{5pt}

srreprt之间:和是否有可能具有相同的代码scrbook?(替换\section\chapter等之后)

有谁能帮助我吗?

答案1

在下面的 MWE 中我使用了

\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}
{\titlerule
\vspace{1pc}%
\LARGE\thechapter\hskip 9pt#1}
{1pc}
{\titlerule
\vspace{1pc}%
\Huge}

给予

截屏

\titlespacing{\chapter}{0pt}{*4}{-0.1cm}

调整间距。您可以根据需要进行调整:)

\documentclass{scrreprt}

\usepackage[explicit]{titlesec}                     % customize section headings
\usepackage{lipsum}

% custom chapter
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}
{\titlerule
\vspace{1pc}%
\LARGE\thechapter\hskip 9pt#1}
{1pc}
{\titlerule
\vspace{1pc}%
\Huge}

% custom section
\titleformat{\section}
{\normalfont\Large\bfseries}
{\llap{\thesection\hskip 9pt}#1}
{0pt}
{}

% From the titlesec package
% \titlespacing{command}{left spacing}{before spacing}{after spacing}[right]
% spacing: how to read {12pt plus 4pt minus 2pt}
%           12pt is what we would like the spacing to be
%           plus 4pt means that TeX can stretch it by at most 4pt
%           minus 2pt means that TeX can shrink it by at most 2pt
%       This is one example of the concept of, 'glue', in TeX
\titlespacing{\chapter}{0pt}{*4}{-0.1cm}
\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{-5pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{-6pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{-6pt plus 2pt minus 2pt}

\begin{document}

\chapter{Introduction}

\end{document}

相关内容