第一个例子用 titlesec 宏包来实现代码如下:

\documentclass{book}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage[sc,compact,explicit]{titlesec} % Titlesec for configuring the header

\usepackage{tikz} % Tikz for the double underline (from: https://superuser.com/questions/1136672/double-underline-one-of-them-dashed)

\usepackage{auto-pst-pdf} % Vectorian Ornaments XeTeX auxiliary (from: https://tex.stackexchange.com/questions/253477/how-to-use-psvectorian-with-pdflatex)
\usepackage{psvectorian} % Vectorian Ornaments

\let\clipbox\relax % PSTricks (used by PSVectorian) already defines a \clipbox, so we need this workaround
\usepackage{adjustbox} % Adjustbox to rescale the ornaments (scalebox breaks titlesec for some reason...)

\makeatletter % Defining a overline (from: https://tex.stackexchange.com/questions/24132/overline-outside-of-math-mode)
\newcommand*{\textoverline}[1]{$\overline{\hbox{#1}}\m@th$}
\makeatother

\newcommand{\specdash}[1]{% % Defining a double underline (from: https://superuser.com/questions/1136672/double-underline-one-of-them-dashed)
    \tikz[baseline=(todotted.base)]{
        \node[inner sep=1pt,outer sep=0pt] (todotted) {#1};
        \draw ([yshift=-5pt]todotted.south west) -- ([yshift=-5pt]todotted.south east); % 5 pt below
        \draw ([yshift=-7pt]todotted.south west) -- ([yshift=-7pt]todotted.south east); % and 7 pt below
    }%
}%

\newcommand{\fancydraw}{% Defining a command to shorten things
\begin{adjustbox}{max height=0.5\baselineskip}% Rescaling to have height of 0.5\baselineskip
  \rotatebox{90}{% And rotating 90 degrees
    \psvectorian{26}% Ornament n° 26 (http://melusine.eu.org/syracuse/pstricks/vectorian/psvectorian.pdf)
  }%
\end{adjustbox}%
}

\titleformat% Formatting the header
  {\chapter} % command
  [block] % shape - Only managed to get it working with block
  {\normalfont\bfseries\sc\huge} % format - Change here as needed
  {} % label - Not using labels
  {0pt} % sep
  { \centering% Centering the title
    \textoverline{% Overlined
    \specdash{% And double-underlined
    \fancydraw% Inserting the ornament
    \hspace{1em}% Adding a space to the text
    #1% The actual chapter name
    \hspace{1em}% Another space after the title
    \rotatebox[origin=c]{180}{\fancydraw}% and a 180 degree rotated version of the ornament
}}}%

\begin{document}
\chapter{The beginning}
\blindtext
\end{document}

效果图如下:

BDgI6.png

例子代码二:

\documentclass{book}
\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage[sc,compact,explicit]{titlesec} % Titlesec for configuring the header

\usepackage{auto-pst-pdf} % Vectorian Ornaments XeTeX auxiliary (from: https://tex.stackexchange.com/questions/253477/how-to-use-psvectorian-with-pdflatex)
\usepackage{psvectorian} % Vectorian Ornaments

\let\clipbox\relax % PSTricks (used by PSVectorian) already defines a \clipbox, so we need this workaround
\usepackage{adjustbox} % Adjustbox to rescale the ornaments (scalebox breaks titlesec for some reason...)

\newcommand{\otherfancydraw}{% Defining a command to shorten things
\begin{adjustbox}{max height=0.5\baselineskip}% Rescaling to have height of 0.5\baselineskip
  \raisebox{-0.25\baselineskip}{
  \rotatebox[origin=c]{45}{% And rotating 90 degrees
    \psvectorian{7}% Ornament n° 26 (http://melusine.eu.org/syracuse/pstricks/vectorian/psvectorian.pdf)
  }}%
\end{adjustbox}%
}

% A command to create a rule centered vertically on the text (from: https://tex.stackexchange.com/questions/15119/draw-horizontal-line-left-and-right-of-some-text-a-single-line/15122#15122)
\newcommand*\ruleline[1]{\par\noindent\raisebox{.8ex}{\makebox[\linewidth]{\hrulefill\hspace{1ex}\raisebox{-.8ex}{#1}\hspace{1ex}\hrulefill}}}

\titleformat% Formatting the header
  {\chapter} % command
  [block] % shape - Only managed to get it working with block
  {\normalfont\bfseries\sc\huge} % format - Change here as needed
  {\centering Chapter \thechapter\\} % The Chapter N° label
  {0pt} % sep
  {\centering \ruleline{\otherfancydraw}\\ % The horizontal rule
  \centering #1} % And the actual title

\begin{document}
\chapter{The beginning}
\blindtext
\end{document}

效果图如下:

Fg54e.png

选自:https://tex.stackexchange.com/questions/384793/traditional-fancy-chapter-headings?rq=1 

点赞(2)

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部