R/markdown_rtl_header.R

Defines functions markdown_rtl_header

Documented in markdown_rtl_header

#' Generate a YAML header for an R Markdown document with RTL support
#'
#' This function generates a YAML header for an R Markdown document that will produce a PDF output
#' with support for Persian typesetting using the \code{xepersian} package and the \code{Arial} font.
#'
#' @return A character string containing the YAML header.
#' @export
#' @import knitr bookdown
#' @examples
markdown_rtl_header <- function() {
  txt <- '---
title: "Example"
author: "RTLknitr"
date: "`r Sys.Date()`"
output:
  bookdown::pdf_document2:
  latex_engine: xelatex
header-includes:
  - \\usepackage{xepersian}
  - \\settextfont{Arial}
---'
  cat(txt)
}

Try the RTLknitr package in your browser

Any scripts or data that you put into this service are public.

RTLknitr documentation built on Aug. 25, 2023, 9:06 a.m.