Re: Problem with numbering of listings in a book
Posted by siddjain on
URL: https://discuss.asciidoctor.org/Problem-with-numbering-of-listings-in-a-book-tp7663p7669.html
Hi Alex,
Thanks.
This is working for me with one problem. I have a figure (or it could be a listing or table for that matter) in Chapter 2. It is correctly numbered as Figure 2.10 in that chapter, but when I try to reference it from Chapter 1 using <<chap2.adoc#the-figure>> the reference appears as Figure 1.10. So it does not insert the correct chapter number.
I have following preamble in the chapters
:xrefstyle: short
:listing-number: 0
:figure: 0
:figure-caption: Figure {chapter}.
:listing-caption: Listing {chapter}.
:table-caption: Table {chapter}.
the :listing-number: 0 is resetting listing counter to 0. Similarly :figure:0 resets the figure counter to 0.
and for chapter 1 I have
:chapter: 1
and for chapter 2 I have
:chapter: 2
in the preamble.
I suspect the bug has to do with the figure-caption I have inserted in the preamble.
How do I tell it to use the chapter number of the chapter that is being referenced instead of the chapter itself?