调整前言以适应章节样式 southall

调整前言以适应章节样式 southall

这个问题与这个; 我想知道如何修改southall章节样式,以便单词“目录”和“致谢”在左侧对齐。如果我用 替换,链接的答案适用于“致谢” \chapter{Acknowledgements}\chapter*{Acknowledgements}但我不知道如何(以正确的方式)将其添加到目录中。无论哪种情况,不幸的是,“目录”都是我无法修复的。这是一个 MWE:

\documentclass{memoir}

\makeatletter
%% Thomas Dye's southall chapter style (modified)
\makechapterstyle{southall-mod}{%
  \chapterstyle{default}
  \setlength{\afterchapskip}{5\baselineskip}
  \setlength{\beforechapskip}{36pt}%    \headindent
  \setlength{\midchapskip}{\textwidth}% \rightblock
  \addtolength{\midchapskip}{-\beforechapskip}
  \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
%%%  \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright}
  \renewcommand*{\chaptitlefont}{\huge\rmfamily\memRTLraggedright}
  \renewcommand*{\chapnumfont}{\chaptitlefont}
  \renewcommand*{\printchaptername}{}
  \renewcommand*{\chapternamenum}{}
  \renewcommand*{\afterchapternum}{}
  \renewcommand*{\printchapternum}{%
    \ifm@mpn@new@schap\else
      \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
        {\vspace{0pt}\chapnumfont%%%\figureversion{lining}
                     \thechapter}
      \end{minipage}%
    \fi}
  \renewcommand*{\printchaptertitle}[1]{%
    \ifm@mpn@new@schap\else
      \hfill
    \fi\begin{minipage}[t]{\midchapskip}
      {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
  \renewcommand*{\afterchaptertitle}{%
    \par\vspace{\baselineskip}%
    \hrulefill \par\nobreak\noindent \vskip \afterchapskip}}
\makeatother

\chapterstyle{southall-mod}

\begin{document}
\frontmatter
%\maketitle
\tableofcontents*
\chapter{Acknowledgements}
Thank you! Especially if you can help me justify ``Acknowledgements'' and ``Contents'' to the left.
southall-mod unfortunately does not do this.

\mainmatter
\chapter{I am totally justified thanks to the ``1''}
\chapter*{I am also justified thanks to southall-mod}
\section{I am also justified}
\section*{I am as well}
\end{document}

你有什么建议吗?提前谢谢。

结果: 在此处输入图片描述 在此处输入图片描述 在此处输入图片描述 在此处输入图片描述

答案1

我们必须添加另一个条件:如果我们不在主要事项上,就应该按照格式\chapter行事。\chapter*

\documentclass{memoir}

\makeatletter
%% Thomas Dye's southall chapter style (modified)
\makechapterstyle{southall-mod}{%
  \chapterstyle{default}
  \setlength{\afterchapskip}{5\baselineskip}
  \setlength{\beforechapskip}{36pt}%    \headindent
  \setlength{\midchapskip}{\textwidth}% \rightblock
  \addtolength{\midchapskip}{-\beforechapskip}
  \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
%%%  \renewcommand*{\chaptitlefont}{\huge\rmfamily\raggedright}
  \renewcommand*{\chaptitlefont}{\huge\rmfamily\memRTLraggedright}
  \renewcommand*{\chapnumfont}{\chaptitlefont}
  \renewcommand*{\printchaptername}{}
  \renewcommand*{\chapternamenum}{}
  \renewcommand*{\afterchapternum}{}
  \renewcommand*{\printchapternum}{%
    \ifm@mpn@new@schap\else
      \if@mainmatter
        \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
          {\vspace{0pt}\chapnumfont%%%\figureversion{lining}
                        \thechapter}
        \end{minipage}%
      \fi
    \fi}
  \renewcommand*{\printchaptertitle}[1]{%
    \ifm@mpn@new@schap\else
      \if@mainmatter\hfill\fi
    \fi\begin{minipage}[t]{\midchapskip}
      {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
  \renewcommand*{\afterchaptertitle}{%
    \par\vspace{\baselineskip}%
    \hrulefill \par\nobreak\noindent \vskip \afterchapskip}}
\makeatother

\chapterstyle{southall-mod}

\begin{document}
\frontmatter
%\maketitle
\tableofcontents*
\chapter{Acknowledgements}
Thank you! Especially if you can help me justify ``Acknowledgements'' and ``Contents'' to the left.
southall-mod unfortunately does not do this.

\mainmatter
\chapter{I am totally justified thanks to the ``1''}
\chapter*{I am also justified thanks to southall-mod}
\section{I am also justified}
\section*{I am as well}
\end{document}

在此处输入图片描述

相关内容