Skip to content

Equation numbering in docx should be improved and shown as PDF/LaTeX #682

Open
@N0rbert

Description

@N0rbert

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:

PDF

and to docx:

d

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:

sds

Here we have 2 tab stops:

  1. at the middle of the page for centering the equation
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementhelp wanted ❤️we'd love your help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions