具体来说,只是包含“CHAPTER”的小灰色条和大章节号(在本例中为 14)
我使用以下文档作为起点:
\documentclass[11pt,a4paper]{book}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{amsmath,array}
\usepackage{lipsum}
\usepackage[
top=3cm,
bottom=2.8cm,
left=2.5cm,
right=2.5cm,
marginparwidth=0cm,
marginparsep=0cm,
headheight=13.6pt]{geometry}
\usepackage{fancyhdr}
\newcommand{\chapnumfont}{
\fontsize{144}{0}
\selectfont
}
\colorlet{chapnumcol}{black!55}
\titleformat{\chapter}[display]
{\bfseries}
{\begin{center}
\begin{tabular}{r!{$$}r}
& \hspace*{\fill}\makebox[14.71cm][r]{\chapnumfont\textcolor{chapnumcol}{\thechapter}} \\
\end{tabular}
\end{center}}
{0pt}
{\Huge}
\begin{document}
\sloppy
\chapter{A chapter}
\lipsum
\lipsum
\end{document}
答案1
一种解决方案可能是使用 TikZ(如果您同意的话)。这里有一个可以执行您要求的代码,虽然不太优雅:
\documentclass[11pt,a4paper]{book}
\usepackage{fontspec}
\usepackage{titlesec}
\usepackage{xcolor}
\usepackage{amsmath,array}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage[
top=3cm,
bottom=2.8cm,
left=2.5cm,
right=2.5cm,
marginparwidth=0cm,
marginparsep=0cm,
headheight=13.6pt]{geometry}
\usepackage{fancyhdr}
\newcommand{\chapnumfont}{
\fontsize{144}{0}
\selectfont
}
\colorlet{chapnumcol}{black!55}
\titleformat{\chapter}[display]
{\bfseries}
{\begin{tikzpicture}
\node[minimum width=\textwidth, text=black!25, fill=black!25, inner sep=1, outer sep=0, anchor=south] (rectinit) {\huge CHAPTER};
\node[minimum width=.8\textwidth, text=white, inner sep=1, outer sep=0, anchor=south west, text width=.8\textwidth, align=right] at (rectinit.south west) (chapname) {\huge CHAPTER~~};
\node[minimum width=.2\textwidth, inner sep=0, outer sep=0, anchor=south west, text width=.2\textwidth, align=left] at (chapname.south east) {\chapnumfont\textcolor{chapnumcol}{\thechapter}};
\end{tikzpicture}}
{0pt}
{\Huge}
\begin{document}
\sloppy
\chapter{A chapter}
\lipsum
\lipsum
\end{document}
由此获得的结果(我保留了您的颜色参数):
我希望这能对你有帮助。