
回想録の組み込みスタイルに関して、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}