I'm using pandoc
to convert from .tex
to .rst
.
If I start with the following .tex
file, mwe.tex
mwe.tex
\section{Introduction}
Here is some text.
Here is some more text.
\begin{minipage}{.4\textwidth}
\mycommand{first argument}{second argument}{3rd argument}
\end{minipage}%
\hfill
\begin{minipage}{.4\textwidth}
This type of listing is a \texttt{.tex} file.
\end{minipage}%
and run the following command
pandoc mwe.tex -o mwe.rst
then I receive the output
mwe.rst
Introduction
============
Here is some text.
Here is some more text.
.4
.4 This type of listing is a ``.tex`` file.
I'd like to customize the conversion of the minipage
environment and mycommand
command. How can this be done?
Best Answer
Pandoc can parse latex macro definitions. This means, that you can add dummy
\newcommand
statements to tweak what will end up in the output:input file 1: dummy.tex
input file 2: mwe.tex
run:
output file mwe.rst:
And, as you can see, more recent versions of pandoc (in this case 2.1.1) handle minipages much better.
You might need to write a filter for more complicated issues.