我正在写论文,我注意到右上角的页码写在一些较长的章节标题上面。我该如何解决这个问题?我正在使用 overleaf。
\documentclass[a4paper, 12pt, oneside]{memoir}
\usepackage[english]{babel}
\setcounter{page}{45}
\begin{document}
\chapter{My Very Long Chapter Title Which Is Hated}
\newpage
Some Content
\end{document}
答案1
与标准类相比,回忆录类在许多方面都得到了扩展。其中一个扩展是命令的双重可选 argos \chapter
(标准只有一个)
\chapter[toc][header]{text}
如果只给出一个可选参数,则它既可用于标题,也可用于目录。因此,您可以使用
\chapter[text][shorter text]{text}
遗憾的是,回忆录不支持自动将文本复制到目录。
此外,大写字母占用大量空间,因此您可以通过关闭大写字母来节省标题中的大量空间。指定标准标题样式的用法:
\nouppercaseheads
\pagestyle{headings}
答案2
这是一个解决方案:
\documentclass[a4paper, 12pt, oneside]{memoir}
\usepackage[english]{babel}
\setcounter{page}{45}
\usepackage{lipsum}
\let\oldchapter\chapter
\makeatletter
\def\chapter{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred chapter can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}
\def\@StarredWith[#1]#2{%
\oldchapter{#2}%
\makeoddhead{headings}{\slshape#1}{}{\thepage}%
}
\def\@StarredWithout#1{%
\oldchapter*{#1}%
\makeoddhead{headings}{\slshape\rightmark}{}{\thepage}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
\makeoddhead{headings}{\slshape\rightmark}{}{\thepage}%
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
\makeoddhead{headings}{\slshape\rightmark}{}{\thepage}%
}
\makeatother
\begin{document}
\tableofcontents
\chapter*[My short chapter title]{My Very Long Chapter Title Which Is Hated}
\newpage
Some content
\chapter{one other chapter here}
\lipsum[2]
\chapter*[ToC title for chapter 3]{Chapter3 full title}
\section{Test section}
\lipsum[3]
\end{document}
我从这里使用了对的重新定义\section
(但将其用于):\chapter
https://tex.stackexchange.com/a/380116/120578
我们的想法是使用:
\chapter*[short title for header]{title for chapter and TOC}
带有可选星号的章节通常不存在,但可以与上面的代码一起使用。
TOC 的输出:
第一章标题的输出:
输出下一页页眉:
编辑:
另一个选项是使用您的默认设置并使用 minipage 分解标题(我不推荐它,但只是补充说您可以做几件事,例如减小字体大小...忽略单词“章节”等):
还添加了,因为我使用了更接近您初始的标题定义。
\documentclass[a4paper, 12pt, oneside]{memoir}
\usepackage[english]{babel}
\setcounter{page}{45}
\usepackage{lipsum}
\let\oldchapter\chapter
\makeatletter
\def\chapter{%
\@ifstar{\@Starred}{\@nonStarred}%
}
\def\@Starred{%
\@ifnextchar[%
{\GenericWarning{}{Warning: A starred chapter can not have parameters. I am going to ignore them!}\@StarredWith}%
{\@StarredWithout}%
}
\def\@StarredWith[#1]#2{%
\oldchapter{#2}%
\makeoddhead{headings}{\begin{minipage}{0.9\linewidth}\rightmark\end{minipage}}{}{\thepage}%
}
\def\@StarredWithout#1{%
\oldchapter*{#1}%
\makeoddhead{headings}{\MakeUppercase{\rightmark}}{}{\thepage}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
\makeoddhead{headings}{\MakeUppercase{\rightmark}}{}{\thepage}%
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
\makeoddhead{headings}{\MakeUppercase{\rightmark}}{}{\thepage}%
}
\makeatother
\begin{document}
\tableofcontents
\chapter*[nothing needed here]{My Very Long Chapter Title Which Is Hated}
\newpage
Some content
\chapter{one other chapter here}
\lipsum[2]
\chapter[ToC title for chapter 3]{Chapter3 full title}
\newpage
Test
\section{Test section}
\lipsum[3]
\end{document}