3

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?

  • Works for me, so you'll have to add a minimal working example (MWE) that illustrates your problem. – lockstep Feb 15 '12 at 6:46
  • @lockstep: Sorry, I now added it to the question above. – Anja Feb 15 '12 at 7:37
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}
|improve this answer|||||
  • 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 '12 at 8:33
  • 1
    Try \renewcommand*{\chapterpagestyle}{headings}. – lockstep Feb 15 '12 at 8:38
  • 2
    This patch does not work anymore because of internal changes of KOMA-Script some years ago. – esdd Jun 17 '17 at 10:00
4

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

|improve this answer|||||

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.