cssrknitrquarto

Change colon to period in figure caption in Quarto


When referencing a figure in a Quarto document and knitting to HTML, a colon is placed by default between the word Figure and the figure caption. I would like that colon to be a period.

I've tried a style.css file with the following but it doesn't work:

.figcaption::before {
content: "Figure " counter(fig): ". ";
}

Here is my quarto document:

---
title: "Periods are better than colons"
author: "Eric"
format:
  html:
    css: style.css
---

I'd like to replace the colon with a period in the caption for @fig-MyRLogo.

![RLogo](Rlogo.jpg){fig-align="left" #fig-MyRLogo}

And the output I get is:

Quarto output


Solution

  • This is controlled via the cross reference options with the title-delim parameter. Your YAML header should look like:

    ---
    title: "Periods are better than colons"
    author: "Eric"
    format:
      html
    crossref:
      title-delim: "."  
    ---