因此,在网上查看后没有找到任何内容,我在这里问一下:
我如何将分页转换为“章节”样式(见下图)而不是按数字推进的页码。
PS:我也一直在寻找一个教程来编辑目录的所有功能(以及一般的页面设计)
答案1
更新
\documentclass{memoir}
\usepackage{lipsum} % just for example
\begin{document}
\maketitle
\pagenumbering{gobble}
\tableofcontents
\newpage
\pagenumbering{arabic} % you don't need this
\makeatletter
\@addtoreset{page}{chapter}
\renewcommand\thepage{\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@page}
\let\oldafterchaptertitle\afterchaptertitle
\renewcommand{\afterchaptertitle}{\oldafterchaptertitle\refstepcounter{page}}
\makeatother
\chapter{First}
\section{Foo}
\lipsum[1-20]
\chapter{Last}
\section{Bar}
\lipsum[1-20]
\end{document}
这是一个解决方案(类似的解决方案如何进行自定义页码)
\documentclass{memoir}
\usepackage{lipsum} % just for example
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@chapter}{\refstepcounter{chapter}}{\refstepcounter{chapter}\refstepcounter{page}}%
{}{\errmessage{problem in patching \noexpand\chapter}}
\@addtoreset{page}{chapter}
\renewcommand\thepage{\ifnum \c@chapter>\z@ \thechapter-\fi \@arabic\c@page}
\makeatother
\begin{document}
\tableofcontents
\chapter{First}
\section{Foo}
\lipsum[1-20]
\chapter{Last}
\section{Bar}
\lipsum[1-20]
% here you can see the problem, one can try \setcounter{chapter}{0} if all unnumbered chapter are at the end
\chapter*{Last}
\section{Bar}
\lipsum[1-20]
\end{document}