2

I know its counter-intuitive and doesn't make any sense at all, but bear with me. I am using the classic thesis style (in lyx), and the recommendation of my university ask me to do so. So currently My structure is something like this

Part 1 Introduction
  Chapter 1 AAAAA
  Chpater 2 BBBBB
  Chapter 3 CCCCC

Part 2 Something
  Chapter 4 DDDDD
  Chapter 5 EEEEE
  Chpter  6 FFFFFF

I need it turned into something like this

Part 1 Introduction
  Chapter 1.1 AAAAA
  Chpater 1.2 BBBBB
  Chapter 1.3 CCCCC

Part 2 Something
  Chapter 2.1 DDDDD
  Chapter 2.2 EEEEE
  Chpter  2.3 FFFFF

Needless to say, If the esctions and subsections can also ripple down like that That'd be great.

Any suggestions?

EDIT:

I received a suggestion to use

\renewcommand{\thechapter}{\arabic{part}.\arabic{chapter}}

The results look great. However, classic thesis does not support decimal points in chapter number (and it looks ugly).

Ugly solution

So I looked around the net and from this Move chapter number to chapter title in classicthesis, My chapter numbers look more acceptable like this

Good One

However, the chapter numbers do not reset when we change parts.

Suggestions?

EDIT: The counterwithin command bugs out the pdf bookmark like this, and when I use the LaTeX solution, this doesn't happen. enter image description here

  • Welcome to TeX.SX! With other words, the part number should precede the chapter number etc.? With normal LaTeX, the command is \renewcommand{\thechapter}{\arabic{part}.\arabic{chapter}}. Since (sub)sections obtain their number format from \thechapter, the numbering cascade should go on ;-) I have no clue for LyX, since I do not use it. – user31729 Jul 10 '14 at 11:55
  • Thanks, that solves the problem I asked for (used as a preamble). However, the classic thesis doesn't support decimal points as chapter numbers on the left hand side (it's a different font) – Rover Eye Jul 10 '14 at 11:59
  • Well, I just test it with a small document with classicthesis. Well, it looks awkward with decimal points, but another problem is, that \part does not reset the chapter number, but this can be cured easily – user31729 Jul 10 '14 at 12:07
  • Made it look slightly better (see Original Post). Can you suggest what to do to reset the chapter number ? I have not scripted in Tex before, but do have a small programming back ground – Rover Eye Jul 10 '14 at 12:21
1

A short answer, but too long for a comment and good highlighting. It is not meant to keep it.

For resetting, you have to add it the reset list (;-))

In the preamble, say after the last \usepackage{}, but before \begin{document}

\makeatletter
\@addtoreset{chapter}{part}
\makeatother

This will reset the chapter number when a new part starts!

  • Thanks, here is the final code I am using \renewcommand{\thechapter}{\arabic{part}.\arabic{chapter}} \@addtoreset{chapter}{part} – Rover Eye Jul 10 '14 at 15:51
  • @RoverEye: Ok, but please enclose those commands with the \makeatletter .... \makeatother pair. And happy texing ;-) I hope, you enjoyed the dark side of using direct \LaTeX commands ;-) – user31729 Jul 10 '14 at 15:55
  • Ah, but the thing is when I use the \makeatletter .... \makeatother commands, lyx hates it for some reason, and doesn't compile. – Rover Eye Jul 10 '14 at 16:11
  • @RoverEye: Really? Well, I have not used lyx so far. I wonder, that the \@addtoreset command works at all, since commands with @ only work when \makeatletter has been specified before or if they are in a .sty file. – user31729 Jul 10 '14 at 17:40
  • 1
    To clarify: LyX has an area where you can type commands that go directly into the preamble (which goes after the various parts of the preamble it generates automatically). LyX does indeed surround the LaTeX entered there with a \makeatletter / \makeatother pair. – Jim Oldfield Jul 11 '14 at 12:12
3

You can use the chngcntr package:

\usepackage{chngcntr}
\counterwithin{chapter}{part}

both will reset the chapter counter each time a new part begins and will prefix the chapter counter with the part counter.

  • Thanks for this, but this seems to break classic thesis for some reason. However, the LaTeX solution offered below works. – Rover Eye Jul 10 '14 at 15:53
  • ?? I tried with classicthesis, but didn't notice anything. What's broken? – Bernard Jul 10 '14 at 18:01
  • The PDF bookmarks add the word "chapter" in front of every bookmark? Do keep in mind that I am using Lyx ? Or is it something that only I am seeing ? – Rover Eye Jul 10 '14 at 20:13
  • 1
    @Rover Eye: I cannot imagine that the solution with the \counterwithin command interferes with classicthesis. And I wonder which connection to bookmarks might exist – user31729 Jul 10 '14 at 20:15
  • OK. I couldn't keep Lyx in mind as I don't have it on my system: I only can give general answers. – Bernard Jul 10 '14 at 20:15

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.