Counter problem?

berntl's picture

I use SWP 5.5, build 2960.

I'm working on a Standard LaTeX book style document, which is meant to hold a collection of examples of dynamic models. I want to refer to the models according to the chapter/section where they are given, i.e. 1.1, 1.2, 1.3, ..., 2.1, 2.2, etc. At the same time, I want to include a section on modeling principles first in each chapter, and I thought these could be numbered 1.0, 2.0, 3.0, etc. Also, I'd like to have an "overview" chapter, which could be Chapter 0.

I have tried with both \setcounter and \addtocounter, but in both cases, the section and subsection numbering is messed up.

What is the problem?

-B

Post a sample document that

Post a sample document that is structured with sample objects that show what the document will contain and then describe the numbering you want compared to what is appearing.  I don't fully understand your description, but having a full example should help.

berntl's picture

Ok -- I post 3 sample

Ok -- I post 3 sample documents.

1: ModLiB.pdf shows the table of content pages, which illustrate the degree of the problem.

2: slett.pdf shows the full document of a simplified version of ModLiB.

3: slett.tex shows what I have done in my document to produce slett.pdf.

-B

You placed some \addtocounter

You placed some \addtocounter commands in the division heading paragraphs.  This would cause the commands to also be present in the table of contents file.  I think this was causing your unexpected results.  I moved all \addtocounter commands and also all markers outside of the division heading paragraphs.  This leaves some cases where the paragraph following a heading contains only a marker, but that's okay since marker doesn't typeset anything, so LaTeX sees only an extra carriage return that is ignored as extra white space.

I also made changes at the end of the document.  You had the BibTeX field followed by the \addcontentsline command.  If you have a multiple page bibliography, the page number in the TOC would be for the last page of the bibliography since the \addcontentsline isn't seen until the end of the bibliography.  I added \cleardoublepage followed by the \addcontentsline command which is then followed by the BibTeX field.  The \cleardoublepage command does the same action as the beginning of a chapter (before the chapter title is typeset), so the TOC entry will be on the right page.  You would use \clearpage if using an article or report typesetting specification, or if you are using the book class option to start chapters on even numbered pages.

Attached is a modified version of your document with the changes described above.

berntl's picture

Thanks, I will test this.

Thanks, I will test this.

berntl's picture

Yes! It works! Thanks again

Yes! It works! Thanks again for quick support, as usual!

-B