diff options
author | Karl Berry <karl@freefriends.org> | 2019-07-10 20:28:34 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-07-10 20:28:34 +0000 |
commit | 4f58a04bac374894a50724aa34f44f3dd46298c1 (patch) | |
tree | 254a39cf2bebaf92b4949784eb994a88a0163d51 /Master/texmf-dist/source/latex | |
parent | 93dc906dc01c75bdbe19ebd78c0a1538bfc25b53 (diff) |
thaispec (10jul19)
git-svn-id: svn://tug.org/texlive/trunk@51598 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/thaispec/thaispec.dtx | 285 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/thaispec/thaispec.ins | 4 |
2 files changed, 186 insertions, 103 deletions
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{ucharclasses}, \texttt{polyglossia}, \texttt{setspace}, \texttt{datetime2}, \texttt{kvoptions}, \texttt{afterpackage}, \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 |