2

When I group my mainmatter to prevent it of inserting a blank page, my chapter numbering dissapears as well.

I can't seem to find any work-around or even why this is happening.

\documentclass[a4paper,10pt,twoside,twocolumn,openany]{book}
\usepackage{lipsum}

\begin{document} \frontmatter \tableofcontents

{ \renewcommand{\cleardoublepage}{\newpage} \mainmatter } \chapter{Two columns} \lipsum[1-5]

\chapter{Two columns again, but it's not} \lipsum[1-5] \end{document}

The moment I remove the curly braces, it starts working again.

Mathieu
  • 35
  • 2
  • The grouping here voids your \renewcommand and whatever \mainmatter does. What is it that you actually want to achieve? – Werner Dec 14 '21 at 23:41
  • I used this to remove a blank page when the front matter has an odd number of pages.

    I followed the instructions of the linked answer.

    When looking at the document classes, I think 'report' fits better for my use case, as it does not have the frontmatter, mainmatter and backmatter

    – Mathieu Dec 14 '21 at 23:55
  • as the comment under the answer you referenced indicates, that is a bad example to follow, – David Carlisle Dec 15 '21 at 01:07

1 Answers1

0

You can store whatever \cleardoublepage does and restore it after calling \mainmatter:

enter image description here

\documentclass[twoside,twocolumn,openany]{book}

\usepackage{lipsum}

\begin{document}

\frontmatter \tableofcontents

\let\oldcleardoublepage\cleardoublepage \renewcommand{\cleardoublepage}{\newpage} \mainmatter \let\cleardoublepage\oldcleardoublepage

\chapter{Two columns} \lipsum[1-5]

\chapter{Two columns again} \lipsum[1-5]

\end{document}

Werner
  • 603,163
  • This does solve my problem. Another solution to achieve what I needed was to remove the 'twoside' option or change from 'book' to report. – Mathieu Dec 17 '21 at 16:02