Login  Register

Incorrect figure numbering when my document is split across multiple files

Posted by siddjain on Oct 16, 2019; 11:04pm
URL: https://discuss.asciidoctor.org/Incorrect-figure-numbering-when-my-document-is-split-across-multiple-files-tp7235.html

I have a document that is split into multiple files. My top level adoc looks like this:

:doctype: book
:leveloffset: 1

include::chap01.adoc[]

include::chap02.adoc[]

My chap02.adoc header has

:chapter: 2
:figure: 0

and I insert images into the chapter like

[id=transaction_flow, reftext={chapter}.{counter:figure}]
.Lifecycle of a transaction. 
image::transaction_flow.png[]

The problem I am running into is that the figure captions in chapter 2 do not start with Figure 2.1 even though I reset the figure counter to 0 in the header of chapter 2. Instead they start with Figure 2.X where X = count of figures in chapter 1 + 1. How can I fix this?