jez / pandoc-starter

📄 My pandoc markdown templates and makefiles
https://blog.jez.io/reach-for-markdown/
529 stars 62 forks source link

Background images for slides? #2

Closed geeohgeegeeoh closed 6 years ago

geeohgeegeeoh commented 6 years ago

Markdown->Pandoc-> reveal.js includes some basic guides on how to have a background image applied to the slides.

It would help enormously with company policy if I could include the artwork which is in the Powerpoint Templates.

jez commented 6 years ago

Hm, this isn't something that I've needed to do before.

I'd bet that this is definitely possible, but I don't know off the top of my head how to get it working.

In particular, for this use case you might have to add some custom beamer styles. For example, this is how I customize beamer to change the background color and fonts in the beamer-solarized starter.

I'm curious to hear what you find out! And if you want, feel free to make a pull request to add a starter for it.

geeohgeegeeoh commented 6 years ago

https://tex.stackexchange.com/questions/7916/how-to-insert-a-background-image-in-a-beamer-frame discusses some intracacies of this.

It looks to be stuff done low down inside beamer/TeX.

\usebackgroundtemplate gets set to include an image (from that thread)

% Now we install the new template for the following frames:\usebackgroundtemplate{% \includegraphics[width=\paperwidth,height=\paperheight]{crayons}} \begin{frame} ...\end{frame}

but comments suggest it can't be used with styled templates, set's BG colour to white &c &c

I will play around. Thanks for your hints to explore. I will send a pull request if I can make this work.

-G

On Tue, Feb 20, 2018 at 9:27 AM, Jake Zimmerman notifications@github.com wrote:

Hm, this isn't something that I've needed to do before.

I'd bet that this is definitely possible, but I don't know off the top of my head how to get it working.

In particular, for this use case you might have to add some custom beamer styles. For example, this is how https://github.com/jez/pandoc-starter/blob/master/beamer-solarized/src/beamer-includes.tex I customize beamer to change the background color and fonts in the beamer-solarized starter.

I'm curious to hear what you find out! And if you want, feel free to make a pull request to add a starter for it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jez/pandoc-starter/issues/2#issuecomment-366826222, or mute the thread https://github.com/notifications/unsubscribe-auth/AF0YfHSAxC8C9Brz14pKYh60_pVrGOCHks5tWgNngaJpZM4SJ6yU .

geeohgeegeeoh commented 6 years ago

get the pandoc template for beamer.

mkdir -p ~/.pandoc/templates/
pandoc -D beamer > ~/.pandoc/templates/default.beamer

apply this diff

--- default.beamer.origâ–·2018-02-21 14:25:52.000000000 +1000
+++ default.beamerâ–·â‹…â‹…â‹…â‹…â‹…2018-02-21 14:20:27.000000000 +1000
@@ -83,6 +83,7 @@
 $endif$
 \fi
 $if(beamer)$
+\usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{/tmp/brunsviga.jpg}}
 $if(theme)$
 \usetheme[$for(themeoptions)$$themeoptions$$sep$,$endfor$]{$theme$}
 $endif$

result: /tmp/brunsviga.jpg is minted behind every page, scaled to fit the page.

geeohgeegeeoh commented 6 years ago

I had to invoke pandoc with this extra option: --template ~/.pandoc/templates/default.beamer because for some reason, the modified, localized default.beamer template wasn't picked up. I am pretty sure the pandoc docs say this is where you put localized versions of templates.

geeohgeegeeoh commented 6 years ago

ok. With further work I found how to do this. no template modification required.

the Pandoc YAML permits direct injection of the underlying latex

header-includes:
    - \usebackgroundtemplate{\includegraphics[width=\paperwidth,height=\paperheight]{/tmp/brunsviga.jpg}}

You could elect to add some comment in README.md or other places or a new template instance showing how to do it, I may write one.

jez commented 6 years ago

Given how simple it is to do with the current templates, I think I just leave it out. Thanks for doing the research though!