Home > database >  RMarkdown Add fold marks to PDF-document
RMarkdown Add fold marks to PDF-document

Time:01-18

I want to use RMarkdown to create a PDF document with folding marks on the left side.
I have already found a working example for LaTex:
https://tex.stackexchange.com/questions/332368/scrlttr2-wider-folding-marks

Unfortunately, I have not yet found a way to implement this example in my RMarkdown file.
In my opinion this example suggests to change the documentclass-option to scrlttr2.
However, after much research, I have not found a comparable example for RMarkdown.
Can someone help me?
(I would also be happy if you could find another way and create fold marks in RMarkdown.)

Here is my example-code:

---
title: "Untitled"
output: pdf_document
date: "2023-01-17"
header-includes:
  \usepackage{fancyhdr}
  \usepackage{xcolor}
---

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

CodePudding user response:

You could use the same approach as in https://tex.stackexchange.com/a/95230/36296

---
title: "Untitled"
output: pdf_document
date: "2023-01-17"
header-includes:
  - \usepackage{fancyhdr}
  - \usepackage{xcolor}
  - \usepackage{tikz}
  - \usetikzlibrary{calc}
  - \AddToHook{shipout/background}{\begin{tikzpicture}[overlay,remember picture]\draw ($(current page.north west)!0.3535!(current page.south west)$)--  (0.5cm,0cm);\draw ($(current page.north west)!0.50!(current page.south west)$)--  (0.8cm,0cm);\draw ($(current page.north west)!0.7071!(current page.south west)$)--  (0.5cm,0cm);\end{tikzpicture}}
---

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
  • Related