diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/projlib/PJLlang.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/projlib/PJLlang.sty | 217 |
1 files changed, 217 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/projlib/PJLlang.sty b/Master/texmf-dist/tex/latex/projlib/PJLlang.sty new file mode 100644 index 00000000000..13911df82f8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/projlib/PJLlang.sty @@ -0,0 +1,217 @@ +%% +%% This is file `PJLlang.sty', +%% generated with the docstrip utility. + +%% Copyright (C) 2021 by Jinwen XU +%% +%% This is part of the ProjLib Toolkit. +%% +%% This work may be distributed and/or modified under the conditions of the +%% LaTeX Project Public License, either version 1.3c of this license or (at +%% your option) any later version. The latest version of this license is in +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3c or later is part of all distributions of LaTeX version +%% 2005/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[2020-10-01] +\ProvidesPackage{PJLlang} + [2021/05/19 Multi-language configuration] +\RequirePackage{kvoptions} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{% + family = @PJLlang, + prefix = @PJLlang@ +} +\DeclareBoolOption[false]{polyglossia} +\ProcessKeyvalOptions*\relax + +\newcommand\englishABBR{EN} +\newcommand\frenchABBR{FR} +\newcommand\ngermanABBR{DE} +\newcommand\chineseABBR{CN} +\newcommand\tchineseABBR{TC} +\newcommand\japaneseABBR{JP} +\newcommand\russianABBR{RU} + +\RequirePackage{iftex} +\ifPDFTeX +\RequirePackage[T1]{fontenc} +\RequirePackage{inputenc} +\fi + +\if@PJLlang@polyglossia + \RequirePackage{polyglossia} + \setdefaultlanguage{english} + \setotherlanguage[frenchpart=false]{french} + \setotherlanguage{ngerman} + \setotherlanguage{spanish} + \setotherlanguage{portuguese} + \setotherlanguage{italian} + \ifPDFTeX\else + \setotherlanguage{russian} + \setotherlanguage{japanese} + \RequirePackage{silence} + \WarningFilter{polyglossia}{Asking to add empty feature to latin font(Script="CJK" to scripttag "")} + \fi +\else + \ifPDFTeX\else + \PassOptionsToPackage{japanese,russian}{babel} + \fi + \PassOptionsToPackage{italian,portuguese,brazilian,spanish.noquoting,ngerman,french,english,shorthands=off}{babel} + \PassOptionsToPackage{italian,brazilian,spanish,ngerman,french,english}{cleveref} + \RequirePackage{babel} + \frenchsetup{PartNameFull=false} +\fi +\let\today@PJLoriginal\today +\newcommand{\PJLlang@langconfig@common}{% + \ifdefined\DTMtoday% + \let\today\DTMtoday% + \else% + \let\today\today@PJLoriginal% + \fi% +} +\newcommand{\PJLlang@langconfig@chinese}{% + \def\abstractname{摘要}% + \def\proofname{证明}% + \def\contentsname{目录}% + \def\listfigurename{插图}% + \def\listtablename{表格}% + \def\figurename{图}% + \def\tablename{表}% + \def\indexname{索引}% + \def\appendixname{附录}% + \def\refname{参考文献}% + \def\bibname{参考文献}% + \let\today\zhtoday% + \renewcommand{\languagename}{chinese}% +} +\newcommand{\PJLlang@langconfig@tchinese}{% + \def\abstractname{摘要}% + \def\proofname{證明}% + \def\contentsname{目錄}% + \def\listfigurename{插圖}% + \def\listtablename{表格}% + \def\figurename{圖}% + \def\tablename{表}% + \def\indexname{索引}% + \def\appendixname{附錄}% + \def\refname{參考文獻}% + \def\bibname{參考文獻}% + \let\today\zhtoday% + \renewcommand{\languagename}{tchinese}% +} +\newcommand{\PJLlang@langconfig@japanese}{% + \selectlanguage{japanese}% +} +\newcommand{\PJLlang@langconfig@english}{% + \selectlanguage{english}% +} +\newcommand{\PJLlang@langconfig@french}{% + \selectlanguage{french}% + \def\frenchpartname{Partie}% +} +\newcommand{\PJLlang@langconfig@german}{% + \selectlanguage{ngerman}% +} +\newcommand{\PJLlang@langconfig@russian}{% + \selectlanguage{russian}% +} +\NewDocumentCommand\AddLanguageSetting{d()m}{% +\IfNoValueTF{#1}% + {\gappto{\PJLlang@langconfig@common}{#2}}% + {% + \ifstrequal{#1}{chinese}{\gappto{\PJLlang@langconfig@chinese}{#2}}{}% + \ifstrequal{#1}{Chinese}{\gappto{\PJLlang@langconfig@chinese}{#2}}{}% + \ifstrequal{#1}{schinese}{\gappto{\PJLlang@langconfig@chinese}{#2}}{}% + \ifstrequal{#1}{SChinese}{\gappto{\PJLlang@langconfig@chinese}{#2}}{}% + \ifstrequal{#1}{simplifiedchinese}{\gappto{\PJLlang@langconfig@chinese}{#2}}{}% + \ifstrequal{#1}{SimplifiedChinese}{\gappto{\PJLlang@langconfig@chinese}{#2}}{}% + \ifstrequal{#1}{tchinese}{\gappto{\PJLlang@langconfig@tchinese}{#2}}{}% + \ifstrequal{#1}{TChinese}{\gappto{\PJLlang@langconfig@tchinese}{#2}}{}% + \ifstrequal{#1}{traditionalchinese}{\gappto{\PJLlang@langconfig@tchinese}{#2}}{}% + \ifstrequal{#1}{TraditionalChinese}{\gappto{\PJLlang@langconfig@tchinese}{#2}}{}% + \ifstrequal{#1}{japanese}{\gappto{\PJLlang@langconfig@japanese}{#2}}{}% + \ifstrequal{#1}{Japanese}{\gappto{\PJLlang@langconfig@japanese}{#2}}{}% + \ifstrequal{#1}{english}{\gappto{\PJLlang@langconfig@english}{#2}}{}% + \ifstrequal{#1}{English}{\gappto{\PJLlang@langconfig@english}{#2}}{}% + \ifstrequal{#1}{french}{\gappto{\PJLlang@langconfig@french}{#2}}{}% + \ifstrequal{#1}{French}{\gappto{\PJLlang@langconfig@french}{#2}}{}% + \ifstrequal{#1}{ngerman}{\gappto{\PJLlang@langconfig@german}{#2}}{}% + \ifstrequal{#1}{german}{\gappto{\PJLlang@langconfig@german}{#2}}{}% + \ifstrequal{#1}{German}{\gappto{\PJLlang@langconfig@german}{#2}}{}% + \ifstrequal{#1}{russian}{\gappto{\PJLlang@langconfig@russian}{#2}}{}% + \ifstrequal{#1}{Russian}{\gappto{\PJLlang@langconfig@russian}{#2}}{}% + }% +} + +\RequirePackage{setspace} +\def\PJL@config@linespacing{\setstretch{1.00}} +\def\PJL@config@CJKlinespacing{\onehalfspacing} +\newcommand{\PJLsetlinespacing}[1]{\renewcommand{\PJL@config@linespacing}{#1}} +\newcommand{\PJLsetCJKlinespacing}[1]{\renewcommand{\PJL@config@CJKlinespacing}{#1}} +\newcommand{\UseLanguageCORE}[1]{% + \PJLlang@langconfig@common% + \ifstrequal{#1}{chinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{Chinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{schinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{SChinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{simplifiedchinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{SimplifiedChinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{tchinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{TChinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{traditionalchinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{TraditionalChinese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{japanese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@japanese}{}% + \ifstrequal{#1}{Japanese}{\PJL@config@CJKlinespacing\PJLlang@langconfig@japanese}{}% + \ifstrequal{#1}{english}{\PJL@config@linespacing\PJLlang@langconfig@english}{}% + \ifstrequal{#1}{English}{\PJL@config@linespacing\PJLlang@langconfig@english}{}% + \ifstrequal{#1}{french}{\PJL@config@linespacing\PJLlang@langconfig@french}{}% + \ifstrequal{#1}{French}{\PJL@config@linespacing\PJLlang@langconfig@french}{}% + \ifstrequal{#1}{ngerman}{\PJL@config@linespacing\PJLlang@langconfig@german}{}% + \ifstrequal{#1}{german}{\PJL@config@linespacing\PJLlang@langconfig@german}{}% + \ifstrequal{#1}{German}{\PJL@config@linespacing\PJLlang@langconfig@german}{}% + \ifstrequal{#1}{russian}{\PJL@config@linespacing\PJLlang@langconfig@russian}{}% + \ifstrequal{#1}{Russian}{\PJL@config@linespacing\PJLlang@langconfig@russian}{}% +} +\newcommand{\UseLanguage}[1]{% + \ifx\@onlypreamble\@notprerr% + \UseLanguageCORE{#1}% + \else% + \AfterEndPreamble{\UseLanguageCORE{#1}}% + \fi% +} +\newcommand{\UseOtherLanguage}[2]{% +\begingroup% + \PJLlang@langconfig@common% + \ifstrequal{#1}{chinese}{\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{Chinese}{\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{schinese}{\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{SChinese}{\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{simplifiedchinese}{\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{SimplifiedChinese}{\PJLlang@langconfig@chinese}{}% + \ifstrequal{#1}{tchinese}{\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{TChinese}{\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{traditionalchinese}{\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{TraditionalChinese}{\PJLlang@langconfig@tchinese}{}% + \ifstrequal{#1}{japanese}{\PJLlang@langconfig@japanese}{}% + \ifstrequal{#1}{Japanese}{\PJLlang@langconfig@japanese}{}% + \ifstrequal{#1}{english}{\PJLlang@langconfig@english}{}% + \ifstrequal{#1}{English}{\PJLlang@langconfig@english}{}% + \ifstrequal{#1}{french}{\PJLlang@langconfig@french}{}% + \ifstrequal{#1}{French}{\PJLlang@langconfig@french}{}% + \ifstrequal{#1}{ngerman}{\PJLlang@langconfig@german}{}% + \ifstrequal{#1}{german}{\PJLlang@langconfig@german}{}% + \ifstrequal{#1}{German}{\PJLlang@langconfig@german}{}% + \ifstrequal{#1}{russian}{\PJLlang@langconfig@russian}{}% + \ifstrequal{#1}{Russian}{\PJLlang@langconfig@russian}{}% + #2% +\endgroup% +} + +\UseLanguage{English} + +\endinput +%% +%% End of file `PJLlang.sty'. |