Closed pbiecek closed 2 years ago
The same issue was brought up in #26
Hi, the #26 is closed/solved, but the suggested solution is not working for equations
The issue with (#eq : parityLoss)
showing is due to specifying the label twice.
The correct code for this should be:
\begin{equation}
STP_{\textit{parity loss}} = \Big | \ln \Big( \frac{STP_b}{STP_a} \Big)\Big|.
\end{equation}
This notation is very helpful because it allows to accumulate $STP_{\textit{parity loss}}$ overall unprivileged subgroups, so not only in the binary case.
\begin{equation}
STP_{\textit{parity loss}} = \sum_{i \in \{a, b, ...\}} \Big|\ln \Big(\frac{STP_i}{STP_a} \Big)\Big|.
(\#eq:parityLoss)
\end{equation}
Equation \@ref(eq:parityLoss)
As for the numbering issue, this is probably trickier to fix.
web:
pdf:
The temporary quick fix for the inconsistent numbering is of course to always label equations, even if they aren't referred to. I think the fix for numbering equations without labels will need to occur in the bookdown side of the html rendering.
It seems that this is the documented behaviour of bookdown: https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#equations
For HTML output, bookdown can only number the equations with labels.
If you don't want to number equations, use an equation*
environment.
If you want to number equations, use an equation
environment and provide the label for it to be numbered. Bookdown does not automatically number equation
environments.
Closing as this is the documented behaviour of bookdown::html_document2()
.
Labelling of equations, figures and tables should be done in accordance with the bookdown format.
I really like the look of the HTML papers. However, I have a problem with the equations and have not found a good solution.
I have following chunk of code:
I would like to refer to the second equation. In LaTeX I use
\label{eq:parityLoss}
and in markdown(\#eq:parityLoss)
.It renders like that in HTML:
and like that in PDF:
One problem is that in markdown some equations are not numbered, so the numbering of equations differs between HTML and PDF.
The second problem is that in PDF the label
(#eq : parityLoss)
does not disappear.I have tried to deal with this by using conditional evaluation of R code chunks, but I have not been able to solve this problem.
Any suggestions are welcome!