[Tex/LaTex] From latex to word with pandoc

pandoc

I am willing to convert my latex file to MS word (docx extension) to share it with some of my co-authors that do not use latex (they should!!).

I have two issues:

1) In the tex file I include some figures. However, when I convert the file, I got the following error message: "pandoc could no find image 'Figure1", skipping.

The files with the two figures are in the same folder I am working. Is there any way I can ask pandoc to include those figures in the docx file?

2) A part from point 1), everything works fine. However, pandoc cannot convert two equations (I got the latex code instead of the two equations). The MWE generating those equations is:

\documentclass[12pt, A4paper]{article}

\usepackage{amssymb}
\usepackage{amsmath}


\begin{document}

Consistently, the probabilities in Eq. (1) and Eq. (2) are defined as follows, respectively:
\[
(\alpha)P\left[\frac{1}{2}+\mu \right] =
\setlength{\arraycolsep}{0pt}
\renewcommand{\arraystretch}{2}
\left\{ 
\begin{array}{l @{\quad} l r l}
    0            & \text{if } & \mu &{} < -\dfrac{1}{2}\\
    \alpha\mu & \text{if } & -\dfrac{1}{2} &{} \leq \mu \leq \dfrac{1}{2}\\
    1            & \text{if } & \mu &{}> \dfrac{1}{2} 
\end{array}
\right.
\]
and:
\[
P\left[\frac{1}{2}+\gamma \mu -(\alpha -1)\right]=
\setlength{\arraycolsep}{0pt}
\renewcommand{\arraystretch}{2}
\left\{ 
\begin{array}{l @{\quad} l r l}
    0            & \text{if} & \gamma\mu &{} < \alpha -\dfrac{3}{2}\\
    \dfrac{1}{2}+\gamma \mu -(\alpha -1) & \text{if} &{} \alpha -\frac{3}{2} &{}\leq \gamma \mu \leq \alpha -\frac{1}{2}\\
    1            & \text{if } & \gamma \mu &{}> \alpha -\frac{1}{2} 
\end{array}
\right.
\]
\vspace{0.5cm}

\end{document}

Why this is the case? Is there any chance I can write the two equations above such as I get the identical result but they are written in a way pandoc can convert? Thanks in advance.

Best Answer

Remove the \setlength{\arraycolsep}{0pt} and it should work -- that seems to be causing the problem.

And please consider reporting problems like this on the pandoc bug tracker, so we can improve pandoc. It would be a relatively simple matter to change the texmath library (which pandoc uses for math conversions) to ignore (or better, do something with) the \setlength command.

As for the figure, pandoc should be able to find the image; again, we'd be interested in a detailed bug report with enough information to reproduce the problem. (Also, be sure you're using the most recent version of pandoc, or at least tell us which version you're using.)

Related Question