Text FormattingKOMA-Script | Unnumbered Chapters on same Page and in ToC

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
wiebke
Posts: 4
Joined: Fri Oct 19, 2012 2:05 pm

KOMA-Script | Unnumbered Chapters on same Page and in ToC

Post by wiebke »

Hello,

I'm currently writing my thesis. Our university requires an Abstract in both German and English. Both of them are supposed to go onto the same page, but in front of the table of contents. As they do not belong to the main document, I would like them not numbered.

For my document, I chose »scrreprt« from koma-script and the Abstract will be on the chapter level. I found a solution to suppress the page break after the chapter and one solution to suppress numbering of the chapter while still adding it to the ToC, but I am not sure how to combine both.

Here is what I have so far:

Code: Select all

\documentclass[a4paper, 11pt, parskip=half, twoside, openright, pointlessnumbers, toc=bibliography, liststotoc, captions=tableheading]{scrreprt}
\usepackage[english]{babel}
% define chapter without pagebreak for abstract
\makeatletter
\newcommand\Abstractchap{%
                    \par\vspace{2cm}
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\makeatother

\begin{document}
\Abstractchap{Abstract}
\addcontentsline{toc}{chapter}{Abstract}
some text here
\Abstractchap{Zusammenfassung}
\addcontentsline{toc}{chapter}{Zusammenfassung}
some more text here
\tableofcontents % Table of Contents
\chapter{Introduction}
and some text right here
\end{document}
This of course numbers the chapters "Abstract" and "Zusammenfassung" both on the page where they are set and in the ToC. It also adds a second, unnumbered entry to ToC.

What I want is unnumbered chapters, only one unnumbered entry in ToC and the chapter Introduction numbered with 1. I tried adding stars to the chapter in the definition of Abstractchap, but I only get errors here (e.g. Argument of \@schapter has an extra }).

I'm new to this forum and did not find how to include error messages. I hope my minimum working example is minimum :-). If it should not work, please tell me and I'll try to provide a new one.
Last edited by cgnieder on Fri Oct 19, 2012 2:23 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

KOMA-Script | Unnumbered Chapters on same Page and in ToC

Post by cgnieder »

Hello Wiebke,

Welcome to the LaTeX community! Your MWE is very good! :)

You can have this easier: KOMA-Script offers \addchap for an unnumbered chapter that's supposed to be in the table of contents.

You have used some obsolete options. In the MWE below I replaced them with the recommended ones. I also added the right language support. In your German abstract you'll want German hyphenation patterns.

Code: Select all

\documentclass[
  a4paper,
  11pt,
  parskip=half,
  twoside,
  openright,
%   pointlessnumbers, % obsolete, recommended:
  numbers=noenddot,
  toc=bibliography,
%   liststotoc, % obsolete, recommended:
  listof=totoc,
  captions=tableheading
]{scrreprt}
\usepackage[ngerman,english]{babel}


\begin{document}
\addchap{Abstract}
some text here

\addchap{Zusammenfassung}
\selectlanguage{ngerman}% ensure the right hyphenation patterns for German
Etwas Text hier.

\selectlanguage{english}% and don't forget to switch back to English
\tableofcontents % Table of Contents

\chapter{Introduction}
and some text right here

\end{document}
Regards
site moderator & package author
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

KOMA-Script | Unnumbered Chapters on same Page and in ToC

Post by cgnieder »

Ok, I overread that they both should be on the same page. This can be done by temporarily disabling \clearpage:

Code: Select all

\documentclass[
  a4paper,
  11pt,
  parskip=half,
  twoside,
  openright,
%   pointlessnumbers, % obsolete, recommended:
  numbers=noenddot,
  toc=bibliography,
%   liststotoc, % obsolete, recommended:
  listof=totoc,
  captions=tableheading
]{scrreprt}
\usepackage[ngerman,english]{babel}


\begin{document}
\addchap{Abstract}
some text here

% start a group that keeps changes local and disable \clearpage
\begingroup\let\clearpage\relax
\addchap{Zusammenfassung}
\selectlanguage{ngerman}% ensure the right hyphenation patterns for German
Etwas Text hier.

% end group
\endgroup
\tableofcontents % Table of Contents

\chapter{Introduction}
and some text right here

\end{document}
abstract-en-de-1.png
abstract-en-de-1.png (10.35 KiB) Viewed 8167 times
abstract-en-de-2.png
abstract-en-de-2.png (6.87 KiB) Viewed 8167 times
Regards
site moderator & package author
wiebke
Posts: 4
Joined: Fri Oct 19, 2012 2:05 pm

Re: KOMA-Script | Unnumbered Chapters on same Page and in To

Post by wiebke »

Thank you Clemens,
for pointing out the possibility to change languages, I didn't think of that yet and added it to my document. I also removed all the obsolete options (that happens if you take someone else's two year old document and are just happy that it's working)

Your code works nicely for removing the numbers. When I tested it, however, Abstract and Summary will be on different pages. I need them to be on the same page however.

Is there a way to modify the \addchap command to suppress the page break?
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Re: KOMA-Script | Unnumbered Chapters on same Page and in To

Post by cgnieder »

See my second answer. I overread that point when I first answered your question.

Regards
site moderator & package author
wiebke
Posts: 4
Joined: Fri Oct 19, 2012 2:05 pm

Re: KOMA-Script | Unnumbered Chapters on same Page and in To

Post by wiebke »

I just saw that. I tested it and it works perfectly, thanks!

And I just noticed that changing all the obsolete options has mysteriously removed the weird headings and page numbers on the pages before a new chapter is started. Nice, I didn't get around to taking care of that yet :-D
Post Reply