Document ClassesChapter Numbering in customized Document Classs

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
bertibott
Posts: 14
Joined: Wed Dec 12, 2018 3:32 pm

Chapter Numbering in customized Document Classs

Post by bertibott »

Hi,
I usually try to solve my coding problems by googling and reading... but I am super desperate right now. I am writing my master thesis using a template provided by my university.
The template uses a custom document class that claims to be based on scrreprt.

My problem is that while thie TOC has all the numbering for chapters, sections subsectios and so on these numbers are omitted in the actual document!

TOC:
1. Chapter Title
1.1 Section Title
1.1.1 Subsection Title

Document:

Chapter 1
Chapter Title
"...foo"

Section Title
"...bar"

What I would like to have is that the numbers... at least those of sections and below show up in the document:

Chapter 1
Chapter Title
"...foo"

1.1 Section Title
"...bar"

As far as I understand it this is the default behaviour of the scrrprt class so apparently the person who created the custom class has changed it.

I have spend the last two days on google trying to find how to fix this but have been unsuccessful!
I have attached the class and the tech root file....
Can somebody help me?
Attachments
thesis.tex
(2.68 KiB) Downloaded 394 times
kn-thesis.cls.tex
(182 Bytes) Downloaded 374 times
kn-thesis.cls
(27.3 KiB) Downloaded 416 times

Recommended reading 2024:

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

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

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Chapter Numbering in customized Document Classs

Post by kaiserkarl13 »

If scrrpt does what you want to do, I would open that class, find where it defines \@chapter and \@makechapterhead(and/or \chapter or even \@schapter and \@makeschapterhead) and copy the definition(s) into your .tex file. You will likely need to surround them with \makeatletter...\makeatother.
bertibott
Posts: 14
Joined: Wed Dec 12, 2018 3:32 pm

Chapter Numbering in customized Document Classs

Post by bertibott »

That's a good idea! I think...
but how do I find that class?
I have been looking at the documentation thingy... and done a google search but I cannot find anything useful...
What exactly am I looking for? The only thing name scrreprt links to a page telling me to have a look at the KOMA-Script documentation...
That's not what I want... or is it?

And wouldn't a class that loads another class need to actively change the behaviour of that loaded class?
I am very confused... and starting to think I have no idea how the whole thing is actually supposed to work :(
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Chapter Numbering in customized Document Classs

Post by Johannes_B »

It might be as simple as that your university class does something strange, or that you have an outdated package version etc.

The class does not define \@makechapterhead. It has a much more complex implementation of sectioning comands.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Chapter Numbering in customized Document Classs

Post by Stefan Kottwitz »

You did not post yet any code how you are writing section headings in the document. Du you use \section, \section*, \addsec, or any other command? \textbf and \addcontentsline or \addtocontents?

When I do it with that class and your document, with the code that you posted above, it works fine. I simply inserted:

Code: Select all

\chapter{Einleitung}
\section{Erster Abschnitt}
\subsection{Erster Unter-Abschnitt}
Then I got in the document:
output.png
output.png (12.99 KiB) Viewed 8757 times
Numbering is fine. You may do something different that we don't know yet.

Stefan
LaTeX.org admin
bertibott
Posts: 14
Joined: Wed Dec 12, 2018 3:32 pm

Chapter Numbering in customized Document Classs

Post by bertibott »

Stefan Kottwitz wrote: When I do it with that class and your document, with the code that you posted above, it works fine. I simply inserted:

Code: Select all

\chapter{Einleitung}
\section{Erster Abschnitt}
\subsection{Erster Unter-Abschnitt}
That is exactly what I did. And your result is exactly what I would like to get...

So when it worked for you I got suspicious.
I am usually using my laptop running Linux (Kubuntu 16.04). The LaTeX-editor I am using is Kile version 2.1 and pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian).

I tried it on another PC running windows 8.1
Using TeXMaker 5.0.2 and pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017/W32TeX)

The Laptop produces the wrong output... but the PC gives me exactly what I want...

So in general I can now relax and continue with my thesis... just need to remember to use the other computer to get the actual PDF that I am going to print...
But does anyone have an idea how I could fix this? (To get my Laptop to produce the correct output?)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Chapter Numbering in customized Document Classs

Post by Stefan Kottwitz »

Perhaps update TeX Live 2015 to 2018 or install TeX Live 2018 via tug.org instead of the possibly outdated Linx repositories.

Stefan
LaTeX.org admin
Post Reply