summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-07-10 20:28:34 +0000
committerKarl Berry <karl@freefriends.org>2019-07-10 20:28:34 +0000
commit4f58a04bac374894a50724aa34f44f3dd46298c1 (patch)
tree254a39cf2bebaf92b4949784eb994a88a0163d51 /Master
parent93dc906dc01c75bdbe19ebd78c0a1538bfc25b53 (diff)
thaispec (10jul19)
git-svn-id: svn://tug.org/texlive/trunk@51598 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/thaispec/README.md20
-rw-r--r--Master/texmf-dist/doc/latex/thaispec/thaispec.pdfbin56524 -> 84199 bytes
-rw-r--r--Master/texmf-dist/source/latex/thaispec/thaispec.dtx285
-rw-r--r--Master/texmf-dist/source/latex/thaispec/thaispec.ins4
-rw-r--r--Master/texmf-dist/tex/latex/thaispec/thaispec.sty80
5 files changed, 241 insertions, 148 deletions
diff --git a/Master/texmf-dist/doc/latex/thaispec/README.md b/Master/texmf-dist/doc/latex/thaispec/README.md
index dddc9d9ade9..7316c80ca18 100644
--- a/Master/texmf-dist/doc/latex/thaispec/README.md
+++ b/Master/texmf-dist/doc/latex/thaispec/README.md
@@ -11,27 +11,11 @@ Ratthaprom Promkam (ratthaprom@me.com)
## Prerequisite
Thai national fonts, i.e., SIPAFonts (See https://github.com/epsilonxe/sipafonts)
-## Recommendation
-Install TeX Gyre font family (Possibly included with your TeX distribution)
-
## Usage
-If you already have TeX Gyre font family, just simply add the preamble
+Just simply add the preamble
```
\usepackage{thaispec}
```
-Otherwise
-```
-\usepackage[texgyrefont=false]{thaispec}
-```
-This package allows you to input Thai characters directly to ```.tex``` file,
-and choose any Thai fonts to be used in the document.
-In order to choose the font, please make sure that the font is system wide, then use
-```
-\usepackage[thaifont = <SYSTEM THAI FONT NAME>]{thaispec}
-```
-Moreover, the package give you options to choose any system wide fonts for
-`mainfont`, `sansfont` and `monofont` too
-
For additional usage or more options, see the documentation.
## Credits
@@ -40,7 +24,7 @@ provided by Dittaya Wanvarie from Chulalongkorn University.
(See http://pioneer.netserv.chula.ac.th/~wdittaya/)
## License
-Copyright 2018 Ratthaprom Promkam
+Copyright Ratthaprom Promkam
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/Master/texmf-dist/doc/latex/thaispec/thaispec.pdf b/Master/texmf-dist/doc/latex/thaispec/thaispec.pdf
index fdfea254688..944a289b7b5 100644
--- a/Master/texmf-dist/doc/latex/thaispec/thaispec.pdf
+++ b/Master/texmf-dist/doc/latex/thaispec/thaispec.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/thaispec/thaispec.dtx b/Master/texmf-dist/source/latex/thaispec/thaispec.dtx
index 7b38c5780d5..793da531198 100644
--- a/Master/texmf-dist/source/latex/thaispec/thaispec.dtx
+++ b/Master/texmf-dist/source/latex/thaispec/thaispec.dtx
@@ -2,10 +2,10 @@
% 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"
+% -author "Ratthaprom_Promkam"
% thaispec
-% Created on 2018/3/9 18:44
+% Created on 2019/7/4 22:02
%\fi
%\iffalse
%<*package>
@@ -28,7 +28,7 @@
%\fi
% \iffalse
% Doc-Source file to use with LaTeX2e
-% Copyright (C) 2018 Ratthaprom_Promkam, all rights reserved.
+% Copyright (C) 2019 Ratthaprom_Promkam, all rights reserved.
% \fi
% \iffalse
%<*driver>
@@ -50,8 +50,12 @@
\newcommand{\pkgname}{\texttt{thaispec}}
+\newcommand{\showdefault}[1]{\par\vspace{0mm}\noindent{Default:}\par\noindent\texttt{#1}}
\newcommand{\showex}[1]{\par\vspace{0mm}\noindent{Example:}\par\noindent\texttt{#1}}
\newcommand{\printcenter}[1]{\par\begin{center}#1\end{center}\par\noindent}
+\newcommand{\myoption}[4]{{\texttt{#1}}&{#2}{\showdefault{#3}}{\showex{#4}}\\}
+\newcommand{\showoption}[2]{{\noindent\texttt{#1}}&{#2}\\\hline}
+
\newcommand{\mopt}{%
frame=single,
@@ -78,7 +82,7 @@ autogobble=true,
\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}
+\date{Version 0.4 from July 4, 2019}
\begin{document}
\DocInput{thaispec.dtx}
@@ -88,7 +92,7 @@ autogobble=true,
%\maketitle
%
%This package allows you to input Thai characters directly to \LaTeX\ documents
-%and choose any (system wide) Thai fonts for typesetting in \XeLaTeX.
+%and choose any (system wide) Thai fonts for typesetting via \XeLaTeX.
%It also tries to appropriately justify paragraphs with no more external tools.
%
%\tableofcontents
@@ -102,10 +106,13 @@ autogobble=true,
%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{Installation}
+%The \texttt{thaispec} packages are included in all major \LaTeX distributions.
+%In case it is not installed, please visit \url{https://github.com/epsilonxe/latex}} to download the latest version of \texttt{thaispec.sty} and put it in your working directory.
+%
%\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.
+%Install the collection of Thai national font said above.
+%Python and \textt{pygments} are also recommended to be installed to typeset Thai documents which some syntax highlighted codes are needed.
%
%\section{Package loading}
%In the preamble, add the command
@@ -113,24 +120,30 @@ autogobble=true,
%\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}.
-%
+%This will typeset the document by choosing \texttt{TH Sarabun New} for all Thai characters.
%The package also predefines \texttt{\textbackslash today} and \texttt{\textbackslash Today}
%for today Thai date printing in short and long formats respectively.
+%The Latin character will be typeseted 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}
+%
%
%\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.
+%This section lists additional loading options by their features.
+%Multiple options can be loaded with the following command.
+%\begin{minted}[frame=single]{LaTeX}
+%\usepackage[option_1, option_2, ...]{thaispec}
+%\end{minted}
+%The below table lists available options in the latest version.
+%
%\renewcommand{\arraystretch}{1.8}
-%\begin{longtable}{l p{5.8cm}}
+%\begin{longtable}{l p{9cm}}
%\caption{Loading options in \texttt{thaispec} package.} \label{table:loading_options}\\
%\hline
%\textbf{Options} & \textbf{Features}
@@ -144,58 +157,100 @@ autogobble=true,
%
%\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}
-% \\
+%
+%\showoption{thainum}{
+%Uses Thai numbers for almost all number digits which is disable by default.
+%Use \mint{LaTeX}|\usepackage[thainum]{thaipsec}|
+%to activate this option.
+%}
+%\showoption{math}{
+%Additionally load the following packages:
+%\texttt{mathtools}, \texttt{amssymb}, \texttt{amsthm}, \texttt{mathspec} orderly.
+%Moreover it sets various theorem environments like definition, theorem, corollary to Thai.
+%If your document consists of math objects, this option is then recommended.
+%Use \mint{LaTeX}|\usepackage[math]{thaispec}|
+%to activate this option.
+%}
+%\showoption{thaifont}{
+%Choose the selected Thai font for Thai charaters typeseting.
+%For example, use
+%\mint{LaTeX}|\usepackage[thaifont = Angsana New]{thaispec}|
+%to choose font named \texttt{Angsana New}.
+%Note that the selected font must be installed to the system before loading the package.
+%}
+%\showoption{sloppy}{
+%This option is for fairly better Thai justified paragraphs which is enable by default.
+%In case this option gives a bad justified output, try
+%\mint{LaTeX}|\usepackage[sloopy=false]{thaispec}| to disable this option.
+%}
+%\showoption{thaispacing}{
+%Mostly single spacing is too tight for Thai paragraph.
+%By defalut this package is loaded with one and a half spacing.
+%In case this option gives a bad justified output, try
+%\mint{LaTeX}|\usepackage[thaispacing=false]{thaispec}| to disable this option, i.e.,
+%This sets single spacing for all paragraphs.
+%}
+%\showoption{thaicaption}{
+%The package sets various captions in Thai.
+%This includes captions of chapter, section and table of contents.
+%It is activated by default.
+%If you do not want this, use
+%\mint{LaTeX}|\usepackage[thaicaption=false]{thaispec}| to disable this option.
+%}
+%
+% % \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,
+%other charaters are typesetted as usual,
%and paragraphs are justified by \texttt{\textbackslash sloppy} macro.
%%\begin{lstlisting}[style=tex,numbers=left]
%%\documentclass{article}
@@ -239,10 +294,7 @@ autogobble=true,
%highlightlines={2-5}
%]{LaTeX}
%\documentclass{article}
-%\usepackage[math,
-%thaifont = Tahoma,
-%texgyrefont = false,
-%sloppy = false]{thaispec}
+%\usepackage[math, thaifont = Tahoma, sloppy = false]{thaispec}
%\begin{document}
%\section{Math ภาษาไทย}
%การพิมพ์ภาษาไทยในเอกสาร $ax^2+bx+c=0$
@@ -255,6 +307,16 @@ autogobble=true,
%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.
+%If you do not install \texttt{pygments}, try using
+%\begin{minted}[frame=single]{shell}
+%$ pip install pygments
+%\end{minted}
+%Moreover, you need to enable shell-escape when typeset the document.
+%For example, use
+%\begin{minted}[frame=single]{shell}
+%$ xelatex -shell-escape your-tex-file.tex
+%\end{minted}
+%to typeset your tex file.
%
%\section{Credits}
%This package is motivated by a set of \LaTeX\ commands for typesetting Thai documents
@@ -282,7 +344,7 @@ autogobble=true,
% \end{macrocode}
%\fi
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{thaispec}[2018/03/29 version 0.3 thaispec]
+\ProvidesPackage{thaispec}[2019/07/03 version 0.4 thaispec]
\RequirePackage{kvoptions}
\RequirePackage[no-math]{fontspec}
@@ -299,11 +361,8 @@ autogobble=true,
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]
+\DeclareStringOption[TH Sarabun New]{thaifont}[TH Sarabun New]
\DeclareVoidOption{math}{%
\RequirePackage{mathtools}
@@ -311,14 +370,13 @@ prefix=THL@
\RequirePackage{amsthm}
\RequirePackage{mathspec}
}
-\DeclareVoidOption{thainum}{\renewcommand{\thesection}{\thainum{section}}}
+\DeclareVoidOption{thainum}{\renewcommand{\thesection}{\thainum{section}}}
-\DeclareBoolOption[true]{texgyrefont}
-\DeclareBoolOption[true]{thaithm}
\DeclareBoolOption[true]{sloppy}
\DeclareBoolOption[true]{thaispacing}
\DeclareBoolOption[true]{thaicaption}
+\DeclareBoolOption[false]{beamerthmcount}
\DeclareStringOption[default]{thmcount}[default]
@@ -327,7 +385,6 @@ prefix=THL@
% TeX Commands
-\newcommand{\testvar}{\THL@thmcount}
% Set Thai language
\XeTeXlinebreaklocale "th"
@@ -339,14 +396,7 @@ prefix=THL@
% Select Thai fonts
-\ifTHL@texgyrefont
-\setmainfont{\THL@mainfont}
-\setsansfont{\THL@sansfont}
-\setmonofont{\THL@monofont}
-\else
-\setmainfont[Scale=1.23]{\THL@thaifont}
-\fi
-
+% \setmainfont[Scale=1.23]{\THL@thaifont}
% Control English/Thai Fonts
\newfontfamily{\thaifont}[Scale=MatchUppercase,Mapping=tex-text]{\THL@thaifont}
@@ -364,17 +414,6 @@ prefix=THL@
\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}
@@ -433,8 +472,51 @@ prefix=THL@
}
+% In beamer
+\@ifclassloaded{beamer}
+{
+\let\theorem\relax
+\let\c@theorem\relax
+\let\lemma\relax
+\let\corollary\relax
+\let\definition\relax
+\let\example\relax
+\let\note\relax
+
+\ifTHL@beamerthmcount
+ \setbeamertemplate{theorems}[numbered]
+\fi
+
+}
+{%
+\ifTHL@thaispacing
+\onehalfspacing
+\fi
+}
+
+% In article class
+\@ifclassloaded{article}
+{
+\renewcommand{\THL@thmcount}{section}
+}
+{}
+
+% In book
+\@ifclassloaded{book}
+{
+\renewcommand{\THL@thmcount}{chapter}
+}
+{}
+
+% In report
+\@ifclassloaded{report}
+{
+\renewcommand{\THL@thmcount}{chapter}
+}
+{}
+
+
% Thai theorem environments
-\ifTHL@thaithm
\@ifpackageloaded{amsthm}
{%
\IfStrEqCase{\THL@thmcount}{%
@@ -552,8 +634,9 @@ prefix=THL@
}%
}%
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
-}{}
-\fi
+}
+{}
+
\endinput
%\iffalse
diff --git a/Master/texmf-dist/source/latex/thaispec/thaispec.ins b/Master/texmf-dist/source/latex/thaispec/thaispec.ins
index dea4c9b7fa2..a9d2cf6dd20 100644
--- a/Master/texmf-dist/source/latex/thaispec/thaispec.ins
+++ b/Master/texmf-dist/source/latex/thaispec/thaispec.ins
@@ -1,10 +1,10 @@
-% thaispec.ins generated using makedtx version 1.2 2018/3/9 18:44
+% thaispec.ins generated using makedtx version 1.2 2019/7/4 22:02
\input docstrip
\preamble
thaispec.dtx
- Copyright 2018 Ratthaprom_Promkam
+ Copyright 2019 Ratthaprom_Promkam
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/Master/texmf-dist/tex/latex/thaispec/thaispec.sty b/Master/texmf-dist/tex/latex/thaispec/thaispec.sty
index 0390fea0cfb..43f55494761 100644
--- a/Master/texmf-dist/tex/latex/thaispec/thaispec.sty
+++ b/Master/texmf-dist/tex/latex/thaispec/thaispec.sty
@@ -7,7 +7,7 @@
%% thaispec.dtx (with options: `thaispec.sty,package')
%%
%% thaispec.dtx
-%% Copyright 2018 Ratthaprom_Promkam
+%% Copyright 2019 Ratthaprom_Promkam
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -38,6 +38,13 @@
%% Right bracket \] Circumflex \^ Underscore \_
%% Grave accent \` Left brace \{ Vertical bar \|
%% Right brace \} Tilde \~}
+%% 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}
%%\begin{lstlisting}[style=tex,numbers=left]
%%\documentclass{article}
%%\usepackage{thaispec}
@@ -58,7 +65,7 @@
%%
%%\end{lstlisting}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{thaispec}[2018/03/29 version 0.3 thaispec]
+\ProvidesPackage{thaispec}[2019/07/03 version 0.4 thaispec]
\RequirePackage{kvoptions}
\RequirePackage[no-math]{fontspec}
@@ -74,10 +81,8 @@
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}
@@ -85,21 +90,19 @@ prefix=THL@
\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}
+\DeclareBoolOption[false]{beamerthmcount}
\DeclareStringOption[default]{thmcount}[default]
\ProcessKeyvalOptions{THL}
-\newcommand{\testvar}{\THL@thmcount}
-
\XeTeXlinebreaklocale "th"
\XeTeXlinebreakskip = 0pt plus 0pt
\ifTHL@sloppy
@@ -107,13 +110,6 @@ prefix=THL@
\fi
\defaultfontfeatures{Mapping=tex-text}
-\ifTHL@texgyrefont
-\setmainfont{\THL@mainfont}
-\setsansfont{\THL@sansfont}
-\setmonofont{\THL@monofont}
-\else
-\setmainfont[Scale=1.23]{\THL@thaifont}
-\fi
\newfontfamily{\thaifont}[Scale=MatchUppercase,Mapping=tex-text]{\THL@thaifont}
@@ -130,14 +126,6 @@ prefix=THL@
\AtBeginDocument\captionsthai
\fi
-\@ifclassloaded{beamer}
-{}
-{%
-\ifTHL@thaispacing
-\onehalfspacing
-\fi
-}
-
\def\thaialph#1{\expandafter\thalph\csname c@#1\endcsname}
\def\thalph#1{%
\ifcase#1\or ก\or ข\or ค\or ง\or จ\or ฉ\or ช\or ซ\or
@@ -189,7 +177,45 @@ prefix=THL@
\def\today{\DTMfetchday{now}\ \dtmonth\ พ.ศ. \theyearbd}
}
-\ifTHL@thaithm
+\@ifclassloaded{beamer}
+{
+\let\theorem\relax
+\let\c@theorem\relax
+\let\lemma\relax
+\let\corollary\relax
+\let\definition\relax
+\let\example\relax
+\let\note\relax
+
+\ifTHL@beamerthmcount
+ \setbeamertemplate{theorems}[numbered]
+\fi
+
+}
+{%
+\ifTHL@thaispacing
+\onehalfspacing
+\fi
+}
+
+\@ifclassloaded{article}
+{
+\renewcommand{\THL@thmcount}{section}
+}
+{}
+
+\@ifclassloaded{book}
+{
+\renewcommand{\THL@thmcount}{chapter}
+}
+{}
+
+\@ifclassloaded{report}
+{
+\renewcommand{\THL@thmcount}{chapter}
+}
+{}
+
\@ifpackageloaded{amsthm}
{%
\IfStrEqCase{\THL@thmcount}{%
@@ -307,8 +333,8 @@ prefix=THL@
}%
}%
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
-}{}
-\fi
+}
+{}
\endinput
%%