Open aoles opened 7 years ago
It is trivial to implement, but normally I refrain from styling elements on a too granular level. From the Preface of the bookdown book:
[...] It does not make much difference whether everything, or nothing, needs the reader’s attention.
Personally I don't think styling the figure caption prefix is that important. Readers will still know it is a figure even if you don't make it bold like Figure 1.2.
To be fair, I will welcome other users to upvote on this issue to show that I'm wrong, and I will be happy to reconsider this feature.
Personally, I think it's a nice option. The beauty is that you don't have to highlight text if you don't want to.
Thank you Yihui for sharing your thoughts on this! I see your point in keeping things simple and minimal, so I totally understand why you didn't implement it in first place. Nevertheless, I would argue that from the developer's perspective it would be useful to have the freedom of styling these elements in custom formats.
In my particular use-case I would like to visually distinguish the caption label and title from the more detailed description following them. I've already implemented a post_processor
which highlights the first sentence of the caption, but I'm missing a way of styling the label itself, as the labels are added only after my function gets called. See below for an idea of what I would like to achieve in the end.
I have also wondered about ways to customize caption labels. I use bookdown to write papers in APA style. The guidelines require that "Figure 1" is italicized and followed by a full stop. A pre- and postfix option would be sufficient to do this in Markdown syntax (prefix: *
, postfix: *.
). Similarly, pre- and postfix could be used to add HTML-tags with CSS attributes or LaTeX commands.
Could you give a small example how to do this @crsh? I would really like to have 'Fig. 2: caption text' instead of 'Fig. 2: caption text' as a figure caption. Thanks!
Hi @chrisdane, I was merely suggesting that additional options would be nice. I have written a custom Lua-filter for my particular application. I have described the general approach on a related StackOverflow question.
Hi Yihui, as indicated in our previous communication, I'm developing a custom HTML output format extending
bookdown::html_document2
. One of the things I would like to customize is the appearance of caption labels, in this particular case to make them boldface. For this, it would be great if the labels could be styled through CSS classes. This could probably be achieved by enclosing them in<span>
tags, e.g.<span class="caption-label">Figure 1:</span>
or similar. Unless I'm missing something, this should be trivial to implement; what do you think?Thanks, Andrzej