Skip to contents

Thai language supported conversion of R Markdown to a PDF or LaTeX document. It is a wrapper around rmarkdown::pdf_document().

Usage

thaipdf_document(thai_font = "TH Sarabun New", line_spacing = 1.5, ...)

Arguments

thai_font

(Character) Name of the Thai font to use. Default font is "TH Sarabun New". It can be any Thai font that installed in your system.

line_spacing

(Numeric) Spacing between each line. Line spacing 1.5 is recommended for Thai language (default).

...

Arguments to pass to pdf_document(). You may supply any valid arguments of pdf_document() except for includes and latex_engine.

Value

An S3 object of class "rmarkdown_output_format" to pass to rmarkdown::render()

Details

To achieve Thai language compatibility for LaTeX, This function injects preamble fragment of Thai LaTeX typesetting into the preamble of output LaTeX via includes argument, and set latex_engine to "xelatex".

See also

Examples

if (FALSE) {
library(rmarkdown)

 # Simple Conversion
 render("input.Rmd", output_format = thaipdf::thaipdf_document())

 # Render with Thai font "Laksaman", font size 10pt, enable table of contents
 render("input.Rmd",
        output_format = thaipdf::thaipdf_document(
          thai_font = "Laksaman", # you must have this font in your system
          toc = TRUE,
          pandoc_args = pandoc_metadata_arg("fontsize", "10pt")
        ))
}