问题
I'm writing mainly in LaTeX, but some co-authors prefer MS Word. To facilitate their work a bit, I would like to convert the .tex
file (or the .pdf
) to a .docx
. The formatting does not need to be perfect, but all of the text, equations, figures etc should be perfectly readable.
I'm currently thinking to take the .tex
document, replace all the essential stuff and then let Pandoc do it's magic. For this I would preferably implement my additions as a Pandoc filter. E.g., my tikz
pictures would be converted to png
using the tikz.py
filter provided with Pandoc. The problem I'm facing with this approach is that Pandoc tries to interpret the tikz
environment upon conversion from tex
into it's internal language and the filters take this internal language as an input. The result is that the tikz
code is lost. Is there a way to tell Pandoc to leave any tikzpicture
environments alone?
Edit: See the MWE below:
MWE.tex contents:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (2,2);
\end{tikzpicture}
\end{document}
Output of pandoc -t native MWE.tex
[Para [Str "(0,0)",Space,Str "\8211",Space,Str "(2,2);"]]
The \draw
command has completely disappeared as you can see.
来源:https://stackoverflow.com/questions/42906254/pandoc-skip-latex-environment