# Memoir page number conflict with chapter header

I'm writing my thesis and I noticed that the page number on the upper right is written on top of some longer chapter headers. How can I solve this? I'm using 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}

• Usually this is solved with the optional argument of \chapter, e.g. \chapter[My short Title]{My Very Long Chapter Title Which Is Hated}. With this, My short Title goes into the header. But be aware, the short title is also used in the TOC. – Mike Oct 16 '17 at 20:34
• Another solution is not to use uppercase headers, then there are much more space in the header. Or use the memoir dual optional options, one (short) one ges to the header the other yo the toc – daleif Oct 16 '17 at 21:52
• yet another solution might be to use \markboth{short header text}{short header text}. that leaves the full title free to be used in the toc. – barbara beeton Oct 17 '17 at 1:09

The memoir class is extended in many ways compared to the standard classes. One of there extensions is the dual optional argos to the \chapter command (standard has only one)

\chapter[toc][header]{text}


if only one optional arg is given it us used both in the header and for the toc. So you could use

\chapter[text][shorter text]{text}


Sadly memoir does not support automatic dublicating the text to the toc.

In addition, upper case letters take up a lot if space, so you can save a lot of space in the header by switching that off. Assign usage if the standard headings style:

\nouppercaseheads

• Your way and "almost mine" are both here: latex.org/forum/viewtopic.php?t=192. The order seems to be opposite than yours. And my idea of stared with optional seems that was mamoir's idea too. I redefined the already defined stared chapter with optional argument. +1 for the simplicity. – koleygr Oct 16 '17 at 22:23
• @koleygr the order is probably the other way, I'm writing this from memory (away from pc). The issue with yours is also that you are overwriting the page style, there is no need for that. – daleif Oct 16 '17 at 22:32

Here is a solution :

    \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}%
}
\def\@StarredWithout#1{%
\oldchapter*{#1}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
}
\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}


I have used my redefinition of \section (but used it for \chapter) from here: https://tex.stackexchange.com/a/380116/120578

The idea is to use:

    \chapter*[short title for header]{title for chapter and TOC}


Starred chapter with optional does not ordinary exist but can be used with the code above.

Output of TOC:

Output of chapter1 title:

Edit:

Another option that uses your default settings and breaks the title using minipage (I don't recomend it but just adding to say you can do several things as reducing the fontsize... ignoring the word "Chapter" etc):

\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}%
}
\def\@StarredWithout#1{%
\oldchapter*{#1}%
}
\def\@nonStarred{%
\@ifnextchar[%
{\@nonStarredWith}%
{\@nonStarredWithout}%
}
\def\@nonStarredWith[#1]#2{%
\oldchapter[#1]{#2}%
}
\def\@nonStarredWithout#1{%
\oldchapter{#1}%
}
\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}

• I don't really see the need for all this code when memoir already have \chapter[header][toc] {text}  (the two first arg might be reversed) – daleif Oct 16 '17 at 22:08
• @daleif I don't use memoir often. Have just test it. Feel free to add an answer. My answer in independent of document class and I didn't knew that. – koleygr Oct 16 '17 at 22:11