lierdakil / pandoc-crossref

Pandoc filter for cross-references
https://lierdakil.github.io/pandoc-crossref/
GNU General Public License v2.0
909 stars 73 forks source link

Incorrect equation reference number in main text when convert .tex to .docx #398

Closed christina-0725 closed 9 months ago

christina-0725 commented 10 months ago

I have pandoc 3.1.6 and pandoc-crossref v0.3.16.0 in my pc. I convert .tex to .docx by using command as follows:

pandoc temp.tex -o output.docx \
        --bibliography ../../latex/reference.bib \
        --filter pandoc-crossref -M tableEqns -M autoEqnLabels -t docx+native_numbering\
        --citeproc  --csl ../../latex/ieee.csl \
        --number-sections -M reference-section-title=Reference\
        --reference-doc ../../latex/ref.docx

The .tex file is as follows:

...
This is Eq.\ref{eq1}

\begin{equation}
    {a + b = c}\label{eq1}
\end{equation}
...

And obtained .docx file is as follows:

This is Eq.[eq1]
a+b=c   (1)

The equation reference number in main text is [eq1], same as the label name in .tex file, but the equation number I want to get is 1. But I got correct table, figure and reference number in .docx file. What command should I use or how should I fix .tex file to get the correct equation reference number in main text? Thanks for your help!

lierdakil commented 9 months ago

See #250. TL;DR: pandoc-crossref doesn't support LaTeX as input format, but you can bludgeon it into doing what you want with a bit of prefiltering, see #250 for some examples.