Search code examples
equationquarto

Losing equations numbering when I render quarto document to word


I am losing equations numbering when I render quarto documents to word. This is what I have in my YAML metadata:

---
title: XXX
#author: "wananchi"
date: "`r Sys.Date()`"
format:
  docx:
    fontfamily: libertinus
    fontsize: 11pt
    spacing: double
    toc: false
    number-sections: true
editor: visual
bibliography: citations.bib
csl: apa.csl
---

And this is an example of one of my equations:

$$
ES_{w,t} = \varepsilon_wEP_{w,t}\tag{1}
$$

What could be the issue? I don't experience the problem when I render to pdf.

I tried using the code I specified above and seems like it's not working.


Solution

  • The equation numbering with \tag works for pdf output format, because \tag is a latex command, and with the help of MathJax, \tag also works for html output format, But it does not works for word document.

    Therefore, instead of using \tag, use #eq- label immediately after an equation to not only enable equation numbering for this equation but also make it cross referencable and it will work across different formats. Read this section from Quarto docs for a detailed example.

    ---
    title: XXX
    author: "wananchi"
    date: "`r Sys.Date()`"
    format:
      docx:
        fontfamily: libertinus
        fontsize: 11pt
        toc: false
        number-sections: true
    # editor: visual
    # bibliography: citations.bib
    # csl: apa.csl
    ---
    
    $$
    ES_{w,t} = \varepsilon_wEP_{w,t}\
    $${#eq-test}
    

    word output with equation numbering