我目前正在使用 memoir 编写一个较长的文档,其中只有章节和小节(以及小节和段落)。如果我想让章节标题和节标题交替出现在页眉中,我可以这样写
\makeevenhead{plain}{}{\rightmark}{}
\makeoddhead{plain}{}{\leftmark}{}
但由于我的文档中没有章节,我想交替使用章节标题和小节标题。我该怎么做?
以下是 MWE:
\documentclass[twoside]{memoir}
\makepagestyle{plain}
\makeevenhead{plain}{}{\thesubsection want subsection title here}{}
\makeoddhead{plain}{}{\rightmark}{}
\makeheadrule{plain}{\textwidth}{0.5pt}
\usepackage[usehighlevels]{alnumsec}
\alnumsectionlevels{1}{section,subsection,subsubsection,paragraph}
\alnumsecstyle{aaaa}
\surroundarabic[{.}][]{}{}
\otherseparators{1}
\alnumsecstyle{aaaa}
\usepackage{lipsum}
\begin{document}
\pagestyle{plain}
\section{This appears in the header properly}
\subsection{How to get this into the header?}
\lipsum
\end{document}
提前致谢!
答案1
这是那些 * 命令的问题\mark
。我认为这就是您所希望的(MWE 略微扩展):
\documentclass[twoside]{memoir}
\makepagestyle{plain}
\makeevenhead{plain}{}{\rightmark}{}
\makeoddhead{plain}{}{\leftmark}{}
\makeheadrule{plain}{\textwidth}{0.5pt}
\renewcommand*{\sectionmark}[1]{%
\markboth%
{\thesection.\ \MakeTextUppercase{#1}}%
{\thesection.\ \MakeTextUppercase{#1}}}
\renewcommand*{\subsectionmark}[1]{\markright{\thesubsection.\ #1}}
\usepackage[usehighlevels]{alnumsec}
\alnumsectionlevels{1}{section,subsection,subsubsection,paragraph}
\alnumsecstyle{aaaa}
\surroundarabic[{.}][]{}{}
\otherseparators{1}
\alnumsecstyle{aaaa}
\usepackage{lipsum}
\begin{document}
\pagestyle{plain}
\tableofcontents
\section{This appears in the header properly}
\subsection{How to get this into the header?}
\lipsum[1-20]
\section{This appears in the header properly --- TOO}
\lipsum[1-20]
\subsection{How to get this into the header? --- TOO}
\lipsum[1-20]
\end{document}
基本上,您希望“标记两者”,这样\sections
如果没有子节,则\section
使用来自的信息,但您希望“标记右侧”信息,\subsection
以便在可用时使用。我还了解到您希望将\section
标题中的信息保留为大写。