LaTeX forum ⇒ Document Classesto know the number of chapters at the preamble Topic is solved

Information and discussion about specific document classes and how to create your own document classes.
lgassman
Posts: 3
Joined: Tue May 26, 2015 2:54 am

to know the number of chapters at the preamble

Postby lgassman » Wed Jun 10, 2015 4:47 pm

Hi!

I am trying to extract a class file from a tex document in order to be able to reuse the style of document. This document has a pattern that I am trying to generalize in order to create automatically this code. The pattern is:
For each chapter it declares a counter in the preamble.
At begin of document, for each counter it uses \setcounterpageref{<chaptercounter>}{<chapterlabel>}%
At begin of chapter it uses:
\hypertarget{<chapterlabel>}{}%
\label{<chapterlabel>}{}%

This pattern lets to use \hyperlink{topofpage.\arabic{<chaptercounter>}}{<description>}
in any location of document to create a link to top of the chapter page.

Note the value of <chaptercounter> and <chapterlabel> are hard-coded in the document, and these change chapter to chapter. I wish create a command with parameters to replace hard-coded values.

I am not sure if this pattern is the best way of do it, but works fine.
My problem to generalize it is that I don't known the count of chapters at the preamble, so, I don't knwow how many counters I must declares in "afterPreamble" hook and how many of \setcounterpageref lines I need to write in "at begin document" hook.

Thanks!

Tags:

BlackForestrian

Postby BlackForestrian » Wed Jun 10, 2015 10:42 pm

This is no answer, but just a question: Please clearify your question. The number of chapter in advance is possible with the cntperchap package, but I can't help more if there is not more information what you actually trying to achieve. It sounds very complicated at the moment.


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 5 guests