5

I have a block image inserted as shown below:

[[myimage]]
image::fig1.png[align="center", title="My caption"]

Unfortunately, the image is centered but the caption is left-aligned. I also tried doing this:

[[myimage]]
.My caption
image::fig1.png[align="center"]

but the result does not change. How can I get the image caption to also be center-aligned?

I am generating HTML output with this command (using xhtml11 as backend makes no difference):

asciidoc -v -a asciimath -d article -b html5 -o file.html file.txt

pap42
  • 1,236
  • 1
  • 17
  • 28

2 Answers2

1

Change the CSS style sheet to do the alignment for you.

Manfred Moser
  • 29,539
  • 13
  • 92
  • 123
0
  1. Create directory themes in your working directory then download this file into themes
  2. Modify the captions align from left to center as below:

caption:

align: center
  1. Specify theme file when generating pdf

asciidoctor-pdf ${adoc_file} -o ${output_pdf} -a pdf-stylesdir=themes -a pdf-style=custom-theme.yml