Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain how to number and reference equations in the docs #47

Open
dact221 opened this issue Nov 5, 2020 · 2 comments
Open

Explain how to number and reference equations in the docs #47

dact221 opened this issue Nov 5, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@dact221
Copy link

dact221 commented Nov 5, 2020

I found this article that explains how to number and reference figures and tables, but it doesn't explain how to do the same with equations. I have tried the bookdown style:

\begin{equation} 
  f\left(k\right) = \binom{n}{k} p^k\left(1-p\right)^{n-k} (\#eq:binom)
\end{equation} 

But it seems officedown doesn't recognize the equation environment.

I think it would be very helpful if you add this topic to the documentation of the project.

@davidgohel
Copy link
Owner

This part is managed by R Markdown/bookdown. There is no function related to equations in officedown.

I don't know a lot about equations, sorry. This is what I found about captions and equations: https://bookdown.org/yihui/rmarkdown-cookbook/cross-ref.html

This seems to work

---
output: 
  officedown::rdocx_document:
    base_format: "bookdown::word_document2"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.cap = TRUE)
library(officedown)
```

See Equation \@ref(eq:mean).

\begin{equation}
\bar{X} = \frac{\sum_{i=1}^n X_i}{n} (\#eq:mean)
\end{equation}



@dact221
Copy link
Author

dact221 commented Nov 5, 2020

Thanks for the example.

base_format: "bookdown::word_document2" works as expected, but the equation number is plain text. Is it possible to implement hyperlinked equation numbers in officedown like in tables and figures?

@davidgohel davidgohel added the enhancement New feature or request label Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants