Have an alternative text but no caption or a different caption in bookdown::git_book

In an bookdown::git_book I'd like to

  • have alternative text for figures (alt), but no caption
  • or even have an alternative text that's different from the caption.

At the moment it seems both are controlled by the chunk parameter fig.cap.

To disable figure captions in the whole document, the fig_caption config param didn't work so I resorted to CSS in this minimal example with @rlesur's help.

I have two related questions:

  • Is there a better way to disable figure captions in the whole book?
  • Could one have captions that are different from the alternative text?

I'm sorry if I missed a previous question / issue about this and welcome any insight.

2 Likes

sounds like you already used:

fig_caption: false

in the markdown header options?
I understand you want to disable figure captions throughout the whole book, but the only other option I found at the moment is to put a "\" at the end of the image chunk, eg.

![my caption](C:/mypath/myimage.png)\

let me know if this is still an issue and I can try again

1 Like

Thanks, yes the option didn't work.

I saw that trick with the backslash too but my images are generated by R, so I'd need to edit the plot hook.

I've opened an issue in bookdown repo itself.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.