我正在使用以下代码
\documentclass[a4paper,12pt]{report}
%------------------------------------------------------------
\usepackage{amssymb,amsmath,amsthm,latexsym,mathrsfs,amsfonts,dsfont}
%-----accent
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
\chapter{Preliminary}
\end{document}
我希望得到这样的章节风格
对于无编号的章节。我希望得到这样的
答案1
titlesec
和 的解决方案tabularx
:
\documentclass[a4paper,12pt]{report}
%------------------------------------------------------------
\usepackage{amssymb,amsmath,amsthm,latexsym,mathrsfs,amsfonts,dsfont}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{titlesec}
\usepackage{tabularx}
\usepackage{lipsum}
\usepackage{titlesec}
\titleformat{\chapter}[display]{\filcenter\Huge\scshape\bfseries}{\begin{tabularx}{\textwidth}{@{}XcX@{}}\titlerule[5pt]& \large\mdseries\raisebox{-1.05ex}{\chaptername\enspace\arabic{chapter}} & \titlerule[5pt]\end{tabularx}}{-1ex}{\hrule\vspace{1ex} }[\vspace{0.75ex}\endgraf\hrule]
\titlespacing*{\chapter}{0pt}{-8ex}{20ex}
\begin{document}
\chapter{Preliminary}
\lipsum[1]
\end{document}
对于未编号的章节,您可以将此代码添加到序言中:
\titleformat{name=\chapter, numberless}[display]{\filcenter\Huge\bfseries}%
{\titlerule[5pt]}{-2.2ex}{\hrule\vspace{1.5ex}}[\vspace{0.75ex}\endgraf\hrule]
答案2
借助该titlesec
包,你可以实现类似的布局:
\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage[explicit]{titlesec}
\def\Vhrulefill{\leavevmode\leaders\hrule height 1ex depth \dimexpr0.4pt-0.4ex\hfill\kern0pt}
\titleformat{\chapter}
{\scshape\large}
{}
{0pt}
{\Vhrulefill~\chaptertitlename\ \thechapter~\Vhrulefill\vspace{0.75ex} \hrule\vspace{0.5ex}\centering\bfseries\Huge #1 \vspace{0.25ex}\hrule}
\begin{document}
\chapter{Preliminary}
\lipsum
\end{document}
Vhrulefill
取自这个答案并稍加修改。
答案3
为了完整性,这里是这样做的fncychap
:
\documentclass{report}
\usepackage{fncychap}
\usepackage{lipsum}
\makeatletter
\ChNameVar{\rm\scshape}
\ChNumVar{\rm}
\ChTitleVar{\huge\rm\scshape\centering}
\ChRuleWidth{5pt}
\renewcommand{\DOCH}{%
\leavevmode\leaders\vrule height \RW\hfill\quad
\CNV\FmN{\@chapapp}\space \CNoV\Roman{chapter}%
\quad\leaders\vrule height \RW\hfill\null
\par\nobreak
\vskip 10pt
}
\renewcommand{\DOTI}[1]{%
\hrule\vskip 10pt
\CTV\FmTi{#1}\par\nobreak
\vskip 10pt
\hrule
\vskip 40pt}
\renewcommand{\DOTIS}[1]{%
\hrule\vskip 10pt
\CTV\FmTi{#1}\par\nobreak
\vskip 40pt}
\makeatother
\begin{document}
\chapter{Preliminary}
\lipsum[1]
\end{document}