I would like to add some sort of 'DRAFT' watermark on the pdf result of an R markdown document. (I want to provide interim versions of the document, but I want the client to be aware that it's not the final version.) I'm a beginner at R Markdown, and know almost no LaTex. I can't seem to find any instructions for doing something like this. Maybe some sort of template?, or a specific set of LaTex commands? This would be across first or all pages, maybe colored red. Thanks for any help.
Asked
Active
Viewed 3,432 times
3
-
1Does the following answer in this link work for you http://stackoverflow.com/questions/32748248/watermark-in-rmarkdown – steveb Jan 22 '16 at 20:48
-
Yes it does ;-). I wasn't using the word Watermark in my initial searches... – Scott Presnell Jan 22 '16 at 20:54
1 Answers
4
Try this
---
title: "Untitled"
header-includes:
- \usepackage{draftwatermark}
output:
pdf_document:
keep_tex: yes
---
```{r, results='asis'}
cat(sample(c("\n",letters), 1e4, TRUE))
```

baptiste
- 75,767
- 19
- 198
- 294
-
@baptiste -- Yes -- very nice. In the answer to the question of which this is officially a duplicate, how would one most elegantly include that `\AddToShipoutPictureFG{}` LaTeX block in a markdown doc? – Josh O'Brien Jan 22 '16 at 21:18
-
1it seems you can just dump it at the start of the document, just after the YAML header, but if you're looking for elegance you probably want to add it to an external template tex file as discussed in the comments. – baptiste Jan 22 '16 at 21:23
-
1I did indeed run into the problem with background/foreground that was the issue in the first question. I ended up using xwatermark and the \newwatermark*[] variant. See here: http://tex.stackexchange.com/questions/118939/add-watermark-that-overlays-the-images/118987 – Scott Presnell Jan 22 '16 at 21:26