Document ClassesCustom Chapter Title

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
ge0rge04
Posts: 10
Joined: Sun Mar 28, 2010 12:23 am

Custom Chapter Title

Post by ge0rge04 »

Hello,

I use the scrreprt document class from koma-script, and \chapter{Maimuta Betivana} prints this.
1 Maimuta Betivana
I want to insert a newline between the chapter number and the chapter name like this.
1
Maimuta Betivana
How can I achieve this? Please use the same chapter number and name as in the example provided, so I could follow it up easier.

Thanks

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Custom Chapter Title

Post by localghost »

A quick hack could look like this.

Code: Select all

\documentclass[
  chapterprefix=on
]{scrreprt}
\usepackage[T1]{fontenc}

\renewcommand*{\chapterformat}{\thechapter\autodot\enskip}  % Redefinition of chapter prefix format

\begin{document}
  \chapter{Foo}
\end{document}
Note the option chapterprefix=on for the document class.


Thorsten
ge0rge04
Posts: 10
Joined: Sun Mar 28, 2010 12:23 am

Custom Chapter Title

Post by ge0rge04 »

It looks great now.

Meanwhile I found a solution online

Code: Select all

\renewcommand{\sfdefault}{mdugm}
\usepackage[ ]{titlesec}
\titleformat{\chapter}[display]
  { \normalsize \huge  \color{black}}
  {\flushleft \normalsize \MakeUppercase {  } \hspace{1 ex} { \fontsize{60}{60}\selectfont \sffamily  \thechapter }} {10 pt}{\huge}
but yours is nicer :)
Post Reply