Open shixuguo opened 6 years ago
Thanks for this input, @shixuguo. For some time now I have wanted to improve the docx output for pandoc-eqnos and friends. I know that there is a lot of interest. However, I don't use docx myself, and am not nearly knowledgeable enough about OOXML or OMML. If you know about these things and can provide some testing support, then we can look into such an enhancement. What do you think?
Your trial table code didn't work because the equation attributes need to be immediately adjacent to the equation itself.
I also have little knowledge about OMML, but in China a lot of journals only accept docx. So I think it's a very helpful enhancement. I want to do some help, as long as you can point out what should I do. if you mean some test work, I will be glad to do them.
I know in current design, equation attributes need to be immediately adjacent to the equation itself. But I think it's a wrong design or it's an inflexible design for equation number. So is it possible to design a more flexible form for equation number?
I agree that this should be addressed. If you can help with testing that would be great. I will first need to review similar (incomplete) work done in pandoc-fignos and will get back to you.
A quick note about this:
I know in current design, equation attributes need to be immediately adjacent to the equation itself. But I think it's a wrong design or it's an inflexible design for equation number. So is it possible to design a more flexible form for equation number?
The attributes need to be immediately next to the equation. However, this does not mean that the equation number needs to go immediately next to the equation. Pandoc-eqnos writes custom TeX and html to position the equation number, for example. We need to do something similar for docx. This will involve figuring out what OOXML to write.
I have created a wiki page to help organize a solution to this problem:
https://github.com/tomduck/pandoc-eqnos/wiki/Development#docx-output
This might be slightly off-topic since it's not about the style per se, but more about how the equations are internally defined. I can open another issue if you'd prefer.
I'm enclosing a simple docx that contains one equation and one reference. The style might not be the best and I believe others use different formats. What is important here is that the bookmark has auto-numbering and it's listed as an "equation" and not a simple "bookmark". As a result, adding more equation to the document and updating using F9 will update all the equation numbers. (This applies to figures and tables as well, as referenced by the issues mentioned above).
Looking at the xml, the part where the bookmark is defined is:
<w:bookmarkStart w:name="_Ref18177439" w:id="1"/>
-<w:r>
<w:t xml:space="preserve">Equation </w:t>
</w:r>
-<w:r w:rsidR="00684D32">
<w:fldChar w:fldCharType="begin"/>
</w:r>
-<w:r w:rsidR="00684D32">
<w:instrText xml:space="preserve"> SEQ Equation \* ARABIC </w:instrText>
</w:r>
-<w:r w:rsidR="00684D32">
<w:fldChar w:fldCharType="separate"/>
</w:r>
-<w:r w:rsidR="00092964">
-<w:rPr>
<w:noProof/>
</w:rPr>
<w:t>1</w:t>
</w:r>
-<w:r w:rsidR="00684D32">
-<w:rPr>
<w:noProof/>
</w:rPr>
<w:fldChar w:fldCharType="end"/>
</w:r>
<w:bookmarkEnd w:id="1"/>
The citation is :
-<w:r>
<w:fldChar w:fldCharType="begin"/>
</w:r>
-<w:r>
<w:instrText xml:space="preserve"> REF _Ref18177439 \h </w:instrText>
</w:r>
-<w:r>
<w:fldChar w:fldCharType="separate"/>
</w:r>
-<w:r>
<w:t xml:space="preserve">Equation </w:t>
</w:r>
-<w:r>
-<w:rPr>
<w:noProof/>
</w:rPr>
<w:t>1</w:t>
</w:r>
-<w:r>
<w:fldChar w:fldCharType="end"/>
</w:r>
-<w:r>
<w:t xml:space="preserve"> </w:t>
</w:r>
<w:bookmarkStart w:name="_GoBack" w:id="0"/>
<w:bookmarkEnd w:id="0"/>
I hope that can help. Thank you so much for your work!
Thanks for this, @ebranlard. I am nearing completion of my work on version 2.0 of each filter. I expect to work on docx support this fall. It has been a long time in coming, mostly because it is difficult to determine what should actually be done (I am not a docx user). So, the info you have provided me will be most helpful.
Cheers, Tom
It would look better using
The equation part in the origin file is:
<m:oMath>
<m:r><m:t>y=f(x) (1)</m:t></m:r>
</m:oMath>
And, the equation part using the
<m:oMath>
<m:eqArr>
<m:eqArrPr><m:maxDist m:val="1"/></m:eqArrPr>
<m:e>
<m:r><m:t>y=f(x)#(1)</m:t></m:r>
</m:e>
</m:eqArr>
</m:oMath>
I am trying to create a custom filter based on the
based on pandoc-eqnos, I can do some simple numbered work in converting markdown to docx.
however, the style in docx seems wrong.
in current style, the equation and number looks like below
where the equation and number are both in OMML, and there are two space between equation and number.
More common style for numbered equation is as below:
equation and number are in a three-column table. equation is centered and number is right-aligned . and the number should be plain text not in OMML.
I have tried code below:
and pandoc-eqnos failed.