Login  Register

Re: Customizing Figure Caption

Posted by stallio on May 10, 2019; 7:50pm
URL: https://discuss.asciidoctor.org/Customizing-Figure-Caption-tp6878p6909.html

This is a good workaround.

I've been using a similar workaround because I also need to include the chapter number/letter (A) in my figure numbers (A-1) but hadn't seen a way to get rid of that pesky space in the middle.

One tweak I would recommend is using the :doc-part: attribute from your first post instead of writing "A" directly into the caption. This way you can copy and paste the same caption in every chapter.

[caption="Figure {doc-part}-{counter:figure}", title=": This is the caption of the figure"]

I don't like the way that this inserts a colon at the beginning of the figure title, and was about to recommend moving the colon into the caption instead... when I realized that would mess up the cross references. There is a workaround for that too, if you really want:

[caption="Figure {doc-part}-{counter:figure}: ", reftext="Figure {doc-part}-{figure}", title="This is my caption"]


But now we're getting out of hand. What we really need are more options to configure the numbering itself, rather than manipulating the caption and label to fake it.

1. An option to include the chapter number/letter inside the figure number (see issues #702, 979).
2. Options for two separators: one inside the number (figure A-1 vs A.1), and one in between the number and the title (#1994).