I just started using pandoc and I followed every step in this page.
First of all we create a text file named test1.md.txt

# Test!

This is a test of *pandoc*.

- list one
- list two

Convert it to a tex file using the code:

pandoc test1.md.txt -s -o test1.tex  

we get:

\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\else % if luatex or xelatex
% use upquote if available, for straight quotes in verbatim environments
% use microtype if available
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
  \usepackage[setpagesize=false, % page size defined by xetex
              unicode=false, % unicode breaks when used with xetex
            pdfborder={0 0 0}}
\urlstyle{same}  % don't use monospace font for urls
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines


% Redefines (sub)paragraphs to behave more like sections



This is a test of \emph{pandoc}.

  list one
  list two


When we try to convert this final tex file to a docx file, its done appropriately:

pandoc test1.tex -s -o test1.docx  

we get the result as:

enter image description here

but now I have my own tex code named as equation.tex

\usepackage[margin=1in]{geometry}% Just for this example


 T_4 &= \langle \underline{k}\,.\,\underline{k}^{*^T} \rangle=
     |k_1|^2 & k_1k_2^* & k_1k_3^* & k_1k_4^* \\
     k_2k_1^* & |k_2|^2 & k_2k_3^* & k_2k_4^* \\
     k_3k_1^* & k_3k_2^* & |k_3|^2 & k_3k_4^* \\
     k_4k_1^* & k_4k_2^* & k_4k_3^* & |k_4|^2
   \right\rangle \\
 &= \frac{1}{2}
     \langle|S_{XX}+S_{YY}|^2\rangle &
     \langle(S_{XX}+S_{YY})(S_{XX}-S_{YY})^*\rangle &\\
     \langle(S_{XX}-S_{YY})(S_{XX}+S_{YY})^*\rangle &
     \langle|S_{XX}-S_{YY}|^2\rangle & \cdots\cdots\\
     \langle(S_{XY}+S_{YX})(S_{XX}-S_{YY})^*\rangle & \cdots\cdots\\
     \langle j(S_{XY}-S_{YX})(S_{XX}+S_{YY})^*\rangle &
     \langle j(S_{XY}-S_{YX})(S_{XX}-S_{YY})^*\rangle &
   \end{matrix}\right. \nonumber \\
 & \phantom{{}= \frac{1}{2}}
     & \langle(S_{XX}+S_{YY})(S_{XY}+S_{YX})^*\rangle
     & \langle -j(S_{XX}+S_{YY})(S_{XY}-S_{YX})^*\rangle\\
     \cdots\cdots& \langle(S_{XX}-S_{YY})(S_{XY}+S_{YX})^*\rangle
     & \langle -j(S_{XX}-S_{YY})(S_{XY}-S_{YX})^*\rangle\\
     \cdots\cdots& \langle|S_{XY}+S_{YX}|^2\rangle
     & \langle-j(S_{XY}+S_{YX})(S_{XY}-S_{YX})^*\rangle\\
     & \langle j(S_{XY}-S_{YX})(S_{XY}+S_{YX})^*\rangle
     & \langle|S_{XY}-S_{YX}|^2\rangle


And try to convert it to a docx file:

pandoc equation.tex -s -o equation.docx  

I get the result:
enter image description here
This code is fine when used in latex and it does produce the proper pdf file
enter image description here

why doesn't pandoc create the write docx file and it just writes the latex codes in the docx file?

  • 2
    I suspect that your equation is too complex for pandoc to parse. Do you really need this formula in Word, or could you also import it as a figure? – Habi Aug 11 '15 at 13:36
  • @Habi in scientific papers they need editable equations. Will it be too complex for htlatex, too? then we can never convert complex equations from tex to word? Should we start using latex from scratch? – Sepideh Abadpour Aug 11 '15 at 13:46
  • @Habi seems that this equation is too complex for pandoc but not for htlatex. I created an html file by htlatex and then opened the file with word. But you know seems that htlatex just produces an image of the equation not the mathml code. the code that I used is htlatex file.tex html "--interaction=nonstopmode". Seems that there's no way. even htlatex produces an image of the equation not mathml code?!!!! – Sepideh Abadpour Aug 11 '15 at 14:15
  • 1
    Re: "Should we start using latex from scratch?" Yes, indeed that's what I (and probably others here) would suggest for equations that are that complicated. For all the manuscripts I ever submitted I was sending the Journal a PDF, so I did my (less complicated) equations in LaTeX. – Habi Aug 11 '15 at 15:11
  • 1
    You will have to treat one format of your document as source, the other formats (be it PDF, DOC, HTML) as result. Having "editable equations" in all the possible output formats is probably too far-fetched (and even impossible for certain formats) to achieve. – Habi Aug 11 '15 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.