Copy, compile, modify. Real documents from real use, not toy examples.
All templates assume XeLaTeX and THSarabunNew installed system-wide. Each is a complete, compilable file. The shared preamble is the foundation — start there.
Shared preamble for bilingual Thai-English documents. Fonts, language setup, line breaking, FancyVerbatim, and Beamer font assignments in one file. \input{preamble} from any document class.
Fonts loaded from a local ./fonts/ path — portable for shared decks that travel with their fonts. See fonts/install for system-wide alternative.
Minimal bilingual Beamer deck. Title slide, one content frame showing the \thaifont{...} inline pattern, one frame with a BVerbatim code block. The simplest starting point for a Thai physics lecture.
Bilingual exam deck structure: paper section with TikZ diagrams, computer practical tasks with BVerbatim code blocks, install slides for contingency. Based on the Naresuan University Computational Physics final exam, Winter 2026.
Each question frame follows the pattern: English instruction at \footnotesize, Thai translation at {\scriptsize\thaifont ...} immediately below. Consistent, readable, printable.
A deck used for screen projection in California and printed on A4 in Thailand needs two paper sizes from one source file. The clean solution: keep content untouched, wrap it in thin platform files.
Three files: the content document, an A4 print wrapper, a Letter print wrapper. The content file never changes for paper size.
Compile the wrapper, not the content file: xelatex exam-a4.tex
Minimal Thai article. Main language Thai, English secondary. Sections, a figure environment, and a bibliography stub. Starting point for a Thai-primary academic paper.
English-primary article with Thai passages. Uses TeX Gyre Pagella for English body, THSarabunNew for Thai blocks. The correct pattern for mixed academic writing where English is the primary language of record.
\AtBeginDocument for \XeTeXlinebreaklocale. This is correct for any document class. See polyglossia/ for explanation.
./fonts/THSarabunNew/ — a local path relative to the document. This is intentional for portable shared decks. If you want system-font loading instead, replace the Path and Extension lines with \setmainfont{TH Sarabun New} after a system-wide install. See fonts/.