Forum Samples, Tips and Tricks

Section numbering - skip first section

mknight
Hi there

I'm trying to create some output that includes chapter and section numbering and seem to have got that bit working okay.

However, my document contains a chapter introduction at the start and a summary at the end, which should not have section numbering applied.

Is there a way to do that?

Thanks in advance

Matt
mikeday
What CSS are you using to apply the numbering? You could use a named page rule to override it.
mknight
Hi Mike

The CSS looks like this:

/* this sets the chapter number */
article > .topictitle1:before {
  counter-reset: section_level1;
  content: counter(section_level1) " ";
}
article > .topictitle1 {
  counter-increment: section_level1;
  counter-reset: section_level2;
}

/* section numbering */
.topictitle2::before {
  counter-increment: section_level2;
  content: counter(section_level1) counter(section_level2, upper-alpha) " ";
}
.topictitle2 {
  counter-reset: section_level3;
}
.topictitle3::before {
  counter-increment: section_level3;
  content: counter(section_level1) counter(section_level2, upper-alpha) counter(section_level3) " ";
}
.topictitle3 {
  counter-reset: section_level4;
}
.topictitle4::before {
  counter-increment: section_level4;
  content: counter(section_level1) counter(section_level2, upper-alpha) counter(section_level3) counter(section_level4, upper-alpha) " ";
}
.topictitle4 {
  counter-reset: section_level5;
}



Each section should include the chapter number as a prefix, e.g. '1A', as well as the preceding section number on lower levels, e.g. '1A1'. The introduction section, should not have a chapter number or section number.

The attached PDF shows what I have achieved so far.

I have found the section on named pages in your user guide, so I will have a look at that tomorrow. If you have an example to hand, that would be great.

Many thanks

Matt
  1. section_numbering_test.pdf19.7 kB
    section numbering sample
mknight
Hi Mike

I have been able to identify the relevant sections that should not have section numbers with the following CSS:
/* this is to exclude section numbering from chapter intro */
article.learningOverview > .topictitle2::before,
article.learningSummary > .topictitle2::before,
article.book_question_answers > .topictitle2::before {
  color: pink;
  counter-increment: none;
  counter-reset: none;
  content:  counter(none) section_level1 (none) section_level2;
}


All this seems to do is reset the level2 counter to 'A0'. I have attached a new PDF. I used pink to highlight the section numbers. I could change the colour to white, but that wouldn't really be very elegant.

Also, the second chapter is numbered as '1', but the section numbers are labelled with correct chapter number prefix '2'. What have I missed here? - Update: just fixed this.

Many thanks

Regards

Matt
  1. section_numbering_test_2.pdf18.9 kB
    section numbering test 2

Edited by mknight