2

I am using labbook document class which relies on scrbook. It starts a new page for each chapter, which I don't want to happen. Is there a way to force it to procede with a new chapter on the same page where the previous ends?

I tried

\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother

but it did not work.

Here is the MWE:

\documentclass[oneside]{labbook}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\chapter}{\if@openright\cleardoublepage\else\clearpage\fi}{}{}{}
\makeatother

\begin{document}

\labday{Monday}
First day in the lab.
\labday{Tuesday}
Second day in the lab.

\end{document}

Any suggestions?

2
  • Works for me, so you'll have to add a minimal working example (MWE) that illustrates your problem.
    – lockstep
    Feb 15, 2012 at 6:46
  • @lockstep: Sorry, I now added it to the question above.
    – Anja
    Feb 15, 2012 at 7:37

2 Answers 2

2

Because \labday uses \addchap (KOMA-Script's unnumbered version of \chapter), you have to patch this command. I added a \par at the start of the changed definition in case (as in your example) no \par or blank line is added before \labday in the document body.

\documentclass[oneside]{labbook}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\addchap}{\if@openright\cleardoublepage\else\clearpage\fi}{\par}{}{}
\makeatother

\begin{document}

\labday{Monday}
First day in the lab.
\labday{Tuesday}
Second day in the lab.

\end{document}
3
  • Thanks, this works perfectly! Is it actually possible to keep the heading with the chapter title? (in case of several chapters on one page it would be the first one)
    – Anja
    Feb 15, 2012 at 8:33
  • 1
    Try \renewcommand*{\chapterpagestyle}{headings}.
    – lockstep
    Feb 15, 2012 at 8:38
  • 2
    This patch does not work anymore because of internal changes of KOMA-Script some years ago.
    – esdd
    Jun 17, 2017 at 10:00
3

Since 2015 KOMA-Script provides command \RedeclareSectionCommand to change the style of the sectioning command \chapter from style=chapter to style=section:

\RedeclareSectionCommand[style=section,indent=0pt]{chapter}

Note that style section needs a value for indent while style chapter does not know this option.

\documentclass[oneside]{labbook}
\RedeclareSectionCommand[style=section,indent=0pt]{chapter}

\begin{document}
\labday{Monday}
First day in the lab.
\labday{Tuesday}
Second day in the lab.
\end{document}

results in

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .