All templates assume XeLaTeX and THSarabunNew installed system-wide. Each is a complete, compilable file. The shared preamble is the foundation — start there.

Foundation

preamble.tex ส่วนนำร่วม
shared beamer article

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.

% Languages \setmainlanguage{english} \setotherlanguage{thai} % XeTeX line breaking — inside \AtBeginDocument for safety \AtBeginDocument{% \XeTeXlinebreaklocale "th" \XeTeXlinebreakskip = 0pt plus 2.5pt } \newfontfamily\thaifont{THSarabunNew}[ Path = ./fonts/THSarabunNew/, Scale = MatchUppercase, ... ]

Beamer presentations

beamer-bilingual.tex สไลด์สองภาษา
beamer

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.

\documentclass[12pt,landscape]{beamer} \input{preamble} \title{Computational Physics} \author{% Department of Physics \\ \thaifont{ภาควิชาฟิสิกส์} } \date{} \begin{document} \frame{\titlepage} \begin{frame}[t]{Topic} English explanation.\\ {\scriptsize\thaifont คำอธิบายภาษาไทย} \end{frame} \end{document}
beamer-exam.tex ข้อสอบ
beamer

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.

\begin{frame}[t]{Paper Section A1: Interest and Growth} \footnotesize (a) Compute the value of \$1000 after 5 years at $r=4\%$.\\ {\scriptsize\thaifont คำนวณจำนวนเงินหลังจาก 5 ปี} \vspace{3.5em} % space for written answer (b) Which account yields more after 5 years?\\ {\scriptsize\thaifont บัญชีใดให้ผลตอบแทนมากกว่า} \end{frame}

Paper size pattern

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.

Paper size wrapper pattern
pattern beamer

Three files: the content document, an A4 print wrapper, a Letter print wrapper. The content file never changes for paper size.

% --- exam.tex (content, never touch paper size here) --- \documentclass[12pt,landscape]{beamer} \input{preamble} % ... all content ... % --- exam-a4.tex (print wrapper for Thailand) --- \PassOptionsToClass{a4paper}{beamer} \input{exam} % --- exam-letter.tex (print wrapper for US) --- \PassOptionsToClass{letterpaper}{beamer} \input{exam}

Compile the wrapper, not the content file: xelatex exam-a4.tex


Articles and reports

article-thai.tex บทความภาษาไทย
article

Minimal Thai article. Main language Thai, English secondary. Sections, a figure environment, and a bibliography stub. Starting point for a Thai-primary academic paper.

\documentclass[12pt,a4paper]{article} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{thai} \setotherlanguage{english} \setmainfont{TH Sarabun New}[Script=Thai, Language=Thai] \AtBeginDocument{% \XeTeXlinebreaklocale "th" \XeTeXlinebreakskip = 0pt plus 1pt }
article-bilingual.tex บทความสองภาษา
article

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.

\documentclass[12pt,a4paper]{article} \setmainlanguage{english} \setotherlanguage{thai} \setmainfont{TeX Gyre Pagella}[Ligatures=TeX] \newfontfamily\thaifont{TH Sarabun New}[Script=Thai] \begin{document} This is English text. \begin{thai} ส่วนนี้เป็นภาษาไทย \end{thai} \end{document}

All templates use \AtBeginDocument for \XeTeXlinebreaklocale. This is correct for any document class. See polyglossia/ for explanation.
The preamble loads fonts from ./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/.