diff options
author | Karl Berry <karl@freefriends.org> | 2017-08-30 23:02:13 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-08-30 23:02:13 +0000 |
commit | da65270cdbb449c68e6e9f06dd8089b64275a2d3 (patch) | |
tree | b369d96387b99866dd74704ec42f6d762f88cb15 /Master/texmf-dist/tex | |
parent | 26fdf6e8d8d273185f664cfc3e4066b52a65797e (diff) |
multilang (30aug17)
git-svn-id: svn://tug.org/texlive/trunk@45179 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
3 files changed, 389 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/multilang/multilang-sect.sty b/Master/texmf-dist/tex/latex/multilang/multilang-sect.sty new file mode 100644 index 00000000000..a143ff08bd8 --- /dev/null +++ b/Master/texmf-dist/tex/latex/multilang/multilang-sect.sty @@ -0,0 +1,54 @@ +%% +%% This is file `multilang-sect.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% multilang.dtx (with options: `pkgsect') +%% +%% Copyright (C) 2016-2017 by Richard Gay <richard.gay@t-online.de> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{multilang-sect}[2017/08/30 v0.9 Multilingual sectioning environments] + + + + +\NewMultilangEnv{Section}{disablable, + environment=section, oargs=short, margs=title} +\NewMultilangEnv{Section*}{disablable, + environment=multilang@secstar, oargs=short, margs=title} +\newenvironment{multilang@secstar}{\section*}{} +\NewMultilangEnv{SubSection}{disablable, + environment=subsection, oargs=short, margs=title} +\NewMultilangEnv{SubSection*}{disablable, + environment=multilang@ssecstar, oargs=short, margs=title} +\newenvironment{multilang@ssecstar}{\subsection*}{} +\NewMultilangEnv{SubSubSection}{disablable, + environment=subsubsection, oargs=short, margs=title} +\NewMultilangEnv{SubSubSection*}{disablable, + environment=multilang@sssecstar, oargs=short, margs=title} +\newenvironment{multilang@sssecstar}{\subsubsection*}{} +\NewMultilangEnv{Paragraph}{disablable, + environment=paragraph, oargs=short, margs=title} +\NewMultilangEnv{Paragraph*}{disablable, + environment=multilang@parstar, oargs=short, margs=title} +\newenvironment{multilang@parstar}{\paragraph*}{} +\NewMultilangEnv{SubParagraph}{disablable, + environment=subparagraph, oargs=short, margs=title} +\NewMultilangEnv{SubParagraph*}{disablable, + environment=multilang@sparstar, oargs=short, margs=title} +\newenvironment{multilang@sparstar}{\subparagraph*}{} +\endinput +%% +%% End of file `multilang-sect.sty'. diff --git a/Master/texmf-dist/tex/latex/multilang/multilang-tags.sty b/Master/texmf-dist/tex/latex/multilang/multilang-tags.sty new file mode 100644 index 00000000000..66ab2a6133c --- /dev/null +++ b/Master/texmf-dist/tex/latex/multilang/multilang-tags.sty @@ -0,0 +1,84 @@ +%% +%% This is file `multilang-tags.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% multilang.dtx (with options: `pkgtags') +%% +%% Copyright (C) 2016-2017 by Richard Gay <richard.gay@t-online.de> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{multilang-tags}[2017/08/30 v0.9 Filtering of multilingual macros by tags] + + + + +\newcommand\SetTagFilter[2][accept]{% + \kcvml@parsepolicy{kcvml@@tagfilter}{#1}{#2}} +\newcommand\kcvml@@tagfilter{} +\newcommand\DefineTagFilter[3]{% + \kcvml@parsepolicy{kcvml@filter@@#1}{#2}{#3}} +\newcommand\UseTagFilter[1]{% + \letcs\kcvml@@tagfilter{kcvml@filter@@#1}} +\newcommand\kcvml@parsepolicy[3]{% + \bgroup + \def\kcvml@@tmptagfilter{}% + \pgfqkeys{kcvml/tagfilter}{#3,default/#2}% + \edef\do{\egroup + \unexpanded{\csdef{#1}}{\expandonce{\kcvml@@tmptagfilter}}}% + \do} +\pgfqkeys{kcvml/tagfilter}{% + accept/.code={\kcvml@appendrule{#1}{\boolfalse}{\booltrue}}, + deny/.code ={\kcvml@appendrule{#1}{\booltrue}{\boolfalse}}, + default/accept/.code n args={0}{\appto\kcvml@@tmptagfilter{% + \kcvml@applydefault{\boolfalse}}}, + default/deny/.code n args={0}{\appto\kcvml@@tmptagfilter{% + \kcvml@applydefault{\booltrue}}}, +} +\newcommand\kcvml@appendrule[3]{% + \bgroup + \def\kcvml@@ruletags{}% + \forcsvlist{\listadd{\kcvml@@ruletags}}{#1}% + \expandafter\egroup + \expandafter\listadd\expandafter\kcvml@@tmptagfilter\expandafter{% + \expandafter\kcvml@applyrule\expandafter{\kcvml@@ruletags}{#2}{#3}}} +\appto\multilang@hook@processargs{% + \ifbool{multilang@@disablable}% + {\eappto{\multilang@@keys}{% + \noexpand\pgfqkeys{\multilang@@cekey}{% + tags/.code={\noexpand\kcvml@applyfilter{##1}}}}} + {}} +\newcommand\kcvml@applyfilter[1]{% + \ifbool{multilang@cmd@@disabled}{}{% + \boolfalse{kcvml@@match}% + \def\do##1{% + ##1{#1}% + \ifbool{kcvml@@match}{\listbreak}{}}% + \dolistloop{\kcvml@@tagfilter}}} +\newbool{kcvml@@match} +\newcommand\kcvml@applyrule[4]{% + \forcsvlist{\kcvml@applyrule@i{#1}{#2}{#3}}{#4}} +\newcommand\kcvml@applyrule@i[4]{% + \if !\@car#4\@nil + \expandafter\kcvml@applyrule@ii\expandafter{\@cdr#4\@nil}{#1}{#3}% + \else + \kcvml@applyrule@ii{#4}{#1}{#2}\fi} +\newcommand\kcvml@applyrule@ii[3]{% + \ifinlist{#1}{\empty #2}% + {#3{multilang@cmd@@disabled}\booltrue{kcvml@@match}}{}} +\newcommand\kcvml@applydefault[2]{% + #1{multilang@cmd@@disabled}} +\endinput +%% +%% End of file `multilang-tags.sty'. diff --git a/Master/texmf-dist/tex/latex/multilang/multilang.sty b/Master/texmf-dist/tex/latex/multilang/multilang.sty new file mode 100644 index 00000000000..41be4b0f48e --- /dev/null +++ b/Master/texmf-dist/tex/latex/multilang/multilang.sty @@ -0,0 +1,251 @@ +%% +%% This is file `multilang.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% multilang.dtx (with options: `package') +%% +%% Copyright (C) 2016-2017 by Richard Gay <richard.gay@t-online.de> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{multilang} + [2017/08/30 v0.9 Tools for maintaining documents in multiple languages] + + + + +\RequirePackage{pgfkeys,pgfopts} +\RequirePackage{etoolbox} +\RequirePackage{environ} +\newcommand\multilang@@langs{} +\pgfqkeys{/multilang/pkg}{ + languages/.code={\forcsvlist{\listadd\multilang@@langs}{#1}}, +} +\ProcessPgfOptions{/multilang/pkg} +\newcommand\NewMultilangCmd[2]{% + \bgroup + \multilang@processargs{#1}{/multilang/newcommand}{defaults={},#2}% + \expandafter\def\expandafter\multilang@@intcmd\expandafter{% + \csname multilang@intcmd@\expandafter\@gobble\string#1\endcsname}% + \edef\do{\egroup + \expandonce{\multilang@@keys}% + \ifbool{multilang@@starred}{% + \unexpanded{\newcommand#1}{% + \noexpand\@ifstar + {\expandonce{\multilang@@intcmd}{*}}% + {\expandonce{\multilang@@intcmd}{}}}% + }{% + \unexpanded{\newcommand#1}{\expandonce{\multilang@@intcmd}{}}% + }% + \noexpand\newcommand{\expandonce{\multilang@@intcmd}}[2]{% + \bgroup + \noexpand\boolfalse{multilang@cmd@@disabled}% + \noexpand\pgfqkeys{\multilang@keyof{#1}}{% + \expandonce{\multilang@@defaults},####2}% + \noexpand\ifbool{multilang@cmd@@disabled}% + {\unexpanded{\def\multilang@@invok{}}}% + {\expandonce{\multilang@@checks}% + \unexpanded{\edef\multilang@@invok}{% + \noexpand\unexpanded{\expandonce{\multilang@@cmd}}####1% + \expandonce{\multilang@@actuals}}}% + \unexpanded{\expandafter\egroup\multilang@@invok}% + }% + }\do} +\newcommand\NewMultilangEnv[2]{% + \bgroup + \multilang@processargs{#1}{/multilang/newenvir}{defaults={},#2}% + \edef\do{\egroup + \expandonce{\multilang@@keys}% + \unexpanded{\newenvironment{#1}}[1]{% + \bgroup + \noexpand\boolfalse{multilang@cmd@@disabled}% + \noexpand\pgfqkeys{\multilang@keyof{#1}}{####1}% + \noexpand\ifbool{multilang@cmd@@disabled}% + {\unexpanded{% + \def\multilang@@invok{\Collect@Body{\multilang@noend}}}}% + {\expandonce{\multilang@@checks}% + \unexpanded{\edef\multilang@@invok}{% + \noexpand\noexpand\noexpand\begin{\multilang@@env}% + \expandonce{\multilang@@actuals}}}% + \unexpanded{\expandafter\egroup\multilang@@invok}% + }{% + \noexpand\end{\multilang@@env}% + }% + }\do} +\pgfqkeys{/multilang/cmd-or-env}{ + margs/.store in={\multilang@@margs}, + oargs/.store in={\multilang@@oargs}, + alias/.is family, + alias/.unknown/.code={% + \listeadd{\multilang@@aliases}{\pgfkeyscurrentname}% + \csdef{multilang@@alias@\pgfkeyscurrentname}{#1}}, + defaults/.store in={\multilang@@defaults}, + disablable/.is if={multilang@@disablable}, +} +\newbool{multilang@@disablable} +\newbool{multilang@cmd@@disabled} +\pgfqkeys{/multilang/newcommand}{ + .search also={/multilang/cmd-or-env}, + command/.store in={\multilang@@cmd}, + starred/.is if={multilang@@starred}, + alias/.search also={/multilang/cmd-or-env}, +} +\newbool{multilang@@starred} +\pgfqkeys{/multilang/newenvir}{ + .search also={/multilang/cmd-or-env}, + environment/.store in={\multilang@@env}, + alias/.search also={/multilang/cmd-or-env}, +} +\newcommand\NewMultilangType[3][1]{% + \listadd\multilang@@types{#2}% + \expandafter\newcommand\csname multilang@@typecmd@#2\endcsname[#1]{#3}% + \csdef{multilang@@typeargc@#2}{#1}% + \ifcase#1\relax + \csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}}% + \or\ifcsequal{multilang@@typecmd@#2}{@firstofone}% + {\csdef{multilang@@runcmd@#2}{####1}}% + {\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}{####3}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}{####3}{####4}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}{####3}{####4}{####5}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}{####3}{####4}{####5}{####6}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}{####3}{####4}{####5}{####6}{####7}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}{####3}{####4}{####5}{####6}{####7}{####8}}% + \or\csdef{multilang@@runcmd@#2}{\csuse{multilang@@typecmd@#2}% + {####1}{####2}{####3}{####4}{####5}{####6}{####7}{####8}{####9}}% + \else\multilang@error{Argument count expected to be between 0 and 9, % + but is '#1'}\fi} +\newcommand\multilang@@types{} +\newcommand\NewMultilangType@code[3][1]{% + \csdef{multilang@@codetype@#2}{true}% + \NewMultilangType[#1]{#2}{#3}} +\newcommand\multilang@regfield[2]{% + \pgfqkeys{\multilang@keyof{#1}}{% + #2/.code={\csdef{multilang@@val@#2}{##1}}}% + \forlistloop{\multilang@regfieldtype{#1}{#2}}{\multilang@@types}} +\newcommand\multilang@regfieldtype[3]{% + \bgroup + \ifnumequal{\csuse{multilang@@typeargc@#3}}{1}{% + \ifcsdef{multilang@@codetype@#3}{% + \edef\do{\egroup\noexpand\pgfqkeys{\multilang@keyof{#1}}{% + #2/#3/.code={\csexpandonce{multilang@@runcmd@#3}}% + }}% + }{% + \edef\do{\egroup\noexpand\pgfqkeys{\multilang@keyof{#1}}{% + #2/#3/.style={#2={\csexpandonce{multilang@@runcmd@#3}}}% + }}% + }% + }{% + \ifcsdef{multilang@@codetype@#3}{% + \edef\do{\egroup\noexpand\pgfqkeys{\multilang@keyof{#1}}{% + #2/#3/.code n args={\csuse{multilang@@typeargc@#3}}% + {\csexpandonce{multilang@@runcmd@#3}}}}% + }{% + \edef\do{\egroup\noexpand\pgfqkeys{\multilang@keyof{#1}}{% + #2/#3/.style n args={\csuse{multilang@@typeargc@#3}}% + {#2={\csexpandonce{multilang@@runcmd@#3}}}}}% + }% + }\do} +\newcommand\multilang@regcomb[3]{% + \multilang@regcombtype{#1}{#2}{#3}{}% + \forlistloop{\multilang@regcomb@i{#1}{#2}{#3}}{\multilang@@types}} +\newcommand\multilang@regcomb@i[4]{% + \multilang@regcombtype{#1}{#2}{#3}{/#4}} +\newcommand\multilang@regcombtype[4]{% + \bgroup + \toks@{}\@tempcnta=0\relax + \forcsvlist{% + \advance\@tempcnta by1\relax + \expandafter\multilang@regcomb@set\expandafter{\the\@tempcnta}{#4}% + }{#3}% + \ifnumgreater{\the\@tempcnta}{1}{% + \edef\do{\egroup\noexpand\pgfqkeys{\multilang@keyof{#1}}{% + #2#4/.style n args={\the\@tempcnta}{\the\toks@}}}% + }{% + \edef\do{\egroup\noexpand\pgfqkeys{\multilang@keyof{#1}}{% + #2#4/.style={\the\toks@}}}% + }% + \do} +\newcommand\multilang@regcomb@set[3]{% + \toks@\expandafter{\the\toks@,#3#2={###1}}} +\newcommand\multilang@addlanguage[1]{% + \ifdefstring{\languagename}{#1}% + {\NewMultilangType{#1}{##1}}% + {\NewMultilangType@code{#1}{}}% + \NewMultilangType{#1!}{\foreignlanguage{#1}{##1}}} +\forlistloop{\multilang@addlanguage}{\multilang@@langs} +\newcommand\multilang@keyof[1]{% + \ifcat\relax\noexpand#1% + /multilang/cmd/\expandafter\@gobble\string#1% + \else + /multilang/env/#1% + \fi} +\newcommand\multilang@error[1]{\PackageError{multilang}{#1}{}} +\newcommand\multilang@processargs[3]{% + \let\multilang@@aliases=\empty + \pgfqkeys{#2}{#3}% + \edef\multilang@@actuals{}% + \def\multilang@@checks{}% + \def\multilang@@keys{}% + \ifdefvoid{\multilang@@oargs}{}{% + \def\do##1{% + \appto{\multilang@@actuals}{% + \ifcsmacro{multilang@@val@##1}% + {[\csexpandonce{multilang@@val@##1}]}% + {}% + }% + \appto{\multilang@@keys}{\multilang@regfield{#1}{##1}}% + }% + \expandafter\docsvlist\expandafter{\multilang@@oargs}}% + \ifdefvoid{\multilang@@margs}{}{% + \def\do##1{% + \appto{\multilang@@actuals}{% + {\csexpandonce{multilang@@val@##1}}% + }% + \appto{\multilang@@checks}{% + \ifcsmacro{multilang@@val@##1}% + {}% + {\multilang@error{mandatory argument ##1 missing}}% + }% + \appto{\multilang@@keys}{\multilang@regfield{#1}{##1}}% + }% + \expandafter\docsvlist\expandafter{\multilang@@margs}}% + \def\do##1{% + \eappto{\multilang@@keys}{% + \unexpanded{\multilang@regcomb{#1}{##1}}% + {\csuse{multilang@@alias@##1}}}}% + \expandafter\dolistloop\expandafter{\multilang@@aliases}% + \ifbool{multilang@@disablable}% + {\eappto{\multilang@@keys}{% + \noexpand\pgfqkeys{\multilang@keyof{#1}}{% + disabled/.is if={multilang@cmd@@disabled}}}}% + {}% + \def\multilang@@cmdorenv{#1}% + \edef\multilang@@cekey{\multilang@keyof{#1}}% + \multilang@hook@processargs +} +\newcommand\multilang@hook@processargs{} +\newcommand\multilang@noend[1]{\cslet{end\@currenvir}{\relax}} +\endinput +%% +%% End of file `multilang.sty'. |