- // FIXME: only the counter corresponding to toplevel
- // sectioning should be reset
- Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
- cnts.reset();
- cnts.appendix(true);
+ // We want to reset the counter corresponding to toplevel sectioning
+ Layout const & lay =
+ buf.masterBuffer()->params().documentClass().getTOCLayout();
+ docstring const cnt = lay.counter;
+ if (!cnt.empty()) {
+ Counters & cnts =
+ buf.masterBuffer()->params().documentClass().counters();
+ cnts.reset(cnt);
+ }