I would like to have code and an image side-by-side in a Beamer slide.
In LaTeX I would do this with columns. I would like to use markdown within the column structure.
\begin{columns} \column{.5\textwidth} ~~~~~~~~Python >>> some python code ~~~~~~~ \column{.5\textwidth} ![](A_generated_image.pdf) \end{columns}
Unfortunately Pandoc doesn't process the markdown within the \begin{columns} and \end{columns} statements. Is there a way around this?
kramdown just requires that in your markdown page where you intend to use said HTML, you add an attribute to the wrapping HTML element of markdown="1" . As an example (and direct solution to two-column markdown), this results in two columns for content.
There are three types of box, and it's up to you to decide which one better fits in your presentation: \begin{block}{Remark} \end{block} A block box will wrap the text in a box with the same style as the rest of the presentation. The text inside the braces after the \begin{block} code is the title of the box.
By default, pandoc will use LaTeX to create the PDF, which requires that a LaTeX engine be installed (see --pdf-engine below). Alternatively, pandoc can use ConTeXt, roff ms, or HTML as an intermediate format.
Current versions of pandoc (i.e., pandoc 2.0 and later) supports fenced divs. Specially named divs are transformed into columns when targeting a slides format:
# This slide has columns ::: columns :::: column left :::: :::: column right :::: :::
Pandoc translates this into the following LaTeX beamer code:
\begin{frame}{This slide has columns} \protect\hypertarget{this-slide-has-columns}{} \begin{columns}[T] \begin{column}{0.48\textwidth} left \end{column} \begin{column}{0.48\textwidth} right \end{column} \end{columns} \end{frame}
This is simple and has the additional advantage of giving similar results when targeting other presentational formats like reveal.js.
More than two columns work out of the box for Beamer output. Powerpoint, however, only supports two columns. For reveal.js, the widths of three or more columns must be given explicitly:
::: columns :::: {.column width=30%} left :::: :::: {.column width=30%} middle :::: :::: {.column width=30%} right :::: :::
The problem is that pandoc
ignores markdown if it finds a \begin{}
. An alternative is to edit the beamer template and add the following:
\newcommand{\columnsbegin}{\begin{columns}} \newcommand{\columnsend}{\end{columns}}
And write it like this:
\columnsbegin \column{.5\textwidth} ~~~~~~~~Python >>> some python code ~~~~~~~ \column{.5\textwidth} ![](A_generated_image.pdf) \columnsend
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With