Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lightbridge-ks/quarto-book-thai-pdf
Example repo for render Quarto Book to PDF in Thai language ๐น๐ญ
https://github.com/lightbridge-ks/quarto-book-thai-pdf
pdf quarto thai-language
Last synced: 8 days ago
JSON representation
Example repo for render Quarto Book to PDF in Thai language ๐น๐ญ
- Host: GitHub
- URL: https://github.com/lightbridge-ks/quarto-book-thai-pdf
- Owner: Lightbridge-KS
- Created: 2022-06-13T12:17:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-13T14:47:39.000Z (over 2 years ago)
- Last Synced: 2024-11-15T18:51:41.983Z (2 months ago)
- Topics: pdf, quarto, thai-language
- Language: TeX
- Homepage: https://lightbridge-ks.github.io/quarto-book-thai-pdf/
- Size: 505 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Quarto Book in Thai Language with PDF
> This repo demonstrate how to use **Thai language ๐น๐ญ** in a **[Quarto Book](https://quarto.org/docs/books/)** 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:
- [**PDF Book in Thai**](./docs/Quarto-Book-เนเธเธข.pdf) (and [LaTeX output](Quarto-Book-เนเธเธข.tex))
- [**HTML Book**](https://lightbridge-ks.github.io/quarto-book-thai-pdf/)## Step 1: Create Quarto Book
Create Quarto book skeleton as [explained here](https://quarto.org/docs/books/), then enter into your book directory.
## Step 2: Get Thai LaTeX Preamble Setting
If you use `R`, [`{thaipdf}`](https://lightbridge-ks.github.io/thaipdf/) R package can automate this process.
Simply call the following function in your book project.
```r
# install.packages("thaipdf")
thaipdf::use_thai_preamble()
```It will create [`thai-preamble.tex`](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](https://www.f0nt.com/release/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](https://quarto.org/docs/output-formats/pdf-basics.html#latex-includes) to the `pdf` field, like so.
[**`_quarto.yml`**](./_quarto.yml)
```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.
```shell
quarto render
```It's done!