
關於回憶錄中的內建樣式,是否有一個簡單的命令或選項可以將hangnum章節樣式反轉為右對齊並將章節號放在右邊距?我遇到過一些實現此目的的自訂樣式範例,但我希望有一個簡單的解決方案。
答案1
這可以完成,但不能透過簡單的命令或選項來完成;必須定義新的章節樣式。以下是invhangnum
包含所需規格的章節樣式:
\documentclass{memoir}
\usepackage{lipsum}% just to generate text for the example
\makechapterstyle{invhangnum}{%
\setlength\beforechapskip{0pt}%
\renewcommand*\chapterheadstart{\vspace{\beforechapskip}}%
\setlength\afterchapskip{2\onelineskip plus .2\onelineskip minus 0.2\onelineskip}%
\renewcommand\chaptitlefont{\Huge\bfseries}
\setlength\midchapskip{-\baselineskip}%
\renewcommand\chapnumfont{\Huge\bfseries}
\renewcommand*{\printchaptername}{}
\renewcommand*{\chapternamenum}{}
\renewcommand*{\printchapternum}{%
\raisebox{\dimexpr\midchapskip+\baselineskip\relax}[0pt][0pt]{%
\makebox[0pt][l]{%
\makebox[\dimexpr\textwidth+4em\relax][l]{%
\parbox[t]{\textwidth}{\mbox{}}%
\parbox[t]{4em}{\hfill\chapnumfont \thechapter}}}}}%
\renewcommand*{\printchaptertitle}[1]{%
\raisebox{\dimexpr\midchapskip+\baselineskip\relax}[0pt][0pt]{%
\parbox[t]{\textwidth}{\raggedright\chaptitlefont ##1}}}%
}
\chapterstyle{invhangnum}
\begin{document}
\chapter{Test chapter}
\lipsum[2]
\end{document}