我正在设计一本带有回忆录类的书。章节样式应类似于新高德书籍,章节标签和编号应在章节标题后的新行中显示,即
关于文艺复兴主题的论文
第1章
我找不到任何预定义或修改过的样式来实现这一点。垂直移动章节标签可能不是一个好主意,因为标题可能很长,然后会重叠。如何编码?
我的结构如下:
\documentclass[a4paper, 12pt, onecolumn, openany]{memoir}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\renewcommand{\chapnamefont}{\centering\LARGE\normalfont}
\renewcommand{\chapnumfont}{\centering\LARGE\normalfont}
\renewcommand\chaptitlefont{\centering\LARGE\normalfont}
\renewcommand\secheadstyle{\centering\Large\normalfont\noindent}
\addto\captionsngerman{\renewcommand{\chaptername}{Caput}}
\setmainfont{EB Garamond}
\begin{document}
\chapter{A treatise on some renaissance topic}
\end{document}
答案1
inverse
以下是使用包含字体的章节样式的一种选项:
代码:
\documentclass{memoir}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\addto\captionsngerman{\renewcommand{\chaptername}{Caput}}
\setmainfont{EB Garamond}
\makeatletter
\newlength\betweennametitle% to control separation between chapter title and name
\setlength\betweennametitle{-60pt}
\makechapterstyle{inverse}{
\chapterstyle{default}
\renewcommand{\chapnamefont}{\LARGE\normalfont}
\renewcommand{\chapnumfont}{\LARGE\normalfont}
\renewcommand\chaptitlefont{\centering\LARGE\normalfont}
\setlength{\beforechapskip}{10pt}
\setlength{\afterchapskip}{\dimexpr-\betweennametitle+20pt\relax}
\setlength{\midchapskip}{0pt}
\def\printchaptername{}
\renewcommand*{\printchapternonum}{%
\raisebox{\betweennametitle}[0pt][0pt]{%
\vphantom{{\chapnamefont\@chapapp}{\chapnumfont\thechapter}}%
}\afterchapternum\vskip\onelineskip\vskip-\topskip%
}
\renewcommand*{\printchapternum}{%
\raisebox{\betweennametitle}[0pt][0pt]{%
\makebox[\textwidth]{{\chapnamefont\@chapapp}\chapternamenum{\chapnumfont\thechapter}}%
}%
}%
}
\makeatother
\chapterstyle{inverse}
\begin{document}
\chapter{A test numbered chapter}
Some test text
\end{document}
请不要加载带有 fontspec` 的fontenc
字体inputenc
。