Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slides with Columns in Pandoc

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?

  • Is there a way to use markdown within inlined LaTeX?
  • Is there a pure markdown solution?
like image 806
MRocklin Avatar asked Feb 28 '13 17:02

MRocklin


People also ask

How do you make two columns in markdown?

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.

How many types of boxes are there in LaTeX PPT?

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.

Does Pandoc need LaTeX?

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.


2 Answers

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 ::::  ::: 
like image 198
tarleb Avatar answered Oct 03 '22 13:10

tarleb


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 
like image 21
ivotron Avatar answered Oct 03 '22 12:10

ivotron