texmath icon indicating copy to clipboard operation
texmath copied to clipboard

cannot recognize equation numbers in Word

Open redstoneleo opened this issue 6 years ago • 5 comments

cannot recognize equation numbers in Word

Tested with command: E:\pandoc.exe -s 2.docx -t markdown-smart --wrap=none -o example35.md File:2.docx

redstoneleo avatar May 13 '19 04:05 redstoneleo

This is out of scope for now.

jgm avatar May 13 '19 04:05 jgm

I don't understand why you said "it is out of scope for now". I found a solution, and let's take 1+1=2 with equation number (8) as an example . Currently, pandoc just converts it to

$$\begin{matrix}
1 + 1 = 2\#\left( 8 \right) \\
\end{matrix}$$

In order to get the right result , we just need to replace \#\left( 8 \right) \\ with \tag{8}. I am sorry I cannot contribute more .

redstoneleo avatar May 13 '19 06:05 redstoneleo

I said "out of scope" because pandoc currently doesn't have a way of handling equation numbers and cross-refs. But I agree, converting this to \tag{8} or just ignoring it completely would be better than the current output, and both are feasible.

jgm avatar May 13 '19 14:05 jgm

Here's the xml for "1=2" with eqn number 1.

      <m:oMathPara>
        <m:oMath>
          <m:eqArr>
            <m:eqArrPr>
              <m:maxDist m:val="1"/>
              <m:ctrlPr>
                <w:rPr>
                  <w:rFonts w:ascii="Cambria Math" w:eastAsia="微软雅黑" w:hAnsi="Cambria Math"/>
                  <w:i/>
                  <w:sz w:val="24"/>
                  <w:szCs w:val="24"/>
                </w:rPr>
              </m:ctrlPr>
            </m:eqArrPr>
            <m:e>
              <m:r>
                <w:rPr>
                  <w:rFonts w:ascii="Cambria Math" w:eastAsia="微软雅黑" w:hAnsi="Cambria Math"/>
                  <w:sz w:val="24"/>
                  <w:szCs w:val="24"/>
                </w:rPr>
                <m:t>1=2
                </m:t>
              </m:r>
              <m:r>
                <w:rPr>
                  <w:rFonts w:ascii="Cambria Math" w:eastAsia="微软雅黑" w:hAnsi="Cambria Math"/>
                  <w:sz w:val="24"/>
                  <w:szCs w:val="24"/>
                </w:rPr>
                <m:t>#
                </m:t>
              </m:r>
              <m:d>
                <m:dPr>
                  <m:ctrlPr>
                    <w:rPr>
                      <w:rFonts w:ascii="Cambria Math" w:eastAsia="微软雅黑" w:hAnsi="Cambria Math"/>
                      <w:i/>
                      <w:sz w:val="24"/>
                      <w:szCs w:val="24"/>
                    </w:rPr>
                  </m:ctrlPr>
                </m:dPr>
                <m:e>
                  <m:r>
                    <w:rPr>
                      <w:rFonts w:ascii="Cambria Math" w:eastAsia="微软雅黑" w:hAnsi="Cambria Math"/>
                      <w:sz w:val="24"/>
                      <w:szCs w:val="24"/>
                    </w:rPr>
                    <m:t>1
                    </m:t>
                  </m:r>
                </m:e>
              </m:d>
            </m:e>
          </m:eqArr>
        </m:oMath>
      </m:oMathPara>

Very strange! It appears that there's no dedicated XML for the equation number, but rather some kind of convention so that whatever occurs after a run with just # is an equation number? Do I understand this correctly?

jgm avatar May 13 '19 14:05 jgm

If I was correct , you would find the equation number after the last <m:t> tag.

redstoneleo avatar May 14 '19 00:05 redstoneleo