Skip to content

Lightbridge-KS/quarto-book-thai-pdf

Repository files navigation

Quarto Book in Thai Language with PDF

This repo demonstrate how to use Thai language 🇹🇭 in a Quarto Book that renders to PDF.

Introduction

Quarto book in Thai language can be rendered to MS Word or HTML format out of the box, but PDF requires some setup. I'll show you how to do that in this tutorial.

The key is to include thai language setting in the LaTeX preamble of the Quarto book.

Example

These are the output of this repo:

Step 1: Create Quarto Book

Create Quarto book skeleton as explained here, then enter into your book directory.

Step 2: Get Thai LaTeX Preamble Setting

If you use R, {thaipdf} R package can automate this process.

Simply call the following function in your book project.

# install.packages("thaipdf")
thaipdf::use_thai_preamble()

It will create thai-preamble.tex in your project, which is a LaTeX preamble that enable Thai language type-setting with Thai font default to TH Sarabun New (please check that this font is installed)

Step 3: Include Thai Preamble

In the Quarto config (_quarto.yml or _metadata.yml), add thai-preamble.tex to include in the LaTeX preamble to the pdf field, like so.

_quarto.yml

format:
  pdf:
    include-in-header: "thai-preamble.tex"

(You can also keep intermediate LaTeX for debugging with keep-tex: true)

This book is now ready to be rendered as PDF with Thai font.

quarto render

It's done!

About

Example repo for render Quarto Book to PDF in Thai language 🇹🇭

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages