Search code examples
latexmarkdownpandocbeamer

Customizing Body Text and Images using Markdown, Pandoc, Beamer to create PDF Slideshows


I have a series of markdown files that I am turning into slides using Pandoc and the Beamer template. I am creating my own custom Beamer template in order to format those slides.

pandoc --slide-level 2 -fmarkdown-implicit_figures -t beamer --template mytemplate.beamer -o test.pdf *.md

I am struggling with making certain elements look the way I would like them to.

My simplified markdown looks like this:

## Header

Normal Body Text

![Image](images/Image1.png "Image")

Specifically, my images are coming out left justified. I can't figure out how to get them to center. If I remove the -fmarkdown-implicit_figures option, then the images are properly centered, but includes captions that I don't want. Adding that flag eliminates the captions but also eliminates the centering.

At the same time, I want the normal body text to be centered as well. So in the above example I would like the text Normal Body Text to be centered. Again, I can't figure out how to do that. I have managed to center other elements (such as the header), but I can't find an appropriate name for the element that represents normal body text.

Can anyone offer a solution to either of these issues?


Solution

  • I found a way to center the images. It may not be the best option, but this seems to work:

    \usepackage{letltxmacro}
    
    % Save the meaning of \includegraphics
    \LetLtxMacro\latexincludegraphics\includegraphics
    
    % Update the include graphics command to include centering
    \renewcommand{\includegraphics}[2][]{%
      \centering
      \latexincludegraphics[#1]{#2}}
    

    To ensure the normal text was centered, I used the following, again I am unsure if this is the best way:

    % Center Text By Default
    \usepackage{ragged2e}
    \centering