summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/templatetools
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-06-30 22:35:27 +0000
committerKarl Berry <karl@freefriends.org>2014-06-30 22:35:27 +0000
commite7e2042fdd29c3b51aead77e94b84713768c238a (patch)
treef2dcb2a59fb2238721b096949e302f55cf63db45 /Master/texmf-dist/tex/latex/templatetools
parent01df96665409d4a1c5997f16eca8d675fbecfd1d (diff)
templatetools (29jun14)
git-svn-id: svn://tug.org/texlive/trunk@34489 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/templatetools')
-rw-r--r--Master/texmf-dist/tex/latex/templatetools/templatetools.sty182
1 files changed, 182 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/templatetools/templatetools.sty b/Master/texmf-dist/tex/latex/templatetools/templatetools.sty
new file mode 100644
index 00000000000..fd20ab33367
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/templatetools/templatetools.sty
@@ -0,0 +1,182 @@
+%%
+%% This is file `templatetools.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% templatetools.dtx (with options: `templatetools.sty')
+%%
+%% IMPORTANT NOTICE:
+%%
+%% For the copyright see the source file.
+%%
+%% Any modified versions of this file must be renamed
+%% with new filenames distinct from templatetools.sty.
+%%
+%% For distribution of the original source see the terms
+%% for copying and modification in the file templatetools.dtx.
+%%
+%% This generated file may be distributed as long as the
+%% original source files, as listed above, are part of the
+%% same distribution. (The sources need not necessarily be
+%% in the same archive or directory.)
+
+\NeedsTeXFormat{LaTeX2e}[1994/12/01]
+\ProvidesPackage{templatetools}
+ [2014/06/27 v0.1 Collection of conditional commands useful inside templates]
+%%% --- Necessary Packages
+%%% ------------------------------------------------------------------
+\RequirePackage{ifpdf}
+\RequirePackage{etoolbox}
+\RequirePackage{ltxcmds}
+\RequirePackage{array} % for column types
+\RequirePackage{ifdraft} % check draft
+\RequirePackage{scrlfile}
+%%% --- Check if command is defined
+%%% ------------------------------------------------------------------
+\newcommand{\IfDefined}[2]{\ifcsdef{#1}{#2}{}}%
+\newcommand{\IfUndefined}[2]{\ifcsdef{#1}{}{#2}}%
+\newcommand{\IfElseDefined}[3]{\ifcsdef{#1}{#2}{#3}}%
+\newcommand{\IfElseUndefined}[3]{\ifcsdef{#1}{#3}{#2}}%
+\newcommand{\IfMultDefined}[1]{%
+ \@tempswatrue
+ \def\do##1{%
+%% define \@tempa with trimmed index element.
+ \edef\@tempa{\zap@space##1 \@empty}%
+%% check if package of current index is loaded
+ \ifcsdef{\@tempa}{}{\@tempswafalse}%
+ }%
+%% Process csv list with command \do (etoolbox)
+ \docsvlist{#1}%
+%% makes sure that the conditional works with one or two (if, else) parameters.
+ \if@tempswa\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
+}
+\newcommand{\IfDraft}[1]{\ifx\@draft\@undefined \else #1 \fi}
+
+\newcommand{\IfNotDraft}[1]{\ifx\@draft\@undefined #1 \fi}
+\newcommand{\IfNotDraftElse}[2]{\ifx\@draft\@undefined #1 \else #2 \fi}
+\newcommand{\IfPackageLoaded}[2]{\ltx@ifpackageloaded{#1}{#2}{}}
+\newcommand{\IfPackageNotLoaded}[2]{\ltx@ifpackageloaded{#1}{}{#2}}
+\let\IfElsePackageLoaded\ltx@ifpackageloaded
+\newcommand{\IfPackagesLoaded}[1]{%
+ \@tempswatrue
+ \def\do##1{%
+ \edef\@tempa{\zap@space##1 \@empty}%
+ \ltx@ifpackageloaded{\@tempa}{}{\@tempswafalse}%
+ }%
+ \docsvlist{#1}%
+ \if@tempswa\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
+}
+\newcommand{\IfPackagesNotLoaded}[1]{%
+ \@tempswatrue
+ \def\do##1{%
+ \edef\@tempa{\zap@space##1 \@empty}%
+ \ltx@ifpackageloaded{\@tempa}{\@tempswafalse}{}%
+ }%
+ \docsvlist{#1}%
+ \if@tempswa\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
+}
+\newcommand{\ExecuteAfterPackage}[2]{%
+%% #1: after this package
+%% #2: code to execute
+ \AfterAtEndOfPackage{#1}{
+ #2%
+ }
+ \AtEndPreamble{%
+ \IfPackageNotLoaded{#1}{%
+ #2%
+ }
+ }
+}
+\newcommand{\ExecuteBeforePackage}[2]{%
+%% #1: before this package
+%% #2: code to execute
+ \BeforePackage{#1}{
+ #2%
+ }
+ \AtEndPreamble{%
+ \IfPackageNotLoaded{#1}{%
+ #2%
+ }
+ }
+}
+\def\IfTikzLibraryLoaded#1{%
+ \ifcsname tikz@library@#1@loaded\endcsname
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\expandafter\let\csname columntype@l\endcsname\@empty
+\expandafter\let\csname columntype@c\endcsname\@empty
+\expandafter\let\csname columntype@r\endcsname\@empty
+\expandafter\let\csname columntype@p\endcsname\@empty
+\expandafter\let\csname columntype@m\endcsname\@empty
+\expandafter\let\csname columntype@b\endcsname\@empty
+\expandafter\let\csname columntype@@\endcsname\@empty
+\expandafter\let\csname columntype@!\endcsname\@empty
+\expandafter\let\csname columntype@|\endcsname\@empty
+\expandafter\let\csname columntype@<\endcsname\@empty
+\expandafter\let\csname columntype@>\endcsname\@empty
+\expandafter\let\csname columntype@=\endcsname\@empty
+\newcommand\CheckIfColumntypeDefined[1]{%
+%% create the bool variable for column type
+ \providebool{tpl@coltype@#1}
+%% check if new column type of this name was created
+ \ifcsdef{NC@find@\string#1}%
+ {\setbool{tpl@coltype@#1}{true}}%
+%% if not check if it is a predefined column type
+ {\ifcsdef{columntype@\string#1}
+ {\setbool{tpl@coltype@#1}{true}}%
+ {\setbool{tpl@coltype@#1}{false}}%
+ }%
+}
+\newcommand\isColumntypeDefined[1]{tpl@coltype@#1}
+\newcommand\IfColumntypeDefined[3]{%
+%% Execute check which create bool variable
+ \CheckIfColumntypeDefined{#1}
+%% use bool variable for if sequence
+ \ifboolexpr{ bool{\isColumntypeDefined{#1}} }{#2}{#3}%
+}
+\newcommand{\IfColumntypesDefined}[1]{%
+ \@tempswatrue
+ \def\do##1{%
+ \edef\@tempa{\zap@space##1 \@empty}%
+%% check if column is defined.
+%% Here with \expandafter because of the \string definition
+%% in \CheckIfColumntypeDefined.
+ \expandafter\IfColumntypeDefined
+ \expandafter{\@tempa}{}{\@tempswafalse}
+ }%
+ \docsvlist{#1}%
+ \if@tempswa\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
+}
+\newcommand{\IfColorDefined}[3]{%
+ \ifcsdef{\string\color @#1}
+ {#2} % color string is defined
+ {#3}} % color string is not defined
+\newcommand{\IfColorsDefined}[1]{%
+ \@tempswatrue
+ \def\do##1{%
+ \edef\@tempa{\zap@space##1 \@empty}%
+ \expandafter\IfColorDefined
+ \expandafter{\@tempa}{}{\@tempswafalse}
+ }%
+ \docsvlist{#1}%
+ \if@tempswa\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi%
+}
+\newcommand{\IfMathVersionDefined}[3]{\ifcsdef{mv@#1}{#2}{#3}}
+\newcommand{\IfGlossariesStyleDefined}[2]{\ifcsdef{@glsstyle@#1}{#2}{}}
+
+\newcommand\SetTemplateDefinition[3]{% 1: group, 2: property, 3: code
+ \csdef{tpl@definition@#1@#2}{#3}
+}
+\newcommand\UseDefinition[2]{%
+ \ifcsdef{tpl@definition@#1@#2}
+ {\csuse{tpl@definition@#1@#2}}
+ {\PackageWarning{templatetools}%
+ {Definition #1->#2 is unknown\MessageBreak}{}}%
+}%
+\endinput
+%%
+%% End of file `templatetools.sty'.