summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/thaispec/thaispec.dtx
blob: 7b38c5780d5c15e64fdbb3f84298fe89546914ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
%\iffalse
% thaispec.dtx generated using makedtx version 1.2 (c) Nicola Talbot
% Command line args:
%   -src "thaispec\.sty=>thaispec.sty"
%   -author "Ratthaprom_Promkam"
%   -doc "thaispec.tex"
%   thaispec
% Created on 2018/3/9 18:44
%\fi
%\iffalse
%<*package>
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%</package>
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
% Copyright (C) 2018 Ratthaprom_Promkam, all rights reserved.
% \fi
% \iffalse
%<*driver>
\documentclass{article}

\usepackage[thaispacing=false,thaicaption=false]{thaispec}
\usepackage{metalogo}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    filecolor=magenta,
    urlcolor=blue,
}
%\usepackage{listings}
\usepackage{color}
\usepackage{longtable}
\usepackage{minted}


\newcommand{\pkgname}{\texttt{thaispec}}
\newcommand{\showex}[1]{\par\vspace{0mm}\noindent{Example:}\par\noindent\texttt{#1}}
\newcommand{\printcenter}[1]{\par\begin{center}#1\end{center}\par\noindent}

\newcommand{\mopt}{%
frame=single,
linenos=true,
autogobble=true,
}

%\lstdefinestyle{tex}{%
%language=[LaTeX]{TeX},
%basicstyle=\ttfamily\small\color{red},
%keywordstyle=\bfseries\color{black},
%frame=single,
%backgroundcolor=\color{white},
%extendedchars=true,
%inputencoding=utf8,
%breaklines=true,
%postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
%showstringspaces=true,
%}

%\lstset{style=tex}

\newminted{latex}{frame=single}

\title{The \pkgname\ package: \\Thai language typesetting in \XeLaTeX}
\author{Ratthaprom Promkam\\{\texttt{\small ratthaprom@me.com}}}
\date{Version 0.3 from March 9, 2018}

\begin{document}
\DocInput{thaispec.dtx}
\end{document}
%</driver>
%\fi
%\maketitle
%
%This package allows you to input Thai characters directly to \LaTeX\ documents
%and choose any (system wide) Thai fonts for typesetting in \XeLaTeX.
%It also tries to appropriately justify paragraphs with no more external tools.
%
%\tableofcontents
%
%
%\section{Prerequisite}
%The package use \texttt{TH Sarabun New} font by default to typeset Thai characters
%which included in the collection of Thai national fonts
%\footnote{Thai national fonts, a.k.a. \texttt{SIPAFonts}.
%See \url{https://github.com/epsilonxe/sipafonts}}.
%At least this font must be installed to system wide in order to use this package.
%Moreover the following \LaTeX\ package are essentially required for the default option: \texttt{fontspec}, \texttt{uchar­classes}, \texttt{poly­glos­sia}, \texttt{setspace}, \texttt{date­time2}, \texttt{kvop­tions}, \texttt{after­pack­age}, \texttt{xstring}, and \texttt{xpatch}.
%
%\section{Recommendation}
%Install the collection of Thai national font said above and also \TeX\ Gyre font family
%which possibly already included with your \TeX\ distribution.
%These are basically assumed to be installed prior loading the package.
%
%\section{Package loading}
%In the preamble, add the command
%\begin{minted}[frame=single]{latex}
%\usepackage{thaispec}
%\end{minted}
%then you can input Thai characters in the document and typeset the document as usual.
%By default the package set \texttt{thaifont} to \texttt{TH Sarabun New},
%while set \texttt{mainfont}, \texttt{sansfont} and \texttt{monofont} to \TeX\ Gyre fonts.
%
%In case \TeX\ Gyre font family is not system wide installed, the package should be loaded
%with the following option:
%\begin{minted}[frame=single]{LaTeX}
%\usepackage[texgyrefont = false]{thaispec}
%\end{minted}
%This will typeset the document by setting \texttt{mainfont} to \texttt{TH Sarabun New}.
%
%The package also predefines \texttt{\textbackslash today} and \texttt{\textbackslash Today}
%for today Thai date printing in short and long formats respectively.
%
%\section{Loading options}
%This section lists additional loading options by their features as follows.
%The examples in the list are default and also initialized values for those options.
%\renewcommand{\arraystretch}{1.8}
%\begin{longtable}{l p{5.8cm}}
%\caption{Loading options in \texttt{thaispec} package.} \label{table:loading_options}\\
%\hline
%\textbf{Options}  & \textbf{Features}
%\\ \hline
%\endfirsthead
%\caption{(continued) Loading options in \texttt{thaispec} package.}\\
%\hline
%\textbf{Options}  & \textbf{Features}
%\\ \hline
%\endhead
%
%\hline
%\endfoot
%  \texttt{thainum}
%  & Uses Thai numbers for almost all number digits.
%  It is untoggled by defalut.
%  \\
%  \texttt{math}
%  & Additionally load the following packages:
%  \texttt{mathtools}, \texttt{amssymb}, \texttt{amsthm}, \texttt{mathspec} orderly.
%
%  Normally \pkgname\ package loads \texttt{fontspec}\ with \texttt{no-math}\ option.
%  If your document consists of math objects, this option is then recommended.
%  \\
%  \texttt{thaifont = <SYSTEM\_FONT\_NAME>}
%  & Choose a system font for Thai characters.
%  \showex{thaifont = TH Sarabun New}
%  \\
%  \texttt{mainfont = <SYSTEM\_FONT\_NAME>}
%  & Choose a font for \texttt{mainfont} corresponding to \texttt{fontspec} package.
%  \showex{thaifont = TeX Gyre Termes}
%  \\
%  \texttt{sansfont = <SYSTEM\_FONT\_NAME>}
%  & Choose a font for \texttt{sansfont} corresponding to \texttt{fontspec} package.
%  \showex{thaifont = TeX Gyre Heros}
%  \\
%  \texttt{monofont = <SYSTEM\_FONT\_NAME>}
%  & Choose a font for \texttt{monofont} corresponding to \texttt{fontspec} package.
%  \showex{thaifont = TeX Gyre Cursors}
%  \\
%  \texttt{thaithm = <BOOL>}
%  & After loading \texttt{amsthm} package, \texttt{thaispec} package automatically defines
%  a set of theorem-like environments with Thai heading by default.
%  The automatic defined environments includes
%  \texttt{theorem}, \texttt{lemma}, \texttt{corollary},
%  \texttt{definition}, \texttt{axiom}, \texttt{undefinedterm},
%  \texttt{example}, \texttt{remark} and \texttt{note}.
%  If you prefer to set them yourself, just set its value to \texttt{false}.
%  \showex{thaithm = true}
%  \\
%  \texttt{thmcount = <VALUE>}
%  & If the option \texttt{thaithm = true} is prefered,
%  this package set the counter independently for each automatic defined environments.
%  The value of \texttt{<VALUE>} can be one of the following:
%  \texttt{default}, \texttt{no}, \texttt{full}, \texttt{section},
%  \texttt{chapter}, \texttt{kind}, \texttt{kind-section}, and \texttt{kind-chapter}.
%  \showex{thmcount = default}
%  \\
%\end{longtable}
%
%\section{Usage Examples}
%The following example is a basic example of using \texttt{thaispec} package.
%It is loaded with the default setting for typesetting in \XeLaTeX, i.e.,
%only Thai characters are typesetted with \texttt{TH Sarabun New} font,
%other charaters are typesetted with \TeX\ Gyre fonts,
%and paragraphs are justified by \texttt{\textbackslash sloppy} macro.
%%\begin{lstlisting}[style=tex,numbers=left]
%%\documentclass{article}
%%\usepackage{thaispec}
%%\begin{document}
%%\section{Thai ภาษาไทย}
%%Thai charaters can be input directly like this ทดสอบการพิมพ์ภาษาไทยในเอกสาร \XeLaTeX\
%%
%%\end{lstlisting}
%\begin{minted}[
%frame=single,
%linenos=true,
%autogobble=true,
%highlightlines={2}
%]{LaTeX}
%\documentclass{article}
%\usepackage{thaispec}
%\begin{document}
%\section{ภาษาไทย}
%ทดสอบการพิมพ์ภาษาไทยในเอกสาร \XeLaTeX
%
%\end{minted}
%In order to use another Thai font face for any charaters in a math document without
%\texttt{\textbackslash sloppy} macro,
%the following example can be used to achieve the goal.
%%\begin{lstlisting}[style=tex,numbers=left]
%%\documentclass{article}
%%\usepackage[math,
%%thaifont = Tahoma,
%%texgyrefont = false,
%%sloppy = false]{thaispec}
%%\begin{document}
%%\section{Math ภาษาไทย}
%%Thai charaters can be input directly like this ทดสอบการพิมพ์ภาษาไทยในเอกสาร $ax^2+bx+c=0$
%%
%%\end{lstlisting}
%\begin{minted}[%
%frame=single,
%linenos=true,
%autogobble=true,
%highlightlines={2-5}
%]{LaTeX}
%\documentclass{article}
%\usepackage[math,
%thaifont = Tahoma,
%texgyrefont = false,
%sloppy = false]{thaispec}
%\begin{document}
%\section{Math ภาษาไทย}
%การพิมพ์ภาษาไทยในเอกสาร $ax^2+bx+c=0$
%
%\end{minted}
%
%
%\section{Known Issues}
%\subsection*{Incorrect Thai characters with \texttt{listing} package}
%If you typeset some codes consisting of Thai characters in \texttt{lstlisting} environment provided by \texttt{listing} package, this will possibly cause you a problem with incorrect Thai characters.
%The recommendation is choosing \texttt{minted} package instead of \texttt{listing} package.
%However you need to additionally install \texttt{pygments} python module in order to use \texttt{minted} package.
%
%\section{Credits}
%This package is motivated by a set of \LaTeX\ commands for typesetting Thai documents
%provided by Dittaya Wanvarie
%\footnote{See {\url{http://pioneer.netserv.chula.ac.th/~wdittaya/}} in \LaTeX\ section.} from Chulalongkorn University.
%
%\section{License}
%This work may be distributed and/or modified under the
%conditions of the LaTeX Project Public License, either version 1.3
%of this license of (at your option) any later version.
%The latest version of this license is in
%\printcenter{\url{http://www.latex-project.org/lppl.txt}}
%and version 1.3 or later is part of all distributions of LaTeX
%version 2005/12/01 or later.
%
%
%
%
%
%\StopEventually{}
%\section{The Code}
%\iffalse
%    \begin{macrocode}
%<*thaispec.sty>
%    \end{macrocode}
%\fi
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{thaispec}[2018/03/29 version 0.3 thaispec]

\RequirePackage{kvoptions}
\RequirePackage[no-math]{fontspec}
\RequirePackage[Latin, Thai]{ucharclasses}
\RequirePackage{setspace}
\RequirePackage{polyglossia}
\RequirePackage[calc]{datetime2}
\RequirePackage{xstring}
\RequirePackage{afterpackage}
\RequirePackage{xpatch}

% Key-Value Options
\SetupKeyvalOptions{
family=THL,
prefix=THL@
}
\DeclareStringOption[TH Sarabun New]{thaifont}[TH Sarabun New]
\DeclareStringOption[TeX Gyre Termes]{mainfont}[TeX Gyre Termes]
\DeclareStringOption[TeX Gyre Heros]{sansfont}[TeX Gyre Heros]
\DeclareStringOption[TeX Gyre Cursor]{monofont}[TeX Gyre Cursor]


\DeclareVoidOption{math}{%
\RequirePackage{mathtools}
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage{mathspec}
}
\DeclareVoidOption{thainum}{\renewcommand{\thesection}{\thainum{section}}}


\DeclareBoolOption[true]{texgyrefont}
\DeclareBoolOption[true]{thaithm}
\DeclareBoolOption[true]{sloppy}
\DeclareBoolOption[true]{thaispacing}
\DeclareBoolOption[true]{thaicaption}

\DeclareStringOption[default]{thmcount}[default]

\ProcessKeyvalOptions{THL}


% TeX Commands

\newcommand{\testvar}{\THL@thmcount}

% Set Thai language
\XeTeXlinebreaklocale "th"
\XeTeXlinebreakskip = 0pt plus 0pt
\ifTHL@sloppy
\sloppy
\fi
\defaultfontfeatures{Mapping=tex-text}


% Select Thai fonts
\ifTHL@texgyrefont
\setmainfont{\THL@mainfont}
\setsansfont{\THL@sansfont}
\setmonofont{\THL@monofont}
\else
\setmainfont[Scale=1.23]{\THL@thaifont}
\fi


% Control English/Thai Fonts
\newfontfamily{\thaifont}[Scale=MatchUppercase,Mapping=tex-text]{\THL@thaifont}

\newenvironment{thailang}
{\thaifont}
{}

\setTransitionTo{Thai}{\begin{thailang}}
\setTransitionFrom{Thai}{\end{thailang}}

\setdefaultlanguage{english}
\setotherlanguage{thai}
\ifTHL@thaicaption
\AtBeginDocument\captionsthai
\fi

% In case of Beamer class
\@ifclassloaded{beamer}
{}
{%
\ifTHL@thaispacing
\onehalfspacing
\fi
}




% Define Thai alpha/number/digit for enumerated items
\def\thaialph#1{\expandafter\thalph\csname c@#1\endcsname}
\def\thalph#1{%
    \ifcase#1\or ก\or ข\or ค\or ง\or จ\or ฉ\or ช\or ซ\or
    ฌ\or ญ\or ฎ\or ฏ\or ฐ\or ฑ\or ฒ\or ณ\or ด\or ต\or ถ\or ท\or ธ\or น\or
    บ\or ป\or ผ\or ฝ\or พ\or ฟ\or ภ\or ม\or ย\or ร\or ฤ\or ล\or ฦ\or ว\or
    ศ\or ษ\or ส\or ห\or ฬ\or อ\else ฮ\else\xpg@ill@value{#1}{thalph}\fi}
\def\thainum#1{\expandafter\thainumber\csname c@#1\endcsname}
\def\thainumber#1{%
    \thaidigits{\number#1}%
}
\def\thaidigits#1{\expandafter\thdigits #1@ }
\def\thdigits#1{%
    \ifx @#1% then terminate
    \else
    \ifx0#1๐\else\ifx1#1๑\else\ifx2#1๒\else\ifx3#1๓\else\ifx4#1๔\else\ifx5#1๕\else\ifx6#1๖\else\ifx7#1๗\else\ifx8#1๘\else\ifx9#1๙\else#1\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
    \expandafter\thdigits
    \fi
}

% Define Thai datetime
% \today - Print today in short format d-M-Y(BD)
% \Today - Print today in long format dow-d-M-Y(BD)
\DTMsavenow{now}
\newcommand{\dtdow}{\IfStrEqCase{\DTMfetchdow{now}}{{0}{วันจันทร์}
{1}{วันอังคาร}
{2}{วันพุธ}
{3}{วันพฤหัสบดี}
{4}{วันศุกร์}
{5}{วันเสาร์}
{6}{วันอาทิตย์}
}}

\newcommand{\dtmonth}{\IfStrEqCase{\DTMfetchmonth{now}}{{1}{มกราคม}
{2}{กุมภาพันธ์}
{3}{มีนาคม}
{4}{เมษายน}
{5}{พฤษภาคม}
{6}{มิถุนายน}
{7}{กรกฎาคม}
{8}{สิงหาคม}
{9}{กันยายน}
{10}{ตุลาคม}
{11}{พฤศจิกายน}
{12}{ธันวาคม}
}}

\newcounter{yearbd}
\setcounter{yearbd}{\DTMfetchyear{now}}
\addtocounter{yearbd}{543}
%\newcommand{\dtyearbd}{\FPadd{\tmpdtyearbd}{\DTMfetchyear{now}}{543}\FPclip{\rtmpdtyearbd}{\tmpdtyearbd}พ.ศ.\;\rtmpdtyearbd}
\AtBeginDocument{
\def\Today{\dtdow\ \DTMfetchday{now}\ \dtmonth\ พ.ศ. \theyearbd}
\def\today{\DTMfetchday{now}\ \dtmonth\ พ.ศ. \theyearbd}
}


% Thai theorem environments
\ifTHL@thaithm
\@ifpackageloaded{amsthm}
{%
\IfStrEqCase{\THL@thmcount}{%
{default}{%
\newtheorem{theorem}{ทฤษฎีบท}
\newtheorem{lemma}[theorem]{บทตั้ง}
\newtheorem{corollary}[theorem]{บทแทรก}
\newtheorem{proposition}[theorem]{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{บทนิยาม}
\newtheorem{undefinedterm}[theorem]{อนิยาม}
\newtheorem{axiom}[theorem]{สัจพจน์}
\newtheorem{example}[theorem]{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem*{remark}{หมายเหตุ}
\newtheorem*{note}{บันทึก}
}%
{no}{%
\newtheorem*{theorem}{ทฤษฎีบท}
\newtheorem*{lemma}{บทตั้ง}
\newtheorem*{corollary}{บทแทรก}
\newtheorem*{proposition}{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem*{definition}{บทนิยาม}
\newtheorem*{undefinedterm}{อนิยาม}
\newtheorem*{axiom}{สัจพจน์}
\newtheorem*{example}{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem*{remark}{หมายเหตุ}
\newtheorem*{note}{บันทึก}
}%
{full}{%
\newtheorem{theorem}{ทฤษฎีบท}
\newtheorem{lemma}[theorem]{บทตั้ง}
\newtheorem{corollary}[theorem]{บทแทรก}
\newtheorem{proposition}[theorem]{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{บทนิยาม}
\newtheorem{undefinedterm}[theorem]{อนิยาม}
\newtheorem{axiom}[theorem]{สัจพจน์}
\newtheorem{example}[theorem]{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem{remark}{หมายเหตุ}
\newtheorem{note}{บันทึก}
}%
{section}{%
\newtheorem{theorem}{ทฤษฎีบท}[section]
\newtheorem{lemma}[theorem]{บทตั้ง}
\newtheorem{corollary}[theorem]{บทแทรก}
\newtheorem{proposition}[theorem]{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{บทนิยาม}
\newtheorem{undefinedterm}[theorem]{อนิยาม}
\newtheorem{axiom}[theorem]{สัจพจน์}
\newtheorem{example}[theorem]{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem*{remark}{หมายเหตุ}
\newtheorem*{note}{บันทึก}
}%
{chapter}{%
\newtheorem{theorem}{ทฤษฎีบท}[chapter]
\newtheorem{lemma}[theorem]{บทตั้ง}
\newtheorem{corollary}[theorem]{บทแทรก}
\newtheorem{proposition}[theorem]{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{บทนิยาม}
\newtheorem{undefinedterm}[theorem]{อนิยาม}
\newtheorem{axiom}[theorem]{สัจพจน์}
\newtheorem{example}[theorem]{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem*{remark}{หมายเหตุ}
\newtheorem*{note}{บันทึก}
}%
{kind}{%
\newtheorem{theorem}{ทฤษฎีบท}
\newtheorem{lemma}[theorem]{บทตั้ง}
\newtheorem{corollary}[theorem]{บทแทรก}
\newtheorem{proposition}[theorem]{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem{definition}{บทนิยาม}
\newtheorem{undefinedterm}[definition]{อนิยาม}
\newtheorem{axiom}[definition]{สัจพจน์}
\newtheorem{example}{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem{remark}{หมายเหตุ}
\newtheorem{note}{บันทึก}
}%
{kind-section}{%
\newtheorem{theorem}{ทฤษฎีบท}[section]
\newtheorem{lemma}[theorem]{บทตั้ง}
\newtheorem{corollary}[theorem]{บทแทรก}
\newtheorem{proposition}[theorem]{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem{definition}{บทนิยาม}[section]
\newtheorem{undefinedterm}[definition]{อนิยาม}
\newtheorem{axiom}[definition]{สัจพจน์}
\newtheorem{example}{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem{remark}{หมายเหตุ}[section]
\newtheorem{note}{บันทึก}[section]
}%
{kind-chapter}{%
\newtheorem{theorem}{ทฤษฎีบท}[chapter]
\newtheorem{lemma}[theorem]{บทตั้ง}
\newtheorem{corollary}[theorem]{บทแทรก}
\newtheorem{proposition}[theorem]{ทฤษฎีบทประกอบ}
\theoremstyle{definition}
\newtheorem{definition}{บทนิยาม}[chapter]
\newtheorem{undefinedterm}[definition]{อนิยาม}
\newtheorem{axiom}[definition]{สัจพจน์}
\newtheorem{example}{ตัวอย่าง}
\theoremstyle{remark}
\newtheorem{remark}{หมายเหตุ}[chapter]
\newtheorem{note}{บันทึก}[chapter]
}%
}%
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
}{}
\fi

\endinput
%\iffalse
%    \begin{macrocode}
%</thaispec.sty>
%    \end{macrocode}
%\fi
%\Finale
\endinput