Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Possible Duplicate:
Resetting theorem counters: \sections and (missing) \subsections

I create a new counter as follow :

\newcounter{question}[section]

Thus at each new section thequestion is set to 1. If I do the following :

\newcounter{question}[subection]

thequestion is not set to 1 when a new section begin (without subsection). Is it possible to link a counter to both section and subsection ?

Thanks

share|improve this question

marked as duplicate by Werner, lockstep, Torbjørn T., Stephan Lehmke, percusse Aug 31 '12 at 21:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer

up vote 3 down vote accepted

You can use the chngcntr package, and then write

\counterwithin{question}{subsection} or section, the effect should be the same.

Otherwise, you can define the reset yourself

\makeatletter
\@addtoreset{question}{subsection}
\makeatother
share|improve this answer
    
@addtoreset work perfectly, thanks –  Ger Sep 3 '12 at 10:47
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.