This question already has an answer here:
- Slides with Columns in Pandoc 6 answers
I want to convert a markdown file to html and pdf using pandoc. For the pdf file, which is intended for printing, I'd like to render a block of (narrow) text in two column format. This is what I came up with (and doesn't work):
---
papersize: a4
documentclass: article
header-includes:
- \usepackage{multicol}
...
H1
==============
H2 - A
--------------
\begin{multicols}{2}
### H3 - a
Blah blah blah...
### H3 - b
Blah blah blah...
### H3 - c
Blah blah blah...
\end{multicols}
H2 - B
--------------
Blah blah blah...
Can this be achieved with pandoc? The problem is that pandoc seems to treat everything from \begin{multicols}{2}
to \end{multicols}
as raw latex source. This means that:
- html output does not include the contents of the block.
- LaTeX chokes on the block because markdown is not interpreted before it is passed to it.
Is there any way to instruct pandoc to inject the environment start command (\begin{multicols}{2}
) but stop the LaTeX raw block at that point instead of scanning to find its end? Or maybe a better solution to achieve the desired effect?
The command lines I use for the conversions are:
pandoc --standalone --normalize -f markdown-hard_line_breaks -t html5 --self-contained -o out.pdfl in.md
pandoc --standalone --normalize -f markdown-hard_line_breaks -t latex -o out.pdf in.md