Cross-reference To Figure In R Markdown With Html Output Is Not Working
Solution 1:
I'm not sure. But are you using bookdown
? If you follow https://bookdown.org/yihui/bookdown/get-started.html, and use bookdown project as in https://github.com/yihui/bookdown-minimal. Then you should get the result you want.
For example, I use https://github.com/yihui/bookdown-minimal and modify the index.Rmd
to something like this, and the cross reference shows correctly.
---
title: "A Book"
author: "Frida Gomam"
site: bookdown::bookdown_site
documentclass: book
output:
bookdown::gitbook: default
bookdown::pdf_book: default
---
{r foo, fig.cap="$f_{p}$ as a function of $g$ for various values of $r=\\frac{\\rho_{w}}{\\rho_{a}}$", echo=FALSE}
# All defaults
knitr::include_graphics("download.png")
A cross-reference to figure \@ref(fig:foo).
Update: Modify the output field to bookdown::html_document2
seems to generate the html document similar to rmarkdown::html_document
.
Post a Comment for "Cross-reference To Figure In R Markdown With Html Output Is Not Working"