使部分样式与回忆录类中的章节样式 VZ34 相匹配

使部分样式与回忆录类中的章节样式 VZ34 相匹配

我使用的是略微改编的章节样式 VZ34(可在 Madsen 的“各种章节样式”PDF 中找到,是 VZ39 的变体),我也想将其应用于我的部分划分的布局。以下是章节样式的 MWE(可生成默认部分样式):

\documentclass[12pt,twoside]{memoir}

\renewcommand*{\thepart}{\arabic{part}}

\usepackage{calc}
\newif\ifNoChapNumber
\makeatletter
\makechapterstyle{VZ34}{
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\printchapternum{}
\renewcommand\chapnumfont{\Large\bfseries}
\renewcommand\chaptitlefont{\Large\bfseries\raggedright}
\renewcommand\printchaptertitle[1]{%
\begin{tabular}{@{}p{1cm}|!{\quad}p{\textwidth-1cm-2em-4\tabcolsep }}
\ifNoChapNumber\relax\else\chapnumfont \thechapter\fi
& \chaptitlefont ##1
\end{tabular}
\NoChapNumberfalse
}
\renewcommand\printchapternonum{\NoChapNumbertrue}
}
\chapterstyle{VZ34}

\renewcommand*{\cftpartname}{Part}
\renewcommand*{\cftpartpresnum}{\space}

\begin{document}
\part{This is a test}
\chapter{I am a test}
\end{document}

这产生了以下章节和部分的布局: 在此处输入图片描述

最终,部分样式的格式与章节样式只有两个不同之处。首先,它应该保持垂直居中,但(如果可能)右对齐。与章节标题的唯一主要区别是它必须在数字前面保留“部分”一词(以将其与章节顺序区分开来——不幸的是,两者都必须用阿拉伯数字编号)。但除此之外,我希望它具有与章节标题中看到的相同的单行和垂直分隔线布局。

我尝试调整章节样式的代码以适应各个部分,但遇到了没有等价于\printchapternonum各个部分的问题(可能还有其他问题,但目前我不确定如何继续)。有没有更好的方法来实现类似的布局?

答案1

这个答案不能解决不存在等价部分的问题\printchapternonum,但除非您需要非编号部分,否则以下代码应该可以工作:

\documentclass[12pt,twoside]{memoir}

\renewcommand*{\thepart}{\arabic{part}}

\usepackage{calc}
\newif\ifNoChapNumber
\newif\ifNoPartNumber
\makeatletter
\makechapterstyle{VZ34}{
\renewcommand\chapternamenum{}
\renewcommand\printchaptername{}
\renewcommand\printchapternum{}
\renewcommand\chapnumfont{\Large\bfseries}
\renewcommand\chaptitlefont{\Large\bfseries\raggedright}
\renewcommand\printchaptertitle[1]{%
\begin{tabular}{@{}p{1cm}|!{\quad}p{\textwidth-1cm-2em-4\tabcolsep }}
\ifNoChapNumber\relax\else\chapnumfont \thechapter\fi
& \chaptitlefont ##1
\end{tabular}
\NoChapNumberfalse
}
\renewcommand\printchapternonum{\NoChapNumbertrue}
}
\chapterstyle{VZ34}

\renewcommand*{\cftpartname}{Part}
\renewcommand*{\cftpartpresnum}{\space}

\renewcommand{\partnamefont}{\huge\bfseries\raggedright}
\renewcommand{\midpartskip}{}
\renewcommand\printparttitle[1]{%
\hspace{1ex}\begin{tabular}[t]{|!{\hspace{1ex}}p{\textwidth-3cm-2em-4\tabcolsep }}
\parttitlefont #1
\end{tabular}
}

\begin{document}

\part{This is a test for a very long long long long title}

\chapter{I am a test with a very long long long long title}

\end{document}

在此处输入图片描述

相关内容