LaTeX forum ⇒ Document ClassesChapter Numbering in customized Document Classs

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

Chapter Numbering in customized Document Classs

Postby bertibott » Wed Dec 12, 2018 3:53 pm

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 66 times
kn-thesis.cls.tex
(182 Bytes) Downloaded 67 times
kn-thesis.cls
(27.3 KiB) Downloaded 68 times

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

Postby kaiserkarl13 » Fri Dec 14, 2018 9:34 am

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

Postby bertibott » Fri Dec 14, 2018 12:29 pm

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: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Dec 14, 2018 1:45 pm

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: 9419
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Dec 14, 2018 3:43 pm

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:
  1. \chapter{Einleitung}
  2. \section{Erster Abschnitt}
  3. \subsection{Erster Unter-Abschnitt}


Then I got in the document:

output.png
output.png (12.99 KiB) Viewed 603 times


Numbering is fine. You may do something different that we don't know yet.

Stefan
Site admin

bertibott
Posts: 14
Joined: Wed Dec 12, 2018 3:32 pm

Postby bertibott » Fri Dec 14, 2018 6:59 pm

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:
  1. \chapter{Einleitung}
  2. \section{Erster Abschnitt}
  3. \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: 9419
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Dec 14, 2018 7:04 pm

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

Stefan
Site admin


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 2 guests