user1641774
user1641774

Reputation:

Align image caption with image in asciidoc

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

Upvotes: 5

Views: 3847

Answers (2)

  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

Upvotes: 0

Manfred Moser
Manfred Moser

Reputation: 29912

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

Upvotes: 1

Related Questions