Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include some lines of text and an image on every page in Markdown?

So I have to prepare a document in markdown, in which I have to sign my name (picture of my signature + some text) on every page in the pdf output. I'm using RStudio to generate pdf from markdown, presumably with pandoc being the underlying converter.

Is there a way to do this? It's especially difficult since the location of the page changes every time there's new content added, and markdown, unlike Latex, doesn't seem to be a page-based format.

like image 432
Heisenberg Avatar asked Dec 21 '25 01:12

Heisenberg


1 Answers

Pandoc relies on latex. You can use header-includes in the yaml front matter to add content to the latex header. Here, you could define a header with fancyhdr:

---
title: "Untitled"
header-includes:
    - \usepackage{fancyhdr}
    - \pagestyle{fancy}
    - \rhead{right header text}
    - \lhead{left header text}
    - \cfoot{center footer text}
output: pdf_document
---

You'll find more on customizing Latex headers in any Latex manual, like this wikibook.

like image 124
scoa Avatar answered Dec 22 '25 19:12

scoa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!