Since I don't know the full scope of your program and your goals, I'll provide a few suggestions where the problem could lie. Hopefully, there are some ideas here that you haven't tried yet (since you mentioned you've tried several solutions already). Please let me know how these work for you, or if you’ve already tried them, I’ll be happy to dig deeper:
1) correct CSS Selector for caption
I assume you may have tried this, but I’ll mention it just to cover all bases. For consistent styling of captions in HTML output, ensure you’re using the correct CSS selectors for figures and tables:
figure figcaption {
font-size: 16pt;
font-weight: bold;
}
table caption {
font-size: 16pt;
font-weight: bold;
}
This ensures that the figcaption element (for figures) and the caption element (for tables) are both styled appropriately.
2. be careful with multiple style tags
It looks to me like you have multiple style tags in your Rmd file. CSS in different tags might sometimes cause conflicts. Maybe try out if combining them in one block might some of the problems.
<style type="text/css">
body {
font-size: 16pt;
}
figure figcaption,
table caption {
font-size: 16pt;
font-weight: bold;
}
This might help resolve any conflicts and ensure consistent styling for all captions.
3. minimal R Markdown Example
If you're still facing problems, it could be helpful to try a minimal R Markdown example, as this will allow you to debug and isolate the issue further.
This can help you determine whether the issue is with the R Markdown setup or something else in your environment.
Hopefully, one of these solutions will help you resolve the caption formatting issue. If none of these work, feel free to provide more details on your environment, and I'd be happy to assist further!