3

Does anyone know which Latex environments that are supported in pandoc when converting Markdown to html?

I have tested equation, align, alignat which seams to work, so is there e.g. a family/kind of environments that are supported, so I don't need to test by trial and error?

  • Have you checked the pandoc documentation? It may not provide the answer, but it would spare people from having to check themselves if you've already determined that it doesn't. – dgoodmaniii May 28 '15 at 12:49
3

Pandoc creates the converted document using a default template which is mostly a long LaTeX preamble. To find it, search for a file called default.latex in the pandoc installation directory): in my Linux version, for instance, it is in /usr/share/pandoc/data/templates/default.latex. You can open it and find which packages it contains.

There are some other control instructions in the file, apart from standard LaTeX code, but they are readable enough, e.g.,

$if(mainfont)$
    \setmainfont{$mainfont$}
$endif$

In my version, the preamble includes (among others packages less relevant here) amssymb and amsmath, so you can use every math font and environment defined in these packages. You can check their documentation, available on http://www.ctan.org/pkg/amsmath and http://www.ctan.org/pkg/amsfonts, to find exactly what is included (in particular the amsmath guide is very helpful and well-written, when it comes to equation environments.

If you need more functions, you can add packages and change the default preamble using pandoc command line arguments.

  • That is much better than what I had expected! When you say that I can add more functions by using pandoc arguments, does that e.g. include something as crazy as minipage and write shadethm ctan.org/tex-archive/macros/latex/contrib/shadethm?lang=en ? – Jasmine Lognnes May 28 '15 at 13:14
  • 3
    You may not be able to easily define your own pandoc tags, but you can certainly include raw TeX/LaTeX code into your Markdown file, and it will be passed verbatim into the TeX output file. Combine that with your own template, and you can make more or less whatever you want (though the more complex it gets, the less advantage Pandoc will provide over just writing in LaTeX). – Mike Renfro May 28 '15 at 13:38
  • 1
    You have little control over the code generated by pandoc: for instance, the *some text* will always be converted into \emph{some text}. However, you can change the template, for instance including in the preamble commands such as \renewcommand{\emph}[1]{\textcolor{red}{#1}}. This effectively changes all italic text to text in red. In principle you could redefine the theorem environment to use shadethm, but I don't think there is any Markdown construct to typeset a theorem, so Pandoc will never produce any \begin{theorem}...\end{theorem} line to start with. – Federico Poloni May 28 '15 at 15:45

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.