我试图在label
章节之后获取一条规则。(即在“第 1 章”和“这是第 1 章标题”之间)。
到目前为止,我已经做到了这一点:
\titleformat{\chapter}[display]%
{\normalfont\filcenter}%
{\scshape\Huge \chaptertitlename{} \thechapter{} \\[2.75pt] {\titlerule[1pt]} \vspace*{-1\baselineskip}}%
{15pt}%
{\LARGE\bfseries}
梅威瑟:
\documentclass{report}
\usepackage{mathptmx} % For the drop cap
\usepackage[showframe]{geometry} %Just to show the frame
\usepackage{lettrine} %For the drop cap
%% Choose one option: titlesec or sectsty
\usepackage{titlesec}
\titleformat{\chapter}[display]%
{\normalfont\filcenter}%
{\scshape\Huge \chaptertitlename{} \thechapter{} \\[2.75pt] {\titlerule[1pt]} \vspace*{-1\baselineskip}}%
{15pt}%
{\LARGE\bfseries}
%\usepackage{sectsty}
%\chapternumberfont{\centering\sc\Huge\underline}
%\chaptertitlefont{\centering\LARGE}
\begin{document}
\chapter{Introduction}
\label{chap:Intro}
\lettrine[lines=3]{S}{ustained} bipedal locomotion is one of the main characteristics that separates the human being from other primates. For millennia this has marked a difference not only in the way \textit{Homo Sapiens} moves, but also has played a fundamental part in the evolution and subsequent development of human beings.
\end{document}
但我希望它看起来像这样:
我发现一个有点相关的问题:在 \section title 中添加小行,但它有一个小小的不便之处:它的长度是固定的。我希望规则根据标签宽度进行设置。
我也知道我可以通过使用该sectsty
包来实现图 1 的结果(这就是我首先得到图片的方式),但我希望能够编辑我的参考书目的章节标题,以便我可以设置与文档中其余章节标签相同的格式...我认为这只有在使用titlesec
(sectsty
不处理本地定义,只处理全局...我认为)的情况下才有可能。
还有可能同时使用这两个包(sectsty
设置全局选项,然后只用于titesec
最后的参考书目部分,但我对这个不太确定)。
答案1
你可以试试
\documentclass{report}
\usepackage{mathptmx} % For the drop cap
\usepackage[showframe]{geometry} %Just to show the frame
\usepackage{lettrine} %For the drop cap
\usepackage{booktabs}
%% Choose one option: titlesec or sectsty
\usepackage{titlesec}
\titleformat{\chapter}[display]%
{\normalfont\filcenter}%
{\begin{tabular}{c}\scshape\Huge \chaptertitlename{} \thechapter{} \\[1ex]\bottomrule[2pt]\end{tabular}}%
{15pt}%
{\LARGE\bfseries}
%\usepackage{sectsty}
%\chapternumberfont{\centering\sc\Huge\underline}
%\chaptertitlefont{\centering\LARGE}
\begin{document}
\chapter{Longer Introduction}
\label{chap:Intro}
\lettrine[lines=3]{S}{ustained} bipedal locomotion is one of the main characteristics that separates the human being from other primates. For millennia this has marked a difference not only in the way \textit{Homo Sapiens} moves, but also has played a fundamental part in the evolution and subsequent development of human beings.
\end{document}
要更改线的距离,请将其更改[1ex]
为您想要的任何距离。您可以更改线的宽度,我将其设置为[2pt]
,这可能太多了。请注意,我\usepackage{booktabs}
。