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

Wrong equation conversion from docx #228

Closed
memeplex opened this issue Oct 2, 2023 · 4 comments
Closed

Wrong equation conversion from docx #228

memeplex opened this issue Oct 2, 2023 · 4 comments
Labels

Comments

@memeplex
Copy link

memeplex commented Oct 2, 2023

Explain the problem.

When doing conversion from docx to markdown, some simple equations are wrongly converted.

image

--> $x^{2}$

See attached example (was created with Google Docs, downloaded as docx, opens fine in macOS Pages).

Prueba.docx

Pandoc version?

macOS 12.3
pandoc 3.1.8
Features: +server +lua
Scripting engine: Lua 5.4

@memeplex memeplex added the bug label Oct 2, 2023
@jgm
Copy link
Owner

jgm commented Oct 2, 2023

XML is

  <m:oMath>
  <m:nary>
      <m:naryPr>
      <m:chr m:val=""/>
      <m:ctrlPr>
          <w:rPr/>
      </m:ctrlPr>
      </m:naryPr>
      <m:sub>
      <m:r>
          <w:rPr/>
          <m:t xml:space="preserve">i=1                                       
          </m:t>
      </m:r>
      </m:sub>
      <m:sup>
      <m:r>
          <w:rPr/>
          <m:t xml:space="preserve">n                                         
          </m:t>
      </m:r>
      </m:sup>
  </m:nary>
  <m:sSup>
      <m:sSupPr>
      <m:ctrlPr>
          <w:rPr/>
      </m:ctrlPr>
      </m:sSupPr>
      <m:e>
      <m:r>
          <w:rPr/>
          <m:t xml:space="preserve">x                                         
          </m:t>
      </m:r>
      </m:e>
      <m:sup>
      <m:r>
          <w:rPr/>
          <m:t xml:space="preserve">2                                         
          </m:t>
      </m:r>
      </m:sup>
  </m:sSup>
  </m:oMath>

@jgm
Copy link
Owner

jgm commented Oct 2, 2023

Apparently m:naryPr can contain an m:chr element that specifies the operator character.
I don't think we handle that currently. Moving this to texmath.

@jgm jgm transferred this issue from jgm/pandoc Oct 2, 2023
@jgm
Copy link
Owner

jgm commented Oct 2, 2023

Actually, we do handle m:chr.
The problem is that we expect an m:nAry element to contain one m:e element.
Indeed, it looks like that's required, but perhaps some software is more forgiving...
https://schemas.liquid-technologies.com/OfficeOpenXML/2006/?page=omath.html
(look under "min occurrences")

@jgm jgm closed this as completed in d17a6c4 Oct 2, 2023
@memeplex
Copy link
Author

memeplex commented Oct 3, 2023

Thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants