如何製作像這樣的精美章節標題?

如何製作像這樣的精美章節標題?

我剛剛發現一些非常好的章節標題: 範例頁面

但我無法確切地弄清楚如何將規則擴展到頁邊距之外,並將圖形放在章節之前的頁面上,並將標題放在下一頁(章節標題)上。 (頁腳上的一些提示也很好)。

其他頁面的佈局看起來幾乎相同:

在此輸入影像描述

答案1

這是一個解決方案:使用套件我定義了一個帶有一個可選參數和兩個強制參數的xparse新命令;\ChapIma可選參數是用於目錄的文字;第一個強制參數是文件的文本,第三個強制參數是包含相應圖像的文件的名稱。

titlesec包用於自訂章節標題格式。

我還定義了另一個命令\Caption,它的行為與標準標題相同,但在為邊注保留的空間中寫入文字。該指令必須在本章文字第一行的某個位置呼叫。

caption包用於自訂邊注中的標題(抑制標籤)。

lettrine封裝用於生產下沉蓋。

我使用了fancyhdr套件(我無法使titlesecpagestyles選項表現良好,所以我不得不使用fancyhdr)來重新定義plain頁面;我還定義了其他頁面的頁面樣式。

\documentclass[twoside]{book}
\usepackage{xparse,ifthen}
\usepackage[calcwidth]{titlesec}
\usepackage{changepage}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{fancyhdr}
\usepackage{marginnote}
\usepackage{lettrine}
\usepackage{lipsum}

\newlength\mylen

\DeclareDocumentCommand\ChapIma{omm}
  {\let\cleardoublepage\relax
    \ifthenelse{\isodd{\value{page}}}
      {\mbox{}\clearpage}{\mbox{}\clearpage\mbox{}\clearpage}%
    \resizebox{.9\textwidth}{.9\textheight}{\includegraphics{#3}}
    \mbox{}\thispagestyle{empty}\clearpage
    \IfNoValueTF{#1}{\chapter{#2}}{\chapter[#1]{#2}}
  }

\DeclareDocumentCommand\Caption{om}
  {\marginnote{\parbox{\marginparwidth}{%
      \captionsetup[figure]{labelformat=empty}
    \IfNoValueTF{#1}{\captionof{figure}{#2}}{\captionof{figure}[#1]{#2}}
      }%
    }%
  }

\titleformat{\chapter}[display]
  {\Huge\normalfont\sffamily}{}{2pc}  
  {\setlength\mylen{0pt}%
    \addtolength\mylen{\marginparwidth}%
    \addtolength\mylen{\marginparsep}\raggedleft
  }
  [\vspace{-20pt}%
   {%
      \begin{adjustwidth}{}{-\mylen}
        \makebox[\linewidth][r]{%
          \rule{\dimexpr\titlewidth+\mylen\relax}{0.4pt}%
        }%
      \end{adjustwidth}%
   }%
  ]
\titlespacing*{\chapter}{0pt}{1cm}{7cm}

\renewcommand\chaptermark[1]{\markboth{#1}{}}

\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[OR]{\sffamily\small\MakeUppercase{\leftmark}~~\oldstylenums{\thepage}}
  \renewcommand{\headrulewidth}{0pt}
  \renewcommand{\footrulewidth}{0pt}
  \fancyfootoffset[OR]{\dimexpr\marginparsep+\marginparwidth\relax}
}

\fancyhf{}
\fancyfootoffset[OR]{\dimexpr\marginparsep+\marginparwidth\relax}
\fancyfootoffset[EL]{\dimexpr\marginparsep+\marginparwidth\relax}
\fancyfoot[OR]{\small\sffamily\MakeUppercase{\leftmark}~~\oldstylenums{\thepage}}
\fancyfoot[EL]{\small\sffamily\oldstylenums{\thepage}~~\MakeUppercase{\rightmark}}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\pagestyle{fancy}

\renewcommand\chaptermark[1]{\markboth{#1}{}}
\renewcommand\sectionmark[1]{\markright{#1}}

\begin{document}

\tableofcontents

\ChapIma{Preface}{ctanlion}
\lettrine{T}{his} is some initial text\Caption{This is the caption for the figure; this is just some test text}
\lipsum[1-5]
\ChapIma{Introduction}{ctanlion}
\lipsum[1]
\section{Qu'ran manuscripts}
\lipsum[1-14]

\end{document}

這是生成的文檔的四頁圖像:

在此輸入影像描述

在此輸入影像描述

範例中使用的 CTAN 獅子是由 Duane Bibby 繪製的。

答案2

您可以使用該titlesec套件建立自訂標題樣式:

\documentclass{scrreprt}
\usepackage{titlesec}
\usepackage{lipsum}

\titleformat{\chapter}[display]{\Huge\sffamily}{}{3pc}{\raggedleft}[\footrule\vspace{8cm}]
\begin{document}
    \chapter{Preface}
        \lipsum
\end{document}

若要新增自訂頁腳,請使用以下fancyhdr套件:

\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}
\chead{}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{\chaptername\ \thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

若要調整邊距寬度,請使用下列geometry套件:

\usepackage[twoside,right=5cm]{geometry}

相關內容