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

Incorrect OOXML math to latex conversion #1809

Closed
KOLANICH opened this issue Dec 14, 2014 · 6 comments
Closed

Incorrect OOXML math to latex conversion #1809

KOLANICH opened this issue Dec 14, 2014 · 6 comments
Labels

Comments

@KOLANICH
Copy link

Hello, I was transforming from docx to latex and mentioned that

  1. openofficexml eqiuvalent of \hbar is not transformed correctly
  2. openofficexml equivalent of \hat is not transformed correctly (transformed to \acute )
  3. openofficexml equivalent of \vec is not transformed correctly (transformed to \overrightarrow)
@jgm
Copy link
Owner

jgm commented Dec 14, 2014

Thanks for the report. Please give us the output of pandoc --version,
along with some specific examples with input and expected and actual
output.

+++ KOLANICH [Dec 14 14 08:48 ]:

Hello, I was transforming from docx to latex and mentioned that

  1. mathml eqiuvalent of \hbar is not transformed correctly
  2. mathml equivalent of \hat is not transformed correctly (transformed to \acute )
  3. mathml equivalent of \vec is not transformed correctly (transformed to \overrightarrow)

Reply to this email directly or view it on GitHub:
#1809

@KOLANICH
Copy link
Author

pandoc 1.13.1
Compiled with texmath 0.8, highlighting-kate 0.5.8.5.

here is document.xml inside .docx archive

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 wp14">
  <w:body>
    <w:p w:rsidR="0069768E" w:rsidRPr="00641360" w:rsidRDefault="003D0612">
      <w:pPr>
        <w:rPr>
          <w:kern w:val="20"/>
          <w14:ligatures w14:val="standardContextual"/>
        </w:rPr>
      </w:pPr>
      <m:oMathPara>
        <m:oMath>
          <m:acc>
            <m:accPr>
              <m:ctrlPr>
                <w:rPr>
                  <w:rFonts w:ascii="Cambria Math" w:eastAsiaTheme="minorEastAsia" w:hAnsi="Cambria Math"/>
                  <w:kern w:val="28"/>
                  <w14:ligatures w14:val="standardContextual"/>
                </w:rPr>
              </m:ctrlPr>
            </m:accPr>
            <m:e>
              <m:acc>
                <m:accPr>
                  <m:chr m:val=""/>
                  <m:ctrlPr>
                    <w:rPr>
                      <w:rFonts w:ascii="Cambria Math" w:eastAsiaTheme="minorEastAsia" w:hAnsi="Cambria Math"/>
                      <w:i/>
                      <w:kern w:val="28"/>
                      <w14:ligatures w14:val="standardContextual"/>
                    </w:rPr>
                  </m:ctrlPr>
                </m:accPr>
                <m:e>
                  <m:r>
                    <w:rPr>
                      <w:rFonts w:ascii="Cambria Math" w:eastAsiaTheme="minorEastAsia" w:hAnsi="Cambria Math"/>
                      <w:kern w:val="28"/>
                      <w14:ligatures w14:val="standardContextual"/>
                    </w:rPr>
                    <m:t>p</m:t>
                  </m:r>
                </m:e>
              </m:acc>
            </m:e>
          </m:acc>
          <m:r>
            <w:rPr>
              <w:rFonts w:ascii="Cambria Math" w:eastAsiaTheme="minorEastAsia" w:hAnsi="Cambria Math"/>
              <w:kern w:val="28"/>
              <w14:ligatures w14:val="standardContextual"/>
            </w:rPr>
            <m:t>=-ⅈℏ</m:t>
          </m:r>
          <m:acc>
            <m:accPr>
              <m:chr m:val=""/>
              <m:ctrlPr>
                <w:rPr>
                  <w:rFonts w:ascii="Cambria Math" w:eastAsiaTheme="minorEastAsia" w:hAnsi="Cambria Math"/>
                  <w:kern w:val="28"/>
                  <w14:ligatures w14:val="standardContextual"/>
                </w:rPr>
              </m:ctrlPr>
            </m:accPr>
            <m:e>
              <m:r>
                <m:rPr>
                  <m:sty m:val="p"/>
                </m:rPr>
                <w:rPr>
                  <w:rFonts w:ascii="Cambria Math" w:eastAsiaTheme="minorEastAsia" w:hAnsi="Cambria Math"/>
                  <w:kern w:val="28"/>
                  <w14:ligatures w14:val="standardContextual"/>
                </w:rPr>
                <m:t>∇</m:t>
              </m:r>
            </m:e>
          </m:acc>
        </m:oMath>
      </m:oMathPara>
      <w:bookmarkStart w:id="0" w:name="_GoBack"/>
      <w:bookmarkEnd w:id="0"/>
    </w:p>
    <w:sectPr w:rsidR="0069768E" w:rsidRPr="00641360">
      <w:pgSz w:w="11906" w:h="16838"/>
      <w:pgMar w:top="1134" w:right="850" w:bottom="1134" w:left="1701" w:header="708" w:footer="708" w:gutter="0"/>
      <w:cols w:space="708"/>
      <w:docGrid w:linePitch="360"/>
    </w:sectPr>
  </w:body>
</w:document>

here is latex source generated

\[\acute{\overrightarrow{p}} = - \mathbb{i}\overrightarrow{\nabla}\]

sorry for misinformation, it uses its own format, not MathML

@mpickering
Copy link
Collaborator

Thank you for your report, (2) is fixed in the development branch. Here is the output I currently get.

\hat{\overrightarrow{p}} = - \mathbb{i}\overrightarrow{\nabla}

I think we chose \overrightarrow as it stretches over long inputs, is there a reason to choose \vec?

Finally, the missing \hbar is because I mispelled amssymb, changing the defaultEnv to fix this produces the following rendering.

\hat{\overrightarrow{p}} = - \mathbb{i}\hslash\overrightarrow{\nabla}

How does that look?

@mpickering mpickering changed the title Incorrectly transformed entities Incorrect OOXML to latex conversion Dec 14, 2014
@mpickering mpickering changed the title Incorrect OOXML to latex conversion Incorrect OOXML math to latex conversion Dec 14, 2014
@mpickering mpickering added the bug label Dec 14, 2014
@KOLANICH
Copy link
Author

I think that it is more correct to use \hbar.

is there a reason to choose \vec

It is semantically more correct, also some TeX editors don't recognise \overrightarrow

@mpickering
Copy link
Collaborator

The character in your document is 210F which corresponds much better to \hslash than \hbar.

I think we could change the output to use \vec if the argument is one or two characters.

@jgm
Copy link
Owner

jgm commented Mar 15, 2015

I'm going to leave \overrightarrow -- for \vec we'd have to know if the argument is one-character, and the logic that looks up these markers currently doesn't know that.
Other issues have now been fixed in texmath.

@jgm jgm closed this as completed Mar 15, 2015
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

3 participants