Description
I have simple bookdown document with labeled LaTeX equation:
---
title: "Equation text"
output:
bookdown::pdf_document2: default
bookdown::word_document2: default
---
Below is the binom equation
\begin{equation}
f\left(k\right)=\binom{n}{k}p^k\left(1-p\right)^{n-k} (\#eq:binom)
\end{equation}
With RStudio it Knits normally to PDF:
and to docx:
But this docx-rendering is technically incorrect, as we have equation number inside OMML equation. And the number is separated from equation by \qquad
or similar symbols (hex E2 80 81 E2 80 81
in resulting docx between <m:t>
and </m:t>
).
The correct form for DOCX is expected to be as following:
Here we have 2 tab stops:
- at the middle of the page for centering the equation
- at the right side of the page to place equation number.
Schematically it looks like:
→ EQ_centered → (N)
^^^ ^^^^^ ^^^ ^^^^
Tab OMML object Tab text
The proposed behavior will make PDF/LaTeX and DOCX representations look consistent.
And it will fix my next problem with OMML to MathType conversion (see my question on StackOverflow.
As far I can understand this should be fixed on bookdown level.
Writing pandoc (Lua)filter and/or applying docx-template is harder to implement.
I'm using latest versions of bookdown, rmarkdown, pandoc and RStudio Preview.