3

When using the hyperref package along with memoir and the article option, the last line of a chapter gets pulled to the next page with the start of the next chapter, like this:

memoir

Here's a MWE:

\documentclass[12pt, oneside, openany, a4paper, article]{memoir}

\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}
    \chapter{Whatever}
    \lipsum[1-4]
    \chapter{Whatever}
    \lipsum[5]
\end{document}

If you remove hyperref that line goes back to its place at the bottom of the first page.

I know memoir has problems with hyperref, but I still want to use both packages and this is the only problem I encountered so far, so I was hoping there's a way to work around it.

I can, of course, add a \clearpage before the affected chapters, but that's not a very nice solution, and I have to wait until my text is done until I can figure out where the page breaks are needed.

(I do not want every chapter to start on a new page, hence the article option. I just don't want them to pull the previous line when they happen to start on a new page.)

Any ideas?

  • Add the instruction \widowpenalty10000 if you want to suppress all (typographic!) widows. – Mico Aug 8 '16 at 22:25
  • @Mico Thanks, but that will just bring yet another line to the second page and leave an even bigger unnecessary gap at the bottom of the first, so I'd still prefer to add a \clearpage before the chapter then. Also I don't necessarily want to suppress all widows (I already had widowpenalty at 9999), but these have no reason to exist at all, they're just a bug. – dbmrq Aug 8 '16 at 22:30
  • Exactly which problems does memoir have with hyperref? – daleif Aug 9 '16 at 6:28
  • @daleif Well, the manual says this in the introduction: "most packages work with the memoir class, the main exception being the hyperref package." And then is goes on to describe a workaround (calling \usepackage{memhfixc} after hyperref, which still doesn't fix my problem) and it mentions a few random issues throughout other sections. That's pretty much all I know. – dbmrq Aug 9 '16 at 7:02
  • memhfixc is automatically loaded after hyperref, no need to do ity automatically. It is needed to resurrect some memoir features that hyperref overwrites. – daleif Aug 9 '16 at 7:34
1

Just repeating my comment as an answer. If anyone can explain why it happens I'd like to know.

I have no idea why it is doing this when hyperref is loaded. There is nothing in memhfixc that is related to how chapters are formatted. When the article option is active, a \chapter starts with \par\@nameuse{chapterblock} (\chapterblock is undefined by default) which seems to be the problem. Might be that hyperref is inserting anchors into the \chapter command and these get messed up with the \par. I tried

\newcommand\chapterblock{\vskip0pt} 

which seems to work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.