Convert to a PDF/LaTeX document with Thai Language Compatibility
Source:R/thaipdf.R
thaipdf_document.Rd
Thai language supported conversion of R Markdown to a PDF or LaTeX document.
It is a wrapper around rmarkdown::pdf_document()
.
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 ofpdf_document()
except forincludes
andlatex_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
How to use
rmarkdown::pdf_document
, please see official documentation.How to use
thaipdf_book()
.
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")
))
}