From 7339f8c2554ea56f79258fcee0aac72fd23f184d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 5 Oct 2013 21:31:22 +0000 Subject: cnltx (5oct13) git-svn-id: svn://tug.org/texlive/trunk@31843 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty | 713 +++++++ Master/texmf-dist/tex/latex/cnltx/cnltx-doc.cls | 903 +++++++++ .../texmf-dist/tex/latex/cnltx/cnltx-example.sty | 698 +++++++ .../texmf-dist/tex/latex/cnltx/cnltx-listings.sty | 1947 ++++++++++++++++++++ Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty | 220 +++ Master/texmf-dist/tex/latex/cnltx/cnltx.bbx | 130 ++ Master/texmf-dist/tex/latex/cnltx/cnltx.cbx | 26 + Master/texmf-dist/tex/latex/cnltx/cnltx.dbx | 37 + 8 files changed, 4674 insertions(+) create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx-doc.cls create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx.bbx create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx.cbx create mode 100644 Master/texmf-dist/tex/latex/cnltx/cnltx.dbx (limited to 'Master/texmf-dist/tex/latex/cnltx') diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty new file mode 100644 index 00000000000..1d648e44de7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty @@ -0,0 +1,713 @@ +% -------------------------------------------------------------------------- +% the CNLTX bundle +% +% LaTeX source code and output +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/cnltx/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\def\cnltx@@date{2013/10/04} +\def\cnltx@@version{v0.7a} +\def\cnltx@@info{LaTeX tools and documenting facilities (CN)} +\ProvidesPackage{cnltx-base}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info] +\RequirePackage{pgfopts,etoolbox,ltxcmds} + +% -------------------------------------------------------------------------- +% error messaging + +% messages with a common detailed error message: +% * : star: class, nostar: package +% #1: prefix +% #2: package/class name +% #3: message type +% #4: extended error message +\newcommand*\cnltx@create@generic@message{% + \@ifstar + {\cnltx@create@generic@message@aux{Class}} + {\cnltx@create@generic@message@aux{Package}}% +} + +% #1: Class|Package +% #2: prefix +% #3: package/class name +% #4: message type +% #5: extended error message +\newcommand\cnltx@create@generic@message@aux[5]{% + \ifstrequal{#4}{Error} + {% + \lowercase{\csdef{#2@#4}}##1{% + \csuse{#1#4}{#3}{##1}{#5}}% + }{% + \lowercase{\csdef{#2@#4}}##1{% + \csuse{#1#4}{#3}{##1}}% + }} + +% messages where the detailed error message must be specified as second +% argument: +% * : star: class, nostar: package +% #1: prefix +% #2: package/class name +% #3: message type +\newcommand*\cnltx@create@message{% + \@ifstar + {\cnltx@create@message@aux{Class}} + {\cnltx@create@message@aux{Package}}% +} + +% #1: Class|Package +% #2: prefix +% #3: package/class name +% #4: message type +\newcommand\cnltx@create@message@aux[4]{% + \ifstrequal{#4}{Error} + {% + \lowercase{\csdef{#2@#4}}##1##2{% + \csuse{#1#4}{#3}{##1}{##2}}% + }{% + \lowercase{\csdef{#2@#3}}##1{% + \csuse{#1#4}{#3}{##1}}% + }} + +% message handling for the cnltx bundle: +\newcommand*\cnltx@error@message{% + For details have a look at the `cnltx' manual.} + +% * : star: class, nostar: package +% #1: bundle module +% #2: message type +\newcommand*\cnltx@create@bundle@message{% + \@ifstar + {\cnltx@create@bundle@message@aux{Class}} + {\cnltx@create@bundle@message@aux{Package}}% +} + +\newcommand\cnltx@create@bundle@message@aux[3]{% + \cnltx@create@generic@message@aux + {#1} + {cnltx@#2} + {cnltx-#2} + {#3} + {\cnltx@error@message}% +} + +\cnltx@create@bundle@message{base}{Error} +\cnltx@create@bundle@message{base}{Warning} +\cnltx@create@bundle@message{base}{WarningNoLine} +\cnltx@create@bundle@message{base}{Info} + +% -------------------------------------------------------------------------- +% setup command +\newrobustcmd\setcnltx[1]{\pgfqkeys{/cnltx}{#1}} + +\def\cnltx@par{\par} + +% -------------------------------------------------------------------------- +% generic conditionals +% those two are in the spirit of etoolbox's \ifbool and \notbool and provide +% the same functionalty as the `test' directive in `\ifboolexpr': +\newcommand\iftest[1]{% + #1% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} + +\newcommand\nottest[1]{% + #1% + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi +} + +\newrobustcmd*\cnltx@ifsym[2]{\@ifnextchar#1{\@firstoftwo{#2}}} +\newcommand*\cnltx@ifdash{\cnltx@ifsym{-}} +\newcommand*\cnltx@ifbang{\cnltx@ifsym{!}} + +% an idea by Herbert Voß (http://tex.stackexchange.com/a/7183/5049): +\newcommand*\cnltx@ifisnum[1]{% + \iftest{\if!\ifnum9<1#1!\else_\fi}% +} + +% -------------------------------------------------------------------------- +% expansion helper +% \cnltx@expandargs() +% this is heavily inspired by expl3's \exp_args:N; in fact the code +% they use is very clever so it is basically just copied and renamed -- I'm +% sorry for that but I couldn't've done better. +\def\cnltx@expandargs@internal{} + +% auxiliary macros: +\long\def\cnltx@getnext@braced#1#2#3{#2\cnltx@firstofone{#3{#1}}} +\long\def\cnltx@getnext@unbraced#1#2#3{#2\cnltx@firstofone{#3#1}} +\long\def\cnltx@firstofone#1{#1} + +% the argument macros: +% n: +\long\def\cnltx@braced@unexpanded#1\cnltx@firstofone#2#3{% + #1\cnltx@firstofone{#2{#3}}% +} +% N: +\long\def\cnltx@unbraced@unexpanded#1\cnltx@firstofone#2#3{% + #1\cnltx@firstofone{#2#3}% +} +% c: +\long\def\cnltx@braced@csname#1\cnltx@firstofone#2#3{% + \expandafter\cnltx@getnext@unbraced\csname#3\endcsname{#1}{#2}% +} +% o: +\long\def\cnltx@braced@expanded@once#1\cnltx@firstofone#2#3{% + \expandafter\cnltx@getnext@braced\expandafter{#3}{#1}{#2}% +} +% f: +\long\def\cnltx@braced@expanded@fully#1\cnltx@firstofone#2#3{% + \expandafter\cnltx@getnext@braced + \expandafter{\romannumeral-`0#3}{#1}{#2}% +} +% x: +\protected\long\def\cnltx@braced@expanded@exhaustively#1\cnltx@firstofone#2#3{% + \edef\cnltx@expandargs@internal{{#3}}% + \expandafter\cnltx@getnext@braced\cnltx@expandargs@internal{#1}{#2}% +} + +% the actual expansion helper macro: +\protected\def\cnltx@expandargs(#1){% + \def\cnltx@expandargs@aux{#1\cnltx@firstofone}% + \cnltx@replace@all\cnltx@expandargs@aux{N}{\cnltx@unbraced@unexpanded}% + \cnltx@replace@all\cnltx@expandargs@aux{n}{\cnltx@braced@unexpanded}% + \cnltx@replace@all\cnltx@expandargs@aux{c}{\cnltx@braced@csname}% + \cnltx@replace@all\cnltx@expandargs@aux{o}{\cnltx@braced@expanded@once}% + \cnltx@replace@all\cnltx@expandargs@aux{f}{\cnltx@braced@expanded@fully}% + \cnltx@replace@all\cnltx@expandargs@aux{x}{\cnltx@braced@expanded@exhaustively}% + \cnltx@expandargs@aux +} + +% \exp_args:Nx +\newcommand\cnltx@fullexpand@arg{\cnltx@expandargs(x)} + +% \exp_args:Nxx +\newcommand\cnltx@fullexpand@twoargs{\cnltx@expandargs(xx)} + +% \exp_args:NV +\newcommand\cnltx@expand@arg{\cnltx@expandargs(o)} + +% expanding an environment argument or something: +\newcommand\cnltx@fullexpand@afterarg{\cnltx@expandargs(nx)} + +% -------------------------------------------------------------------------- +% tokenlist manipulation +\newcommand*\cnltx@stripbs{\expandafter\@gobble\string} + +% \cnltx@if@in{tokenlist}{search}{true}{false} +\newrobustcmd\cnltx@if@in[2]{% + \def\cnltx@ifin@tmp##1#2{}% + \expandafter\ifblank\expandafter{\cnltx@ifin@tmp#1{}{}#2} + {\@secondoftwo} + {\@firstoftwo}% +} + +% \cnltx@replace@once{macro}{search}{replace} +\newrobustcmd\cnltx@long@replace@once{\cnltx@replace@once@longorshort\long} +\newrobustcmd*\cnltx@replace@once{\cnltx@replace@once@longorshort\@empty} + +\newrobustcmd\cnltx@replace@once@longorshort[4]{% + \expandafter\cnltx@if@in\expandafter{#2}{#3} + {% + #1\def\cnltx@ro@tmp##1#3##2\q@stop{% + #1\def#2{##1#4##2}% + }% + \expandafter\cnltx@ro@tmp#2\q@stop + } + {}% +} + +% \cnltx@replace@all{macro}{search}{replace} +\newrobustcmd\cnltx@replace@all[3]{% + \cnltx@replace@once#1{#2}{#3}% + \expandafter\cnltx@if@in\expandafter{#1}{#2} + {\cnltx@replace@all#1{#2}{#3}} + {}% +} + +\newrobustcmd\cnltx@long@replace@all[3]{% + \cnltx@long@replace@once#1{#2}{#3}% + \expandafter\cnltx@if@in\expandafter{#1}{#2} + {\cnltx@long@replace@all#1{#2}{#3}} + {}% +} + +% \cnltx@remove@once{macro}{search} +\newrobustcmd\cnltx@remove@once[2]{\cnltx@replace@once#1{#2}{}} +\newrobustcmd\cnltx@long@remove@once[2]{\cnltx@long@replace@once#1{#2}{}} + +% \cnltx@remove@all{macro}{search} +\newrobustcmd\cnltx@remove@all[2]{\cnltx@replace@all#1{#2}{}} +\newrobustcmd\cnltx@long@remove@all[2]{\cnltx@long@replace@all#1{#2}{}} + +% -------------------------------------------------------------------------- +% an equivalent of \newcommand that where the macro with the optional argument +% is expandable. For this to work the newly defined macro /needs/ to eat the +% first following token! +\def\cnltx@num@to@args#1{% + \ifnum#1>1 + \cnltx@num@to@args@aux{2}{#1}{####}% + \fi +} +\def\cnltx@num@to@args@aux#1#2#3{% + \ifnum#1<\numexpr#2+1\relax + #3#1% + \expandafter\cnltx@num@to@args@aux + \expandafter{\number\numexpr#1+1}{#2}{#3}% + \fi +} + +% \newexpandablecmd*[][]{} +\newrobustcmd*\newexpandablecmd{% + \@star@or@long\cnltx@newexpcmd +} +\newrobustcmd*\renewexpandablecmd{% + \@star@or@long\cnltx@renewexpcmd +} +\newrobustcmd*\provideexpandablecmd{% + \@star@or@long\cnltx@provideexpcmd +} + +\def\cnltx@dummy{} + +\newrobustcmd*\cnltx@provideexpcmd[1]{% + \ifdef{#1} + {\cnltx@renewexpcmd\cnltx@dummy} + {\cnltx@newexpcmd#1}% +} + +\newrobustcmd*\cnltx@newexpcmd{% + \cnltx@new@expcmd +} + +\newrobustcmd*\cnltx@renewexpcmd[1]{% + \ifdef{#1} + {% + \let\@ifdefinable\@rc@ifdefinable + \cnltx@newexpcmd#1% + } + {\@latex@error{\noexpand#1undefined}\@ehc}% +} + +\def\cnltx@new@expcmd#1{% + \@ifnextchar[%] + {\cnltx@newexpcmd@i{#1}} + {\cnltx@newexpcmd@i{#1}[0]}% +} +\def\cnltx@newexpcmd@i#1[#2]{% + \@ifnextchar[%] + {\cnltx@newexpcmd@ii{#1}{#2}} + {\new@command#1[#2]}% +} + +\def\cnltx@newexpcmd@ii#1#2[#3]{% + \edef\cnltx@newexpcmd@args{\cnltx@num@to@args{#2}}% + \expandafter\cnltx@defexpcmd\expandafter{\cnltx@newexpcmd@args}{#2}[#3]#1% +} + +\long\def\cnltx@defexpcmd#1#2[#3]#4#5{% + \@ifdefinable#4{% + \long\def#4##1{% + \cnltxnewexpcmd@ifisopt + {#2} + {##1} + {\csuse{\@backslashchar\cnltx@stripbs#4}} + {#3}% + }% + }% + \l@ngrel@x\csdef{\@backslashchar\cnltx@stripbs#4}[##1]#1{#5}% +} +\newcommand\cnltxnewexpcmd@ifisopt[4]{% + \cnltxnewexpcmd@ifisopt@aux#2\q@marker[\q@marker + {#3#2} + {\iftest{\ifnum#1>1 }{#3[#4]{#2}}{#3[#4]#2}}% +} +\long\def\cnltxnewexpcmd@ifisopt@aux#1[#2\q@marker#3#{% + \ifstrempty{#1#2}% +} + +% -------------------------------------------------------------------------- +% looking for trailing punctuation: +% +% list parser with no separator: +\DeclareListParser*\cnltx@add@punctuation{} + +% the list that holds the punctuation marks: +\def\cnltx@punctuation@list{} + +% set the punctuation list (the parser does not like blank lists): +\newrobustcmd*\cnltx@set@punctuation[1]{% + \def\cnltx@punctuation@list{}% + \ifblank{#1} + {} + {\cnltx@add@punctuation{\listadd\cnltx@punctuation@list}{#1}}% +} + +% set default list: +\cnltx@set@punctuation{,.!?;:} + +\pgfkeys{ + cnltx/.cd , + set-trail-punct/.code = \cnltx@set@punctuation{#1} +} + +% -------------------------------------------------------------------------- +% small helper if we gobbled \par: +\newcommand*\cnltx@punctuation@ifpar{% + \iftest{\expandafter\ifx\cnltx@trailpunct\par}% +} +% \def\cnltx@punctuation@ifpar{% +% \expandafter\ifx\cnltx@trailpunct\par +% \expandafter\@firstoftwo +% \else +% \expandafter\@secondoftwo +% \fi +% } + +% -------------------------------------------------------------------------- +% per case list: +\newrobustcmd*\cnltx@set@punctuation@default{% + \ifx\cnltx@punctuation@list\cnltx@tmp@punctuation + \else + \let\cnltx@punctuation@list\cnltx@tmp@punctuation + \fi +} + +\newrobustcmd*\cnltx@set@punctuation@option[1]{% + \let\cnltx@tmp@punctuation\cnltx@punctuation@list + \ifblank{#1}{}{\cnltx@set@punctuation{#1}}% +} + +% -------------------------------------------------------------------------- +% check for punctuation mark and gobble it if present: +\newrobustcmd\cnltx@ifpunctuation@gobble[3][]{% + \cnltx@set@punctuation@option{#1}% + \ltx@ifnextchar{ } + {\cnltx@ifpunctuation@gobble@aux{#2}{#3}{ }} + {\cnltx@ifpunctuation@gobble@aux{#2}{#3}}% +} + +\newrobustcmd\cnltx@ifpunctuation@gobble@aux[3]{% + \edef\cnltx@trailpunct{\unexpanded{#3}}% + \ifblank{#3}{#2}{% + \ifinlist{#3}{\cnltx@punctuation@list} + {#1} + {#2\cnltx@punctuation@ifpar{}{#3}}% + \cnltx@punctuation@ifpar{\par}{}% + }% + \cnltx@set@punctuation@default +} + +% -------------------------------------------------------------------------- +% check for punctuation mark but leave it where it is: +\newrobustcmd\cnltx@ifpunctuation@nogobble[3][]{% + \cnltx@set@punctuation@option{#1}% + \ltx@ifnextchar{ } + {\cnltx@ifpunctuation@nogobble@aux{#2}{#3}{}} + {\cnltx@ifpunctuation@nogobble@aux{#2}{#3}}% +} + +\newrobustcmd\cnltx@ifpunctuation@nogobble@aux[3]{% + \ifblank{#3}{#2}{% + \ifinlist{#3}{\cnltx@punctuation@list} + {#1} + {#2}% + }% + \cnltx@set@punctuation@default + #3% +} + +% -------------------------------------------------------------------------- +% the main command: +\newrobustcmd\cnltx@ifpunctuation{% + \@ifstar + \cnltx@ifpunctuation@nogobble + \cnltx@ifpunctuation@gobble +} + +% -------------------------------------------------------------------------- +% counter representation commands +% error messages +\newcommand*\cnltx@base@error@unknown@user@representation[1]{% + \cnltx@base@error{Unknown counter representation \string#1}} + +\newcommand*\cnltx@base@error@unknown@internal@representation[1]{% + \cnltx@base@error{Unknown internal counter representation #1}} + +\newcommand*\cnltx@base@error@already@user@representation[1]{% + \cnltx@base@error{Counter representation \string#1 already exists}} + +\newcommand*\cnltx@base@error@already@internal@representation[1]{% + \cnltx@base@error{Internal counter representation \expandonce{#1} already exists}} + +% -------------------------------------------------------------------------- +% conditionals +% test for user commands like \arabic +\newcommand*\cnltx@if@user@representation{\ifdef} + +% test for internal commands like \@arabic; we will assume they're /always/ +% the same as the corresponding user command but with a leading @: +\newcommand*\cnltx@if@internal@representation[1]{% + \ifcsdef{@\cnltx@stripbs#1}% +} + +% -------------------------------------------------------------------------- +% the main command +\newrobustcmd*\cnltx@new@counter@representation[2]{% + \edef#1##1{% + \noexpand\expandafter + \expandonce{\csname @\cnltx@stripbs#1\endcsname}% + \noexpand\csname c@##1\noexpand\endcsname + }% + \csdef{@\cnltx@stripbs#1}##1{#2}% +} + +% -------------------------------------------------------------------------- +% the user commands +\newrobustcmd*\newcounterrepresentation[2]{% + \cnltx@if@user@representation{#1} + {\cnltx@base@error@already@user@representation{#1}} + {}% + \cnltx@if@internal@representation{#1} + {% + \cnltx@base@error@already@internal@representation + {\csname @\cnltx@stripbs#1\endcsname}% + } + {}% + \cnltx@new@counter@representation{#1}{#2}% +} + +\newrobustcmd*\renewcounterrepresentation[2]{% + \cnltx@if@user@representation{#1} + {} + {\cnltx@base@error@unknown@user@representation{#1}}% + \cnltx@if@internal@representation{#1} + {} + {% + \cnltx@base@error@unknown@internal@representation + {\csname @\cnltx@stripbs#1\endcsname}% + }% + \cnltx@new@counter@representation{#1}{#2}% +} + +\newrobustcmd*\providecounterrepresentation[2]{% + \cnltx@if@user@representation{#1}{}{% + \cnltx@if@internal@representation{#1}{}{% + \cnltx@new@counter@representation{#1}{#2}% + }% + }% +} + +\newrobustcmd*\DeclareCounterRepresentation[2]{% + \cnltx@new@counter@representation{#1}{#2}% +} + +% -------------------------------------------------------------------------- +% the following definitions are redundant, the LaTeX2e kernel provides them +% already. They're provided as an overview: + +% \arabic: +\providecounterrepresentation\arabic{\number#1} +% \roman: +\providecounterrepresentation\roman{\romannumeral#1} +% \Roman: +\providecounterrepresentation\Roman{% + \expandafter\@slowromancap\romannumeral#1@} +%\alph: +\providecounterrepresentation\alph{% + \ifcase#1% + \or a\or b\or c\or d\or e\or f% + \or g\or h\or i\or j\or k\or l% + \or m\or n\or o\or p\or q\or r% + \or s\or t\or u\or v\or w\or x% + \or y\or z% + \else + \@ctrerr + \fi +} +% \Alph: +\providecounterrepresentation\Alph{% + \ifcase#1% + \or A\or B\or C\or D\or E\or F% + \or G\or H\or I\or J\or K\or L% + \or M\or N\or O\or P\or Q\or R% + \or S\or T\or U\or V\or W\or X% + \or Y\or Z% + \else + \@ctrerr + \fi +} +% \fnsymbol: +% this is the definition of \fnsymbol in `latex.ltx'; a redefinition like in +% `fixltx2e.sty' would be preferable but \TextOrMath is not defined per +% default and we don't want to require `fixltx2e.sty' +\providecounterrepresentation\fnsymbol{% + \ensuremath{% + \ifcase#1% + \or *% + \or \dagger + \or \ddagger + \or \mathsection + \or \mathparagraph + \or \|% + \or **% + \or \dagger\dagger + \or \ddagger\ddagger + \else + \@ctrerr + \fi + }% +} + +% -------------------------------------------------------------------------- +% colors definitions: +\RequirePackage{xcolor} +\RequirePackage{trimspaces} + +\xdefinecolor{cnltxbrown}{rgb}{0.60,0.25,0.15} +\xdefinecolor{cnltxblue}{rgb}{0.02,0.04,0.48} +\xdefinecolor{cnltxred}{rgb}{0.65,0.04,0.07} +\xdefinecolor{cnltxgreen}{rgb}{0.06,0.44,0.08} +\xdefinecolor{cnltxgray}{gray}{0.5} +\colorlet{cnltxyellow}{yellow!40!brown} +\xdefinecolor{cnltxformalblue}{rgb}{0,0.2,0.6} +\xdefinecolor{cnltxformalred}{rgb}{0.8,0.1,0.2} + +% set a color-scheme for the manual: +\newrobustcmd\definecolorscheme{% + \cnltx@define@colorscheme +} +\newrobustcmd*\cnltx@define@colorscheme[2]{% + \csgdef{cnltx@color@scheme@#1}{}% + \forcsvlist{\cnltx@get@color{#1}}{#2}% +} +\newcommand*\cnltx@get@color[2]{\cnltx@get@color@aux{#1}#2\q@stop} +\def\cnltx@get@color@aux#1#2=>#3\q@stop{% + \listcsgadd{cnltx@color@scheme@#1}{% + \colorlet{\trim@spaces{#2}}{\trim@spaces{#3}}% + }% +} + +\newcommand*\cnltx@use@colorscheme[1]{% + \forlistcsloop{\@firstofone}{cnltx@color@scheme@#1}% +} + +\pgfkeys{ + cnltx/.cd, + color-scheme/.code = \cnltx@use@colorscheme{#1} +} + +% predefined color-schemes: +\definecolorscheme{default}{ + cs => cnltxbrown , + option => cnltxyellow , + module => cnltxblue , + comment => cnltxgray , + beginend => red , + env => black , + argument => black , + meta => black!80 , + cnltx => cnltxred , + cnltxbg => white , + link => black!90 , + versionnote => black!75 , + bibentry => cnltxgreen , + bibentryfield => black , + expandable => red , + unexpandable => black , + makeidxkey => cnltxgreen , + makeidxstring => black +} + +\definecolorscheme{blue}{ + cs => cnltxbrown , + option => cnltxgreen , + module => cnltxred , + comment => cnltxgray , + beginend => red , + env => black , + argument => black , + meta => black!80 , + cnltx => cnltxblue , + cnltxbg => yellow!10 , + link => cnltx , + versionnote => black!75 , + bibentry => cnltxyellow , + bibentryfield => black , + expandable => red , + unexpandable => black , + makeidxkey => cnltxyellow , + makeidxstring => black +} + +\definecolorscheme{formal}{ + cs => black , + option => cnltxformalblue , + module => cnltxblue , + comment => cnltxgray , + beginend => red , + env => black , + argument => black , + meta => black!80 , + cnltx => cnltxformalblue , + cnltxbg => white , + link => black!90 , + versionnote => black!75 , + bibentry => black , + bibentryfield => black , + expandable => red , + unexpandable => black , + makeidxkey => black , + makeidxstring => black +} + +% set the default: +\setcnltx{color-scheme=default} + +\endinput + +% -------------------------------------------------------------------------- +HISTORY: + +2013/09/08 v0.1 - first working version +2013/09/10 v0.2 - added `cnltx-tools' to the bundle + - extended the messaging creation to class messages +2013/09/12 v0.3 - added index style file `cnltx.ist' + - added color `module' + - added \cnltx@remove@once and \cnltx@remove@all + - added long versions of tokenlist manipulation macros +2013/09/14 v0.4 - added \cnltx@fullexpand@afterarg + - new colors `bibentry' and `bibentryfield' +2013/09/20 v0.5 - added colors `expandable' and `unexpandable' + - added \definecolorscheme +2013/09/24 v0.6 - added \cnltx@ifisnum +2013/09/30 v0.7 - added functionality to look for trailing punctuation + - added colors `makeidxkey' and `makeidxstring' + - added counter representation command facilities + - generalized expansion helpers (by copying expl3's + \exp_arg:N idea) + - \iftest and \nottest diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-doc.cls b/Master/texmf-dist/tex/latex/cnltx/cnltx-doc.cls new file mode 100644 index 00000000000..82a826a11da --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-doc.cls @@ -0,0 +1,903 @@ +% -------------------------------------------------------------------------- +% the CNLTX bundle +% +% LaTeX source code and output +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/cnltx/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\RequirePackage{cnltx-base} +\ProvidesClass{cnltx-doc}[\cnltx@@date\space \cnltx@@version\space + \cnltx@@info] + +\cnltx@create@bundle@message*{doc}{Error} +\cnltx@create@bundle@message*{doc}{Warning} +\cnltx@create@bundle@message*{doc}{WarningNoLine} +\cnltx@create@bundle@message*{doc}{Info} + +\newbool{cnltx@load@preamble} +\newbool{cnltx@add@index} +\newbool{cnltx@add@bib} + +\newcommand*\cnltx@scrartcl@options{} +\newcommand*\cnltx@babel@options{english} + + +\pgfkeys{ + cnltx-doc/.cd, + scrartcl/.code = \PassOptionsToClass{#1}{scrartcl} , + load-preamble/.is if = cnltx@load@preamble , + add-index/.is if = cnltx@add@index , + add-bib/.is if = cnltx@add@bib , + load-preamble+/.code = + \booltrue{cnltx@load@preamble} + \booltrue{cnltx@add@index} + \booltrue{cnltx@add@bib} , + babel-options/.code = \def\cnltx@babel@options{#1} +} + +\ProcessPgfOptions{/cnltx-doc} + +\let\@classoptionslist\relax +\LoadClass{scrartcl} + + +\newcommand*\cnltx@index@prologue{} +\newbool{cnltx@index@prologue} +\newlength\cnltx@index@space + +\newcommand*\cnltx@index@setup{othercode=\footnotesize,level=\addsec} +\newcommand*\cnltx@makeindex@setup{columns=2,columnsep=1em} +\newcommand*\cnltx@index@style{cnltx.ist} + +\pgfkeys{ + cnltx/.cd, + index-prologue/.code = + \def\cnltx@index@prologue{#1} + \booltrue{cnltx@index@prologue} , + index-space/.code = \setlength\cnltx@index@space{#1} , + index-setup/.code = \def\cnltx@index@setup{#1} , + makeindex-setup/.code = \def\cnltx@makeindex@setup{#1} , + index-style/.code = \def\cnltx@index@style{#1} +} + + +\RequirePackage{cnltx-tools,cnltx-example,cnltx-listings,translations} + +\newcommand*\cnltx@caption@font{\normalfont\small\sffamily} +\newcommand*\cnltx@captionlabel@font{\cnltx@caption@font\scshape} + +\pgfkeys{ + cnltx/.cd, + caption-font/.code = \def\cnltx@caption@font{#1} , + caption-label-font/.code = \def\cnltx@captionlabel@font{#1} +} + +\ifbool{cnltx@load@preamble}{ + \RequirePackage{ifxetex,ifluatex} + \ifboolexpr{not bool{xetex} and not bool{luatex}} + {\RequirePackage[T1]{fontenc}} + {\RequirePackage{fontspec}} + \RequirePackage[oldstyle]{libertine} + \RequirePackage{libertinehologopatch} + \RequirePackage[supstfm=libertinesups]{superiors} + % libertine does not have superior letters: + \def\@makefnmark{% + \hbox{% + \cnltx@ifisnum{\@thefnmark} + {\textsu{\hspace*{\superiors@spaced}\@thefnmark}} + {\@textsuperscript{\normalfont\@thefnmark}}% + }% + } + \RequirePackage{microtype} + \ifboolexpr + { + test {\ifcsdef{MT@pr@set@@romansans}} and + test {\ifcsdef{MT@ex@set@@romansans}} + } + {} + { + \DeclareMicrotypeSet{romansans}{ + encoding = {*}, + family = {rm*,sf*} + } + } + \ifcsdef{MT@tr@set@@scshape} + {} + { + \DeclareMicrotypeSet[tracking]{scshape}{ + encoding = {*} , + shape = {sc,scit,si} + } + } + \microtypesetup{ + tracking = scshape , + protrusion = romansans , + expansion = romansans + } + \ifboolexpr{not bool{xetex} and not bool{luatex}} + {\RequirePackage[scaled=.81]{beramono}} + {\setmonofont[Scale=MatchLowercase]{Bitstream Vera Sans Mono}} + \RequirePackage{fnpct} + \expandafter\RequirePackage\expandafter[\cnltx@babel@options]{babel} + \renewcommand*\othersectionlevelsformat[3]{% + \textcolor{cnltx}{#3\autodot}\enskip} + \renewcommand*\partformat{% + \textcolor{cnltx}{\partname~\thepart\autodot}} + \deffootnote{2em}{1em}{\llap{\thefootnotemark. }}% + \pagestyle{headings} + \setcapindent{1.5em} + \setkomafont{caption}{\cnltx@caption@font} + \setkomafont{captionlabel}{\cnltx@captionlabel@font} +}{} + +\ifbool{cnltx@add@index}{ + \RequirePackage[ + backend=biber, + style=cnltx, + sortlocale=en_EN, + indexing=cite, + useprefix]{biblatex} + \addbibresource{cnltx.bib} + \AtEndDocument{\printbibliography} +}{} + +\ifbool{cnltx@add@index}{ + \AtEndPreamble{% + \RequirePackage{imakeidx} + \expandafter\indexsetup\expandafter{\cnltx@index@setup} + \expandafter\makeindex\expandafter + [\cnltx@makeindex@setup,options={-s \cnltx@index@style}] + \AtEndDocument{% + \ifbool{cnltx@index@prologue}{% + \indexprologue + [\vspace{\cnltx@index@space}] + {\noindent\cnltx@index@prologue} + }{}% + \printindex + }% + } +}{} + +\AtBeginDocument{% + \immediate\write\@auxout{% + \unexpanded{% + \ifx\texorpdfstring\@undefined^^J + \providecommand\texorpdfstring[2]{#1}^^J + \providecommand\pdfstringdefDisableCommands[1]{}^^J + \providecommand\nohyperpage[1]{#1}^^J + \fi + }% + }% +} + +% -------------------------------------------------------------------------- +% license information: +% define those differently: +\newcommand*\lppl{\cnltx@acronym{LPPL}{lppl}} +\newcommand*\LPPL{% + \LaTeX{} Project Public License% + \index{LPPL@{\cnltx@acronym@format lppl}}% +} + +\newrobustcmd*\license{\@ifstar{\cnltx@license}{\cnltx@license\cnltx@par}} +\newcommand\cnltx@license[1][maintained]{% + \GetTranslation{cnltx-license} ``#1.''% +} + +% CTAN: +\newcommand*\ctan{\cnltx@acronym{CTAN}{ctan}} +\newcommand*\CTAN{% + Comprehensive \TeX\ Archive Network% + \index{CTAN@{\cnltx@acronym@format ctan}}% +} + +% -------------------------------------------------------------------------- +% package information: +\newrobustcmd*\cnltx@getfileinfo[2]{% + \def\cnltx@tmpa##1 ##2 ##3\relax##4\relax{% + \gdef\cnltx@package@date{##1}% + \gdef\cnltx@package@version{##2}% + \gdef\cnltx@package@info{##3}}% + \edef\cnltx@tmpb{\csname ver@#1.#2\endcsname}% + \expandafter\cnltx@tmpa\cnltx@tmpb\relax? ? \relax\relax} + +\newcommand*\cnltx@package@name{??} +\newbool{cnltx@package@name} +\newcommand*\cnltx@package@date{??} +\newcommand*\cnltx@package@version{??} +\newcommand*\cnltx@package@info{??} +\newcommand*\cnltx@package@title{??} +\newcommand*\cnltx@title@format{\bfseries\scshape} +\newbool{cnltx@package@title} +\newcommand*\cnltx@package@subtitle{??} +\newbool{cnltx@package@subtitle} +\newcommand*\cnltx@package@url{??} +\newbool{cnltx@package@url} +\newcommand*\cnltx@package@email{??} +\newbool{cnltx@package@email} +\newcommand*\cnltx@package@abstract{??} +\newbool{cnltx@package@abstract} +\newlength\cnltx@package@abstract@width +\setlength\cnltx@package@abstract@width{.75\linewidth} +\newcommand*\cnltx@package@abstract@format{\setlength\parskip{.333\baselineskip}} + +\newrobustcmd*\cnltxpackagenameformat[1]{\textcolor{cnltx}{\textsc{#1}}} + +\newrobustcmd*\cnltx@newpackagename[2]{% + \newcommand*#1{\texorpdfstring{\cnltxpackagenameformat{#2}}{#2}}% +} +\newrobustcmd*\newpackagename{\cnltx@newpackagename} + +% -------------------------------------------------------------------------- +% authors: +\newcommand*\cnltx@package@author@list{} +\newcommand*\cnltx@package@author@pdflist{} +\newrobustcmd*\cnltx@new@author[1]{% + \listadd\cnltx@package@author@list + {\cnltx@read@name{#1}}% + \listadd\cnltx@package@author@pdflist + {\cnltx@extract@name{#1}}% +} + +% writing the names and email addresses: +\newcommand*\cnltx@read@name[1]{% + \cnltx@read@name@aux#1[]\q@stop +} +\protected\def\cnltx@read@name@aux#1[#2]\q@stop{% + \cnltx@get@first@and@second@name#1 \q@stop + \ifblank{#2}{} + {\cnltx@write@author@email#2\q@stop}% +} +\def\cnltx@write@author@email#1][\q@stop{% + \ifblank{#1}{} + {\footnote{\href{mailto:#1}{#1}}}% +} +\protected\def\cnltx@get@first@and@second@name#1 #2\q@stop{% + \ifblank{#2} + {% + \cnltx@name[]{#1}% + \listgadd\cnltx@package@author@pdflist{#1}% + } + {% + \cnltx@name[#1]{\trim@spaces{#2}}% + \listgadd\cnltx@package@author@pdflist{#1 \trim@spaces{#2}}% + }% +} + +% getting the names for the pdf properties: +\newcommand*\cnltx@extract@name[1]{% + \cnltx@extract@name@aux#1[]\q@stop +} +\def\cnltx@extract@name@aux#1[#2]\q@stop{% + #1\ifblank{#2}{}{\cnltx@extract@name@aux@i#2\q@stop}, % +} +\def\cnltx@extract@name@aux@i#1][\q@stop{} + +\newrobustcmd*\cnltx@package@authors{% + \gdef\cnltx@author@sep{\gdef\cnltx@author@sep{\qquad}}% + \forlistloop{\cnltx@author@sep}\cnltx@package@author@list +} + + +% -------------------------------------------------------------------------- +% options: +\pgfkeys{ + cnltx/.cd, + package/.code = + \ifcsdef{#1}{}{\expandafter\newpackagename\csname#1\endcsname{#1}} + \gdef\cnltx@package@name{#1} + \@ifpackageloaded{#1} + {\cnltx@getfileinfo{#1}{sty}} + {\cnltx@doc@warning{Package `#1' is not loaded, yet!}} + \booltrue{cnltx@package@name} , + class/.code = + \ifcsdef{#1}{}{\expandafter\newpackagename\csname#1\endcsname{#1}} + \gdef\cnltx@package@name{#1} + \@ifclassloaded{#1} + {\cnltx@getfileinfo{#1}{cls}} + {\cnltx@doc@warning{Class `#1' is not loaded, yet!}} + \booltrue{cnltx@package@name} , + name/.code = + \ifcsdef{#1}{}{\expandafter\newpackagename\csname#1\endcsname{#1}} + \gdef\cnltx@package@name{#1} + \booltrue{cnltx@package@name} , + title/.code = + \gdef\cnltx@package@title{#1} + \booltrue{cnltx@package@title} , + title-format/.code = + \def\cnltx@title@format{#1} , + build-title/.is if = cnltx@package@title , + subtitle/.code = + \gdef\cnltx@package@subtitle{#1} + \booltrue{cnltx@package@subtitle} , + authors/.code = + \gdef\cnltx@package@author@list{} + \forcsvlist{\cnltx@new@author}{#1} , + date/.code = \gdef\cnltx@package@date{#1} , + version/.code = \gdef\cnltx@package@version{#1} , + info/.code = \gdef\cnltx@package@info{#1} , + url/.code = + \gdef\cnltx@package@url{#1} + \booltrue{cnltx@package@url} , + email/.code = + \gdef\cnltx@package@email{#1} + \booltrue{cnltx@package@email} , + abstract/.code = + \gdef\cnltx@package@abstract{% + \parbox{\cnltx@package@abstract@width}{% + \cnltx@package@abstract@format + #1% + }% + } + \booltrue{cnltx@package@abstract} , + abstract-width/.code = + \setlength\cnltx@package@abstract@width{#1} , + abstract-format/.code = + \def\cnltx@package@abstract@format{#1} +} +% -------------------------------------------------------------------------- +% command descriptions: +\newcommand*\cnltx@command{% + \@ifstar + {\cnltx@command@star} + {\cnltx@command@nostar}% +} + +\newrobustcmd*\cnltx@command@star[1]{% + \@ifnextchar[ + {\cnltx@command@star@opt{#1}} + {\cnltx@command@star@opt{#1}[]}% +} + +\newrobustcmd*\cnltx@command@nostar[1]{% + \@ifnextchar[ + {\cnltx@command@nostar@opt{#1}} + {\cnltx@command@nostar@opt{#1}[]}% +} + +\def\cnltx@command@star@opt#1[#2]{% + \ifblank{#2} + {\item\cs*{#1}} + {\item\cs*{#1}#2}% + \cnltx@checkdefault{\hfill\newline}% +} +\def\cnltx@command@nostar@opt#1[#2]{% + \ifblank{#2} + {\item\cs{#1}} + {\item\cs{#1}#2}% + \cnltx@checkdefault{\hfill\newline}% +} + +\newcommand\cnltx@checkdefault[1]{% + \@ifnextchar\Module + {} + {% + \@ifnextchar\Default + {} + {% + \@ifnextchar\default + {} + {#1}% + }% + }% +} + +\newcommand*\cmltx@list@setup{% + \leftmargin=0pt + \labelwidth=2em + \labelsep=0pt + \itemindent=-1em +} + +\pgfkeys{ + cnltx/.cd, + list-setup/.code = \def\cmltx@list@setup{#1} +} + +\newenvironment{cnltxlist} + {\list{}{\cmltx@list@setup}} + {\endlist} + +\newenvironment{commands} + {% + \let\command\cnltx@command + \cnltxlist + } + {\endcnltxlist} + +% -------------------------------------------------------------------------- +% option descriptions: +\newcommand*\@cnltx@option@item[1]{% + \@ifstar + {\@cnltx@option@item@aux@star{#1}} + {\@cnltx@option@item@aux@nostar{#1}}% +} + +\newcommand*\@cnltx@option@item@aux@star[1]{% + \cnltx@ifdash + {\@cnltx@option@item@aux{#1}*-} + {\@cnltx@option@item@aux{#1}*{}}% +} +\newcommand*\@cnltx@option@item@aux@nostar[1]{% + \cnltx@ifdash + {\@cnltx@option@item@aux{#1}{}-} + {\@cnltx@option@item@aux{#1}{}{}}% +} + +\newrobustcmd*\@cnltx@option@item@aux[4]{% + \@ifnextchar\bgroup + {\@cnltx@option@two{#1#2#3}{#4}} + {\@cnltx@option@one{#1#2#3}{#4}}% +} + +\newcommand*\@cnltx@option@one[2]{% + \item#1{#2}% + \cnltx@checkdefault{\hfill\newline}% +} + +\newcommand*\@cnltx@option@two[3]{% + \item#1{#2}{#3}% + \cnltx@checkdefault{\hfill\newline}% +} + +\newenvironment{options} + {% + \def\opt{\@cnltx@option@item\option}% + \def\keyval{\@cnltx@option@item\key}% + \def\keylit{\@cnltx@option@item\keyis}% + \def\keychoice{\@cnltx@option@item\choicekey}% + \def\keybool{\@cnltx@option@item\boolkey}% + \cnltxlist + } + {\endcnltxlist} + +% -------------------------------------------------------------------------- +% environment descriptions: +\newcommand*\cnltx@environment{% + \@ifstar + {\cnltx@environment@star} + {\cnltx@environment@nostar}% +} + +\newcommand*\cnltx@environment@star[1]{% + \@ifnextchar[ + {\cnltx@environment@star@opt{#1}} + {\cnltx@environment@star@opt{#1}[]}% +} + +\newcommand*\cnltx@environment@nostar[1]{% + \@ifnextchar[ + {\cnltx@environment@nostar@opt{#1}} + {\cnltx@environment@nostar@opt{#1}[]}% +} + +\def\cnltx@environment@star@opt#1[#2]{% + \ifblank{#2} + {\item\beginenv*\code{\{}\env*{#1}\code{\}}} + {\item\beginenv*\code{\{}\env*{#1}\code{\}}#2}% + \cnltx@checkdefault{\hfill\newline}% +} +\def\cnltx@environment@nostar@opt#1[#2]{% + \ifblank{#2} + {\item\beginenv*\code{\{}\env{#1}\code{\}}} + {\item\beginenv*\code{\{}\env{#1}\code{\}}#2}% + \cnltx@checkdefault{\hfill\newline}% +} + +\newenvironment{environments} + {% + \let\environment\cnltx@environment + \cnltxlist + } + {\endcnltxlist} + +% -------------------------------------------------------------------------- +% default values: +\newrobustcmd*\cnltx@Default[1]{% + \null\hfill + \@ifnextchar\bgroup + {\cnltx@Default@initial{#1}} + {% + \cnltx@ifbang + {\cnltx@Default@required{#1}} + {\cnltx@Default@empty{#1}}% + }% +} + +\newcommand*\cnltx@Default@initial[2]{% + \llap{\GetTranslation{cnltx-default}: \code{#2}}% + \ifblank{#1}{\newline}{}% +} + +\newcommand*\cnltx@Default@required[1]{% + \llap{(\GetTranslation{cnltx-required})}% + \ifblank{#1}{\newline}{}% +} + +\newcommand*\cnltx@Default@empty[1]{% + \llap{(\GetTranslation{cnltx-empty})}% + \ifblank{#1}{\newline}{}% +} + +\newrobustcmd*\Default{% + \@ifstar + {\cnltx@Default{*}} + {\cnltx@Default{}}% +} + +\newrobustcmd*\expandable{\cnltx@expandable@ornot\cnltx@expandable} +\newrobustcmd*\unexpandable{\cnltx@expandable@ornot\cnltx@unexpandable} + +\newrobustcmd*\cnltx@expandable@ornot[1]{% + \let\cnltx@item\item + \def\item{\cnltx@item#1\let\item\cnltx@item}% +} +\newrobustcmd\cnltx@expandable@note[1]{% + \begingroup + \reversemarginpar + \marginnote{\hfill#1\space}% + \endgroup +} +\newcommand*\cnltx@expandable{% + \cnltx@expandable@note{% + \textcolor{expandable}{\expandablesign}% + }% +} +\newcommand*\cnltx@unexpandable{% + \cnltx@expandable@note{% + \textcolor{unexpandable}{\expandablesign}% + }% +} + +\newcommand*\expandablesign{\textasteriskcentered} + +\pgfkeys{ + cnltx/.cd, + expandable-sign/.code = \def\expandablesign{#1} +} + +% -------------------------------------------------------------------------- +% modules: +\newcommand*\cnltx@module@sep{\,>>\,} + +\pgfkeys{ + cnltx/.cd, + module-sep/.code = \def\cnltx@module@sep{#1} +} + +\newrobustcmd*\cnltx@module[1]{% + \cnltx@ifbang + {\cnltx@write@module{#1}{}} + {\cnltx@write@module{#1}{*}}% +} +\newcommand*\cnltx@write@module[3]{ + \cnltx@module@text{#2}{#3}% + \ifblank{#1}{\cnltx@checkdefault{\hfill\newline}}{}% +} +\newcommand*\cnltx@module@text[2]{% + \begingroup + \reversemarginpar + \marginnote{\hfill\module#1{#2}\cnltx@module@sep}% + \endgroup +} + +\newrobustcmd*\Module{% + \@ifstar + {\cnltx@module{*}} + {\cnltx@module{}}% +} + +% -------------------------------------------------------------------------- +% a environment for block quotes +\newcommand*\cnltx@quote@author@format{\itshape} +\newcommand*\cnltx@quote@format{\small\sffamily} + +\pgfkeys{ + cnltx/.cd , + quote-format/.code = \def\cnltx@quote@format{#1} , + quote-author-format/.code = \def\cnltx@quote@author@format{#1} +} + +\newenvironment{cnltxquote}[1][] + {% + \def\cnltx@quote@option{#1}% + \quote + \cnltx@quote@format + } + {% + \ifdefempty\cnltx@quote@option + {} + {% + \unskip\nobreak\hfil\penalty50 + \hskip2em\hbox{}\nobreak\hfil + {\normalfont\cnltx@quote@author@format\cnltx@quote@option}% + \parfillskip0pt \finalhyphendemerits=0 + \par + }% + \endquote + } + +% -------------------------------------------------------------------------- +% document title: +\AfterPackage!{hyperref}{% + \newrobustcmd*\cnltx@tableofcontents{% + \begingroup + \let\tocbasic@listhead\@gobble + \tableofcontents + \endgroup + }% + \RequirePackage{multicol} + \AtBeginDocument{% + \ifbool{cnltx@package@name} + {\cnltx@title@information} + {% + \cnltx@doc@warning{% + No package/class name given. Hence I won't create an + automatic title% + }% + }% + }% +} + +\newrobustcmd*\cnltx@title@information{% + \thispagestyle{plain} + \begin{center} + \ifbool{cnltx@load@preamble}{} + {\renewcommand\thefootnote{\@fnsymbol\c@footnote}}% + \Huge + \scalebox{1.5}{% + \color{cnltx}% + \cnltx@title@format + \ifbool{cnltx@package@title} + {\cnltx@package@title} + {\cnltx@package@name}% + }% + \par\vskip.5cm\relax + \large + \ifbool{cnltx@package@subtitle} + {\cnltx@package@subtitle\par\vskip.5cm\relax} + {}% + \Large \cnltx@package@version \qquad \cnltx@package@date + \par\vskip.5cm\relax + \large + \cnltx@package@info + \par\vskip.5cm\relax + \large + \cnltx@package@authors + \normalsize + \ifbool{cnltx@package@url} + {% + \par\vskip.5cm\relax + \url{\cnltx@package@url}% + }{}% + \ifbool{cnltx@package@email} + {% + \par\vskip.5cm\relax + \href{mailto:\cnltx@package@email}{\cnltx@package@email}% + }{}% + \ifbool{cnltx@package@abstract} + {% + \par\vskip.5cm\relax + \cnltx@package@abstract + }{}% + \end{center} + \begin{multicols}{2}[\section*{\GetTranslation{cnltx-toc}}] + \cnltx@tableofcontents + \end{multicols}% +} + +% -------------------------------------------------------------------------- +% versioning: +\RequirePackage{marginnote,ragged2e} +\newcommand*\versionnoteformat{\footnotesize\sffamily\RaggedRight} + +\pgfkeys{ + cnltx/.cd, + version-note-format/.code = \renewcommand*\versionnoteformat{#1} , +} + +\newcommand\cnltx@version@note[1]{% + \@bsphack + \begingroup + \reversemarginpar + \marginnote + {% + \versionnoteformat + \textcolor{versionnote}{#1}% + }% + \endgroup + \@esphack +} + +\newcommand*\cnltx@newnote{% + \@ifstar + {\cnltx@newnote@aux{*}} + {\cnltx@newnote@aux{}}% +} +\newrobustcmd\cnltx@newnote@aux[2]{% + \@ifnextchar[%] + {\cnltx@newnote@aux@i{#1}{#2}} + {\cnltx@newnote@aux@i{#1}{#2}[0]}% +} +\protected\def\cnltx@newnote@aux@i#1#2[#3]{% + \@ifnextchar[%] + {\cnltx@newnote@aux@ii{#1}{#2}{#3}} + {\cnltx@newnote@aux@iii{#1}{#2}{#3}}% +} +\protected\long\def\cnltx@newnote@aux@ii#1#2#3[#4]#5{% + \ifblank{#1} + {\newrobustcmd#2[#3][#4]{\cnltx@version@note{#5}}} + {\newrobustcmd*#2[#3][#4]{\cnltx@version@note{#5}}}% +} +\protected\long\def\cnltx@newnote@aux@iii#1#2#3#4{% + \ifblank{#1} + {\newrobustcmd#2[#3]{\cnltx@version@note{#4}}} + {\newrobustcmd*#2[#3]{\cnltx@version@note{#4}}}% +} + +\newrobustcmd\newnote{\cnltx@newnote} + +\newnote*\sinceversion[1]{\GetTranslation{cnltx-introduced}~#1} +\newnote*\changedversion[1]{\GetTranslation{cnltx-changed}~#1} + +% -------------------------------------------------------------------------- +% hyperlinks: +\newrobustcmd*\CTANurl[2][macros/latex/contrib]{% + on \ctan\ as \code{#2}: \url{http://mirrors.ctan.org/#1/#2/}% +} + +\newrobustcmd*\needpackage[2][macros/latex/contrib]{% + \pkg{#2}\footnote{\CTANurl[#1]{#2}}% +} + +\newrobustcmd*\needclass[2][macros/latex/contrib]{% + \cls{#2}\footnote{\CTANurl[#1]{#2}}% +} + +\AtEndPreamble{% + \RequirePackage{hyperref}% + \pdfstringdefDisableCommands{% + \def\cnltx@name[#1]#2{#1 #2, }% + \def\cnltxpackagenameformat#1{#1}% + }% + \hypersetup + { + colorlinks = true, + allcolors = link , + plainpages = false, + bookmarksopen = true, + bookmarksopenlevel = 1, + bookmarksnumbered = true, + pdfauthor = {\forlistloop{}\cnltx@package@author@pdflist}, + pdftitle = + {\cnltx@package@name\space\cnltx@package@version\space Manual}, + pdfsubject = {\cnltx@package@info}, + pdfstartview = FitH + }% +} + +% -------------------------------------------------------------------------- +% localization strings: +\DeclareTranslationFallback{cnltx-default}{Default} +\DeclareTranslation{English}{cnltx-default}{Default} +\DeclareTranslation{German}{cnltx-default}{Voreinstellung} + +\DeclareTranslationFallback{cnltx-required}{required} +\DeclareTranslation{English}{cnltx-required}{required} +\DeclareTranslation{German}{cnltx-required}{erforderlich} + +\DeclareTranslationFallback{cnltx-empty}{initially empty} +\DeclareTranslation{English}{cnltx-empty}{initially empty} +\DeclareTranslation{German}{cnltx-empty}{zun\"achst leer} + +\DeclareTranslationFallback{cnltx-toc}{Table of Contents} +\DeclareTranslation{English}{cnltx-toc}{Table of Contents} +\DeclareTranslation{German}{cnltx-toc}{Inhaltsverzeichnis} + +\DeclareTranslationFallback{cnltx-license}{% + Permission is granted to copy, distribute and/or modify this software under + the terms of the \LPPL\ (\lppl), version 1.3 or later + (\url{http://www.latex-project.org/lppl.txt}). The software has the status% +} +\DeclareTranslation{English}{cnltx-license}{% + Permission is granted to copy, distribute and/or modify this software under + the terms of the \LPPL\ (\lppl), version 1.3 or later + (\url{http://www.latex-project.org/lppl.txt}). The software has the status% +} +\DeclareTranslation{German}{cnltx-license}{% + Es ist erlaubt, diese Software unter den Bedingungen der \LPPL\ (\lppl), + Version 1.3 oder sp\"ater, zu kopieren und zu verteilen + (\url{http://www.latex-project.org/lppl.txt}). Sie hat den Status% +} + +\DeclareTranslationFallback{cnltx-introduced}{Introduced in version} +\DeclareTranslation{English}{cnltx-introduced}{Introduced in version} +\DeclareTranslation{German}{cnltx-introduced}{Eingef\"uhrt in Version} + +\DeclareTranslationFallback{cnltx-changed}{Changed in version} +\DeclareTranslation{English}{cnltx-changed}{Changed in version} +\DeclareTranslation{German}{cnltx-changed}{Ge\"andert in Version} + +\DeclareTranslationFallback{cnltx-f.}{f.} +\DeclareTranslation{English}{cnltx-f.}{f.} +\DeclareTranslation{German}{cnltx-f.}{f.} + +\DeclareTranslationFallback{cnltx-ff.}{ff.} +\DeclareTranslation{English}{cnltx-ff.}{ff.} +\DeclareTranslation{German}{cnltx-ff.}{ff.} + +\DeclareTranslationFallback{cnltx-maintainer}{current maintainer} +\DeclareTranslation{English}{cnltx-maintainer}{current maintainer} +\DeclareTranslation{German}{cnltx-maintainer}{aktueller Maintainer} + +\DeclareTranslationFallback{cnltx-maintainers}{current maintainers} +\DeclareTranslation{English}{cnltx-maintainers}{current maintainers} +\DeclareTranslation{German}{cnltx-maintainers}{aktuelle Maintainer} + +\endinput + +% -------------------------------------------------------------------------- +HISTORY: + +2013/09/08 v0.1 - first working version +2013/09/10 v0.2 - added optional argument to \license + - \newname got moved to `cnltx-tools' + - added possibility for internationalization + - new macros \needpackage and \needclass + - option for formatting the document title +2013/09/12 v0.3 - new class options `add-index', `load-preamble+' and + `scrartcl' + - new options `index-prologue' and `index-space' + - new file `cnltx.ist' + - added \Module + - added optional ! to the \Default command + - add safety net: provide necessary commands in the aux-file + if they're not defined at begin document +2013/09/12 v0.3a - automatic preamble detects xelatex and lualatex and selects + the fonts accordingly +2013/09/15 v0.4 - possiblity to add an email address for each author, written + as footnote; they get symbols if the `load-preamble' + options is not used + - fixed bug in index setup mechanism + - added biblatex entry type `package' and biblatex style + `cnltx' +2013/09/20 v0.5 - new commands \expandable and \unexpandable + - new environment `cnltxquote', formatting via options + `quote-format' and `quote-author-format' + - changed scaling of `beramono' from `.83' to `.81' -- seems + a better fit in relation to Linux Libertine +2013/09/24 v0.6 - workaround for footnotes in minipages => libertine does not + have superior letters + - new options `abstract-format' and `abstract-width' +2013/09/30 v0.7 - added better microtype settings to the predefined preamble + - replaced \def's with \newcommand or \newrobustcmd +2013/10/04 v0.7a - renamed \cnltx@package@name@format into + \cnltxpackagenameformat + - added \cnltxpackagenameformat to the disabled pdfstring + commands + - added possibility to define a opitonal argument with + \newnote + +% -------------------------------------------------------------------------- +TODO: + diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty new file mode 100644 index 00000000000..c30173150f1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty @@ -0,0 +1,698 @@ +% -------------------------------------------------------------------------- +% the CNLTX bundle +% +% LaTeX source code and output +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/cnltx/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\RequirePackage{cnltx-base} +\ProvidesPackage{cnltx-example}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info] +\RequirePackage{cnltx-listings} + +\cnltx@create@bundle@message{example}{Error} +\cnltx@create@bundle@message{example}{Warning} +\cnltx@create@bundle@message{example}{WarningNoLine} +\cnltx@create@bundle@message{example}{Info} + +% -------------------------------------------------------------------------- +\RequirePackage{translations} +\PassOptionsToPackage{framemethod=tikz}{mdframed} +\RequirePackage{mdframed} +\RequirePackage{idxcmds} + +% -------------------------------------------------------------------------- +% who knows what they might be good for -- well, for indexing: +\newrobustcmd*\cnltxat{@} +\let\cnltxletterat\cnltxat +\makeatother +\newrobustcmd*\cnltxotherat{@} +\makeatletter +\newrobustcmd*\cnltxbang{!} +\newrobustcmd*\cnltxequal{=} + +% -------------------------------------------------------------------------- +% \code +\newrobustcmd*\code[1]{\begingroup\codefont#1\endgroup} +\newcommand*\verbcode{\lstinline[style=cnltx-inline]} +\newcommand*\codefont{\ttfamily} +\pgfkeys{ + cnltx/.cd, + code-font/.code = \def\codefont{#1} , +} + +% -------------------------------------------------------------------------- +% command descriptions: +% \cs +\newidxcmd\cs{\code{\textbackslash\textcolor{cs}{#1}}} + +% \env +\newidxcmd\env{\code{#1}}[\ (\GetTranslation{cnltx-environment})] + +% \begin, \end +\newidxcmd\beginend{\code{\textbackslash\textcolor{beginend}{#1}}} +\def\beginenv{\@ifstar{\beginend*{begin}}{\beginend{begin}}} +\def\endenv{\@ifstar{\beginend*{end}}{\beginend{end}}} + +% -------------------------------------------------------------------------- +% option descriptions: +\def\cnltx@isvalue{% + \nobreak\hskip.3333em plus .1667em =\hskip.3333em plus .1667em } + +% \option +\newidxcmd\option{\code{\textcolor{option}{#1}}} +\newidxcmd\module{\code{\textcolor{module}{#1}}} + +\newcommand*\key{\@ifstar{\cnltx@key@star}{\cnltx@key@nostar}} + +\def\cnltx@key@star{% + \cnltx@ifdash + {\cnltx@key@aux*\meta} + {\cnltx@key@aux*\marg}% +} +\def\cnltx@key@nostar{% + \cnltx@ifdash + {\cnltx@key@aux{}\meta} + {\cnltx@key@aux{}\marg}% +} +\def\cnltx@key@aux#1#2#3#4{% + \code{\option#1{#3}\cnltx@isvalue#2{#4}}% +} + +\newcommand*\keyis{% + \@ifstar + {\cnltx@key@aux*\@firstofone} + {\cnltx@key@aux{}\@firstofone}% +} + + +% \DeclareListParser*\cnltx@choices{|} +\newcommand*\choices[1]{% + \def\cnltx@choice@sep{\def\cnltx@choice@sep{|\hskip\z@}}% + \forcsvlist{\cnltx@choice@sep\code}{#1}% +} + +\RequirePackage[normalem]{ulem} +\newcommand*\default[1]{\uline{#1}} + +\pgfkeys{ + cnltx/.cd, + default-value/.code = \def\default##1{#1{##1}} +} + +\newcommand*\choicekey{% + \@ifstar + {\cnltx@choicekey@star} + {\cnltx@choicekey@nostar}% +} +\def\cnltx@choicekey@star#1#2{% + \code{\option*{#1}\cnltx@isvalue\choices{#2}}} +\def\cnltx@choicekey@nostar#1#2{% + \code{\option{#1}\cnltx@isvalue\choices{#2}}} + +\newcommand*\boolkey{% + \@ifstar + {\cnltx@boolkey@star} + {\cnltx@boolkey@nostar}% +} + +\def\cnltx@boolkey@star#1{\choicekey*{#1}{\default{true},false}} +\def\cnltx@boolkey@nostar#1{\choicekey{#1}{\default{true},false}} + +% -------------------------------------------------------------------------- +% argument descriptions: +% \meta +\newcommand*\meta[1]{% + $\langle$% + \textcolor{meta}{{\argumentformat#1}}% + $\rangle$% +} + +% arguments: +\newcommand*\argumentformat{\normalfont\itshape} + +\pgfkeys{ + cnltx/.cd, + arg-format/.code = \renewcommand*\argumentformat{#1} , +} + +\newcommand*\newarg[4][\meta]{% + \newcommand*#2[1]{% + \code{\textcolor{argument}{% + #3\textnormal{\ifblank{##1}{}{#1{##1}}}#4}}% + }% +} + +\newarg\marg{\{}{\}} +\newarg[\code]\Marg{\{}{\}} +\newarg\oarg{[}{]} +\newarg[\code]\Oarg{[}{]} +\newarg\darg{(}{)} +\newarg[\code]\Darg{(}{)} +\newcommand*\sarg{\textcolor{argument}{\code{*}}} + +% -------------------------------------------------------------------------- +% source code examples: +% format of the source code: +\newcommand*\sourceformat{\codefont\small} +% format of the iput example: +\newcommand*\exampleformat{} + +\pgfkeys{ + cnltx/.cd, + source-format/.code = \renewcommand*\sourceformat{#1} , + expl-format/.code = \renewcommand*\exampleformat{#1} , +} + +% see http://tex.stackexchange.com/a/114580/5049 for reference on the `nolig' +% trick, thanks to @egreg! + +\newrobustcmd\cnltx@treat@lst@index[2]{% + \newrobustcmd#1[1]{% + \begingroup + \let\lst@nolig\@empty + \def\cnltx@tmp@index{##1}% + \expandafter\cnltx@replace@all + \expandafter\cnltx@tmp@index + \expandafter{\cnltxotherat}{\cnltxat}% + \cnltx@replace@all\cnltx@tmp@index{@}{\cnltxat}% + \expandafter#2\expandafter{\cnltx@tmp@index}% + \endgroup + }% +} + +\cnltx@treat@lst@index{\indexcs}{\csidx} +\cnltx@treat@lst@index{\indexenv}{\envidx} + +% this command is undocumented and not used; it requires `cnltx-tools': +\newcommand\cnltx@copyablespace{% + \cnltx@accsupp{00A0}{method=hex,unicode}{\ }% +} + +\lst@RequireAspects{writefile} +\providecommand*\MakePercentComment{\catcode`\%14\relax} + +\def\cnltx@gobble{2} + +% listings style for source code: +\def\cnltx@listings@style{ + language = [AlLaTeX]TeX, + alsolanguage = [plain]TeX, + basicstyle = {\sourceformat}, + numbers = left, + numberstyle = \tiny, + xleftmargin = 1em, + numbersep = .75em, + gobble = \cnltx@gobble , + columns = fullflexible, + literate = + {ä}{{\"a}}1 + {ö}{{\"o}}1 + {ü}{{\"u}}1 + {Ä}{{\"A}}1 + {Ö}{{\"O}}1 + {Ü}{{\"U}}1 + {ß}{{\ss}}1 , + breaklines = true, + keepspaces = true, + breakindent = 1em, + commentstyle = \color{comment}, + keywordstyle = \color{cs}, + deletetexcs = + { + a,o,u,A,O,U, + begin, + center, + description,document, + end,enumerate, + figure,flushleft,flushright, + itemize,list, + otherlanguage, + table,tabu,tabular + }, + deletekeywords = + { + a,o,u,A,O,U, + begin, + center, + description,document, + end,enumerate, + figure,flushleft,flushright, + itemize,list, + otherlanguage, + table,tabu,tabular + }, + % \begin, \end: + texcsstyle = [2]\color{beginend}, + index = [2][texcs2], + indexstyle = [2]\@gobble, + moretexcs = [2]{begin,end}, + % added environments that'll be indexed: + texcsstyle = [3]\color{env}, + index = [3][texcs3], + indexstyle = [3]\indexenv, + % environments that won't be indexed: + texcsstyle = [4]\color{env}, + index = [4][texcs4], + indexstyle = [4]\@gobble, + % control sequences that'll be indexed: + texcsstyle = [5]\color{cs}, + index = [5][texcs5], + indexstyle = [5]\indexcs, + % control sequences that won't be indexed: + texcsstyle = [6]\color{cs}, + index = [6][texcs6], + indexstyle = [6]\@gobble +} + +\def\cnltx@bibtex@listings@style{ + language = BiBTeX, + basicstyle = {\sourceformat}, + numbers = left, + numberstyle = \tiny, + xleftmargin = 1em, + numbersep = .75em, + gobble = \cnltx@gobble , + columns = fullflexible, + literate = + {ä}{{\"a}}1 + {ö}{{\"o}}1 + {ü}{{\"u}}1 + {Ä}{{\"A}}1 + {Ö}{{\"O}}1 + {Ü}{{\"U}}1 + {ß}{{\ss}}1 , + breaklines = true, + keepspaces = true, + breakindent = 1em, + commentstyle = \color{comment}, + keywordstyle = \color{bibentry} , + keywordstyle = [2]\color{bibentryfield}\itshape , + showstringspaces = false , +} + +\def\cnltx@makeindex@listings@style{ + language = makeindex, + basicstyle = {\sourceformat}, + numbers = left, + numberstyle = \tiny, + xleftmargin = 1em, + numbersep = .75em, + gobble = \cnltx@gobble , + columns = fullflexible, + literate = + {ä}{{\"a}}1 + {ö}{{\"o}}1 + {ü}{{\"u}}1 + {Ä}{{\"A}}1 + {Ö}{{\"O}}1 + {Ü}{{\"U}}1 + {ß}{{\ss}}1 , + breaklines = true, + keepspaces = true, + breakindent = 1em, + commentstyle = \color{comment}, + keywordstyle = \color{makeidxkey}\bfseries , + stringstyle = \color{makeidxstring} , + showstringspaces = false , +} + +\cnltx@expandargs(nx)\lstdefinestyle + {cnltx} + {\expandonce\cnltx@listings@style} + +\cnltx@expandargs(nx)\lstdefinestyle + {cnltx-bibtex} + {\expandonce\cnltx@bibtex@listings@style} + +\cnltx@expandargs(nx)\lstdefinestyle + {cnltx-makeindex} + {\expandonce\cnltx@makeindex@listings@style} + +\lstdefinestyle + {cnltx-inline} + { + style=cnltx, + basicstyle = \codefont + } + +\def\cnltx@addcmds#1{% + \cnltx@expandargs(nx)\lstdefinestyle + {cnltx} + {\expandonce\cnltx@listings@style,\unexpanded{moretexcs={[5]#1}}}% + \edef\cnltx@listings@style{% + \expandonce\cnltx@listings@style,\unexpanded{moretexcs={[5]#1}}% + }% +} + +\def\cnltx@addsilentcmds#1{% + \cnltx@expandargs(nx)\lstdefinestyle + {cnltx} + {\expandonce\cnltx@listings@style,\unexpanded{moretexcs={[6]#1}}}% + \edef\cnltx@listings@style{% + \expandonce\cnltx@listings@style,\unexpanded{moretexcs={[6]#1}}% + }% +} + +\cnltx@expandargs(o)\cnltx@addsilentcmds{\cnltx@predefined@control@sequences} + +\def\cnltx@addenvs#1{% + \cnltx@expandargs(nx)\lstdefinestyle + {cnltx} + {\expandonce\cnltx@listings@style,\unexpanded{moretexcs={[3]#1}}}% + \edef\cnltx@listings@style{% + \expandonce\cnltx@listings@style,\unexpanded{moretexcs={[3]#1}}% + }% +} + +\def\cnltx@addsilentenvs#1{% + \cnltx@expandargs(nx)\lstdefinestyle + {cnltx} + {\expandonce\cnltx@listings@style,\unexpanded{moretexcs={[4]#1}}}% + \edef\cnltx@listings@style{% + \expandonce\cnltx@listings@style,\unexpanded{moretexcs={[4]#1}}% + }% +} + +\cnltx@expandargs(o)\cnltx@addsilentenvs{\cnltx@predefined@environments} + +\def\cnltx@addlistingsoptions#1{% + \cnltx@expandargs(nx)\lstdefinestyle + {cnltx} + {\expandonce\cnltx@listings@style,\unexpanded{#1}}% + \edef\cnltx@listings@style{% + \expandonce\cnltx@listings@style,\unexpanded{#1}% + }% +} + +\def\cnltx@local@listings@options{} + +\pgfkeys{ + cnltx/.cd, + gobble/.code = \def\cnltx@gobble{#1} , + add-cmds/.code = \cnltx@addcmds{#1} , + add-silent-cmds/.code = \cnltx@addsilentcmds{#1} , + add-listings-options/.code = \cnltx@addlistingsoptions{#1} , + listings-options/.code = \lstdefinestyle{cnltx}{#1} , + add-envs/.code = \cnltx@addenvs{#1} , + add-silent-envs/.code = \cnltx@addsilentenvs{#1} , + sourcecode-options/.code = \def\cnltx@local@listings@options{#1} , +} + +\def\cnltx@mdframed@options + { + backgroundcolor = cnltxbg , + linecolor = cnltx , + roundcorner = 5pt + } +\cnltx@expandargs(nx)\mdfdefinestyle + {cnltx} + {\expandonce\cnltx@mdframed@options} + +\def\cnltx@addmdframedoptions#1{% + \cnltx@expandargs(nx)\mdfdefinestyle + {cnltx} + {\expandonce\cnltx@mdframed@options,\unexpanded{#1}}% +} + +\newbool{cnltx@sidebyside} +\newbool{cnltx@codeleft} +\booltrue{cnltx@codeleft} +\newbool{cnltx@codeonly} + +\newsavebox\cnltx@example@box + +\newcommand*\cnltx@examplesep{\hrulefill} + +\newcommand*\cnltx@pre@source@hook{} +\newcommand*\cnltx@after@source@hook{} +\newcommand*\cnltx@pre@example@hook{} +\newcommand*\cnltx@after@example@hook{} + + +\pgfkeys{ + cnltx/.cd, + side-by-side/.is if = cnltx@sidebyside , + code-only/.is if = cnltx@codeonly , + code-left/.is if = cnltx@codeleft , + code-sep/.code = \def\cnltx@examplesep{#1} , + pre-code/.code = \def\cnltx@pre@source@hook{#1} , + after-code/.code = \def\cnltx@after@source@hook{#1} , + pre-output/.code = \def\cnltx@pre@example@hook{#1} , + after-output/.code = \def\cnltx@after@example@hook{#1} , + add-frame-options/.code = \cnltx@addmdframedoptions{#1} , + frame-options/.code = \mdfdefinestyle{cnltx}{#1} , + gobble/.code = \def\cnltx@gobble{#1} , +} + +\newcommand*\cnltx@example@input[1]{% + \trivlist\item\relax + % don't know why this is necessary but it is: + \catcode`\^^M=5\relax + \makeatother + \MakePercentComment + % want special formatting for the input example: + \exampleformat + % we're in a list so the first paragraph is not indented; let's make the + % input example be the second paragraph: + \if@minipage\else + \par\mbox{}\par\vskip-\baselineskip\relax + \fi + \input{#1}% + \endtrivlist +} + +\newcommand*\cnltx@source@input@start[1]{% + \ifboolexpr{ bool {cnltx@sidebyside} and not bool {cnltx@codeonly} } + {\setbox\cnltx@example@box=\hbox\bgroup}{\cnltx@pre@source@hook}% + \lst@BeginAlsoWriteFile{#1}% +} + +\newcommand*\cnltx@source@input@end{% + \lst@EndWriteFile + \ifboolexpr{ bool {cnltx@sidebyside} and not bool {cnltx@codeonly} } + {\egroup}{\cnltx@after@source@hook}% +} + +% + +\newcommand*\cnltx@example@start[1]{% + \pgfqkeys{/cnltx}{#1}% + \cnltx@expandargs(x)\lstset{ + style=cnltx, + \expandonce\cnltx@local@listings@options + }% + \ifbool{cnltx@sidebyside} + {\mdframed[style=cnltx,nobreak=true]} + {\mdframed[style=cnltx,nobreak=false]}% +} + +\newcommand*\cnltx@example@end[1]{% + \ifblank{#1}{\booltrue{cnltx@codeonly}}{} + \ifbool{cnltx@codeonly} + {} + {% + \ifbool{cnltx@sidebyside} + {% + \ifbool{cnltx@codeleft} + {% + \minipage[c]{% + \dimexpr + .49\linewidth + -.75\lst@xleftmargin + \relax + }% + \cnltx@pre@source@hook + \unhbox\cnltx@example@box + \cnltx@after@source@hook + \endminipage\hfill + \minipage[c]{% + \dimexpr + .49\linewidth + -.75\lst@xleftmargin + \relax + }% + \cnltx@pre@example@hook + \cnltx@example@input{#1}% + \cnltx@after@example@hook + \endminipage + } + {% + \minipage[c]{% + \dimexpr + .49\linewidth + -.75\lst@xleftmargin + \relax + }% + \cnltx@pre@example@hook + \cnltx@example@input{#1}% + \cnltx@after@example@hook + \endminipage\hfill + \minipage[c]{% + \dimexpr + .49\linewidth + -.75\lst@xleftmargin + \relax + }% + \cnltx@pre@source@hook + \unhbox\cnltx@example@box + \cnltx@after@source@hook + \endminipage + }% + } + {% + \par\noindent\cnltx@examplesep + \cnltx@pre@example@hook + \cnltx@example@input{#1}% + \cnltx@after@example@hook + }% + }% + \endmdframed + \ignorespacesafterend +} + +\def\cnltx@new@sourcecode@env#1#2{% + \lstnewenvironment{#2}[1][] + {% + \cnltx@example@start{##1,#1}% + \cnltx@source@input@start{\jobname.cnltx.code}% + } + {% + \cnltx@source@input@end + \cnltx@example@end{\jobname.cnltx.code}% + % see http://tex.stackexchange.com/a/136264/5049 + % for the reasoning behind this: + \if@nobreak + \@nobreakfalse + \fi + }% +} +\newrobustcmd\newsourcecodeenv[2][]{% + \cnltx@new@sourcecode@env{#1}{#2}% +} + +\def\cnltx@input@sourcecode@file#1#2{% + \begingroup + \cnltx@example@start{#1}% + \lstinputlisting{#2}% + \cnltx@example@end{#2}% + \endgroup +} + +\def\cnltx@new@input@source@file#1#2{% + \newcommand#2[2][]{\cnltx@input@sourcecode@file{#1,##1}{##2}}% +} + +\newrobustcmd*\newinputsourcefilecmd[2][]{% + \cnltx@new@input@source@file{#1}{#2}% +} + +\newsourcecodeenv{example} +\newsourcecodeenv[side-by-side]{sidebyside} +\newsourcecodeenv[code-only]{sourcecode} + +\newinputsourcefilecmd\inputexample +\newinputsourcefilecmd[side-by-side]\inputsidebyside +\newinputsourcefilecmd[code-only]\inputsourcecode + +\newrobustcmd*\implementation[2][]{% + \lstinputlisting[style=cnltx,#1]{#2}% +} + + +% -------------------------------------------------------------------------- +% packages and classes: +\newcommand*\packageformat{\sffamily} +\newcommand*\classformat{\sffamily} +\newcommand*\bundleformat{\sffamily} + +\newidxcmd\pkg{{\packageformat#1}}[\ (\GetTranslation{cnltx-package})] +\newidxcmd\cls{{\classformat#1}}[\ (\GetTranslation{cnltx-class})] +\newidxcmd\bnd{{\bundleformat#1}}[\ (\GetTranslation{cnltx-bundle})] + +\pgfkeys{ + cnltx/.cd, + pkg-format/.code = \renewcommand*\packageformat{#1} , + cls-format/.code = \renewcommand*\classformat{#1} +} + +% disable indexing commands in PDF strings: +\AtBeginDocument{% + \providecommand\pdfstringdefDisableCommands[1]{}% + \pdfstringdefDisableCommands{% + \def\code#1{#1}% + \def\cs*#1{\textbackslash#1}% + \def\env*{}% + \def\option*{}% + \def\pkg*{}% + \def\cls*{}% + \def\bnd*{}% + \def\key*#1#2{#1 = #2}% + }% +} + +\DeclareTranslationFallback{cnltx-package}{package} +\DeclareTranslation{English}{cnltx-package}{package} +\DeclareTranslation{German}{cnltx-package}{Paket} + +\DeclareTranslationFallback{cnltx-environment}{environment} +\DeclareTranslation{English}{cnltx-environment}{environment} +\DeclareTranslation{German}{cnltx-environment}{Umgebung} + +\DeclareTranslationFallback{cnltx-class}{class} +\DeclareTranslation{English}{cnltx-class}{class} +\DeclareTranslation{German}{cnltx-class}{Klasse} + +\DeclareTranslationFallback{cnltx-bundle}{bundle} +\DeclareTranslation{English}{cnltx-bundle}{bundle} +\DeclareTranslation{German}{cnltx-bundle}{Bundle} + +\endinput + +% -------------------------------------------------------------------------- +HISTORY: + +2013/09/08 v0.1 - first working version +2013/09/10 v0.2 - added \keyis + - lot's of improvements on the source code example + environments + - disable indexing commands in PDF strings + - added hooks to the source example environments + - added possibility for internationalization + - new macro \verbcode + - added optional argument to \newarg + - new macros \Marg, \Oarg, \Darg + - option for formatting the \default command +2013/09/12 v0.3 - added \module + - added \newsourcecodeenv and \newinputsourcefilecmd + - added \inputexample, \inputsidebyside and \inputsourcecode + - renamed `example*' into `sidebyside' +2013/09/15 v0.4 - new listings style `cnltx-bibtex' +2013/09/20 v0.5 - new command \implementation + - fixed wrong indexing behaviour: keywords in the silent lists + are now correctly indexed if added with `add-cmds' or + `add-envs' +2013/09/30 v0.7 - added listings style `cnltx-makeindex' +2013/10/04 v0.7a - new command \cnltx@treat@lst@index + - changed \envidx in listings into \indexenv + - added \bnd for package bundles + diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty new file mode 100644 index 00000000000..14f27e7da55 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty @@ -0,0 +1,1947 @@ +% -------------------------------------------------------------------------- +% the CNLTX bundle +% +% LaTeX source code and output +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/cnltx/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\RequirePackage{cnltx-base} +\ProvidesPackage{cnltx-listings}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info] + +\cnltx@create@bundle@message{listings}{Error} +\cnltx@create@bundle@message{listings}{Warning} +\cnltx@create@bundle@message{listings}{WarningNoLine} +\cnltx@create@bundle@message{listings}{Info} + +\RequirePackage{listings} + +% -------------------------------------------------------------------------- +% a listings language BibTeX: +\lstdefinelanguage{BibTeX}{ + % entry types: + morekeywords = { + % regular types: + @article, + @book,@mvbook,@inbook,@bookinbook,@suppbook,@booklet, + @collection,@mvcollection,@incollection,@suppcollection, + @manual, + @misc, + @online, + @patent, + @periodical, + @suppperiodical, + @proceedings,@mvproceedings,@inproceedings, + @reference,@mvreference,@inreference, + @report, + @set, + @thesis, + @unpublished, + @xdata, + @customa,@customb,@customc,@customd,@custome,@customf, + % type aliases: + @conference, + @electronic, + @mastersthesis, + @phdthesis, + @techreport, + @www, + % unsupported types: + @artwork, + @audiobibnote, + @commentary, + @image, + @jurisdiction, + @legislation, + @legal, + @letter, + @movie, + @music + @performance, + @review, + @software, + @standard, + @video, + % cnltx types: + @bundle, + @class, + @package, + } , + % entry fields: + morekeywords = [2]{ + % data fields: + abstract, + addendum, + afterword, + annotation, + annotator, + author, + authortype, + bookauthor, + bookpagination, + booksubtitle, + booktitle, + booktitleaddon, + chapter, + commentator, + date, + doi, + edition, + editor,editora,editorb,editorc, + editortype, + editoratype,editorbtype,editorctype, + eid, + entrysubtype, + eprint, + eprintclass, + eprinttype, + eventdate, + eventtitle, + eventtitleaddon, + file, + foreword, + holder, + howpublished, + indextitle, + institution, + introduction, + isan, + isbn, + ismn, + isrn, + issn, + issue, + issuesubtitle, + issuetitle, + iswc, + journalsubtitle, + journaltitle, + label, + language, + library, + location, + mainsubtitle, + maintitle, + maintitleaddon, + month, + nameaddon, + note, + number, + organization, + origdate, + origlanguage, + origlocation, + origpublisher, + origtitle, + pages, + pagetotal, + pagination, + part, + publisher, + pubstate, + reprinttitle, + series, + shortauthor, + shorteditor, + shorthand, + shorthandintro, + shortjournal, + shortseries, + shorttitle, + subtitle, + title, + titleaddon, + translator, + type, + url, + urldate, + venue, + version, + volume, + volumes, + year, + % special fields: + crossref, + entryset, + execute, + gender, + hyphenation, + ids, + indexsorttitle, + keywords, + options, + presort, + related, + relatedoptions, + relatedtype, + relatedstring, + sortkey, + sortname, + sortshorthand, + sorttitle, + sortyear, + xdata, + xref, + % custom fields: + namea,nameb,namec, + nameatype,namebtype,namectype, + lista,listb,listc,listd,liste.listf, + usera,userb,userc,userd,usere,userf, + verba,verbb,verbc, + % field aliases: + address, + annote, + archiveprefix, + journal, + key, + pdf, + primaryclass, + school, + % cnltx fields: + maintainer + } , + morestring = [b]{"} , + morecomment = [l]{\%} , + sensitive = false +} + +\lstdefinelanguage{makeindex}{ + morekeywords = { + actual, % @ + arg_open, % { + arg_close, % } + encap, % | + escape, % \\ + keyword, % \\indexentry + level, % ! + page_compositor, % - + quote, % " + range_open, % ( + range_close, % ) + preamble, % \\begin{theindex} \n + postamble, % \n\n \end{theindex} \n + setpage_prefix, % \n \\setcounter{page}{ + setpage_suffix, % } \n + group_skip, % \n\n \\indexspace \n + headings_flag, % 0 + heading_prefix, % + heading_suffix, % + symhead_positive, % Symbols + symhead_negative, % symbols + numhead_positive, % Numbers + numhead_negative, % numbers + item_0, % \n \\item + item_1, % \n \\subitem + item_2, % \n \\subsubitem + item_01, % \n \\subitem + item_x1, % \n \\subitem + item_12, % \n \\subsubitem + item_x2, % \n \\subsubitem + delim_0, % , + delim_1, % , + delim_2, % , + delim_n, % , + delim_r, % -- + delim_t, % + suffix_2p, % + suffix_3p, % + suffix_mp, % + encap_prefix, % \\ + encap_infix, % { + encap-suffix, % } + line_max, % 72 + indent_space, % \t\t + indent_length % 16 + } , + morestring = [b]{"} , + morecomment = [l]{\%} , + sensitive = true +} + +% -------------------------------------------------------------------------- +% command names `moretexcs' that are used as not-indexed texcs for the +% listings style `cnltx': +\def\cnltx@predefined@control@sequences{% + % symbols: + -,@, + % csnames beginning with @: + @alph,@Alph,@arabic, + @ctrerr, + @empty, + @firstofone,@firstoftwo, + @gobble, + @ifclassloaded, + @ifnextchar, + @ifpackageloaded, + @ifstar, + @makefnmark, + @roman,@Roman, + @secondoftwo, + @slowromancap, + @textsuperscript, + @thefnmark, + % A: + a,AA,aa, + above, + abovedisplayshortskip, + abovedisplayskip, + abovewithdelims, + accent, + active, + acute, + addbibresource, + addcontentsline, + addpenalty, + addtocontents, + addtocounter, + addtolength, + addtokomafont, + addtoversion, + addvspace, + adjdemerits, + advance, + advancepageno, + ae,AE, + afterassignment, + AfterEndPreamble, + AfterEndDocument, + AfterEndEnvironment, + aftergroup, + AfterPreamble, + aleph, + allocationnumber, + allowbreak, + alph,Alph, + alpha, + amalg, + and, + angle, + approx, + appto, + arabic, + arccos, + arcsin, + arctan, + arg, + array, + arraycolsep, + arrayrulewidth, + arraystretch, + arrowvert, + Arrowvert, + ast, + asymp, + AtBeginDocument, + AtBeginDvi, + AtBeginEnvironment, + AtEndDocument, + AtEndEnvironment, + AtEndOfClass, + AtEndOfPackage, + AtEndPreamble, + atop, + atopwithdelims, + author, + author, + autodot, + % B + b, + backslash, + badness, + bar, + baselineskip, + baselinestretch, + batchmode, + BeforeBeginEnvironment, + begingroup, + beginsection, + belowdisplayshortskip, + belowdisplayskip, + beta, + bezier, + bf, + bffam, + bfseries, + bgroup, + bibcite, + bibdata, + bibitem, + bibliography, + bibliographystyle, + bibstyle, + big, + Big, + bigbreak, + bigcap, + bigcirc, + bigcup, + bigg, + Bigg, + biggl, + Biggl, + biggm, + Biggm, + biggr, + Biggr, + bigl, + Bigl, + bigm, + Bigm, + bigodot, + bigoplus, + bigotimes, + bigr, + Bigr, + bigskip, + bigskipamount, + bigsqcup, + bigtriangledown, + bigtriangleup, + biguplus, + bigvee, + bigwedge, + binoppenalty, + bmod, + boldmath, + boolfalse,booltrue, + bordermatrix, + bot, + botfigrule, + botmark, + bottomfraction, + bowtie, + Box, + box, + boxmaxdepth, + brace, + braceld, + bracelu, + bracerd, + braceru, + bracevert, + brack, + break, + breve, + brokenpenalty, + buildrel, + bullet, + bye, + % C + c, + cal, + cap, + caption, + cases, + catcode, + cb, + cdot, + cdotp, + cdots, + center, + centering, + centerline, + chapter, + char, + chardef, + check, + CheckCommand, + chi, + choose, + circ, + circle, + citation, + cite, + ClassError, + ClassInfo, + ClassWarning, + ClassWarningNoLine, + cleaders, + cleardoublepage, + clearpage, + cleartabs, + cline, + closein, + closeout, + clubpenalty, + clubsuit, + colon, + color, + columns, + columnsep, + columnseprule, + columnwidth, + cong, + contentsline, + coprod, + copy, + copyright, + cos, + cosh, + cot, + coth, + count, + countdef, + cr, + crcr, + cref, + csdef, + csc, + cslet,csletcs, + csname, + csuse, + cup, + CurrentOption, + % D + d, + dag, + dagger, + dashbox, + dashv, + date, + day, + dblfigrule, + dblfloatpagefraction, + dblfloatsep, + dbltextfloatsep, + dbltopfraction, + ddag, + ddagger, + ddot, + ddots, + deadcycles, + DeclareCharacterInheritance, + DeclareDictTranslation, + DeclareErrorFont, + DeclareFixedFont, + DeclareFontEncoding, + DeclareFontEncodingDefaults, + DeclareFontFamily, + DeclareFontShape, + DeclareFontSubstitution, + DeclareLanguage, + DeclareLanguageAlias, + DeclareLanguageDialect, + DeclareListParser, + DeclareMathAccent, + DeclareMathAlphabet, + DeclareMathAlphabet, + DeclareMathDelimiter, + DeclareMathRadical, + DeclareMathSizes, + DeclareMathSymbol, + DeclareMathVersion, + DeclareMicrotypeAlias, + DeclareMicrotypeBabelHook, + DeclareMicrotypeSet, + DeclareMicrotypeSetDefault, + DeclareMicrotypeVariants, + DeclareOldFontCommand, + DeclareOption, + DeclarePreloadSizes, + DeclareRobustCommand, + DeclareSizeFunction, + DeclareSymbolFont, + DeclareSymbolFontAlphabet, + DeclareTextAccent, + DeclareTextAccentDefault, + DeclareTextCommand, + DeclareTextCommandDefault, + DeclareTextComposite, + DeclareTextCompositeCommand, + DeclareTextFontCommand, + DeclareTextSymbol, + DeclareTextSymbolDefault, + DeclareTranslation, + DeclareTranslationFallback, + def, + defaulthyphenchar, + defaultscriptratio, + defaultscriptscriptratio, + defaultskewchar, + deffootnote,deffootnotemark, + definecolor, + deg, + delcode, + delimiter, + delimiterfactor, + delimitershortfall, + delta, + Delta, + depth, + descriptionlabel, + det, + dh,DH, + Diamond, + diamond, + diamondsuit, + dim, + dimen, + dimendef, + dimexpr, + DisableLigatures, + discretionary, + displayindent, + displaylimits, + displaylines, + displaymath, + displaystyle, + displaywidowpenalty, + displaywidth, + div, + divide, + dj,DJ, + do, + document, + documentclass, + documentstyle, + dospecials, + dosupereject, + dot, + doteq, + dotfill, + dots, + doublehyphendemerits, + doublerulesep, + downarrow, + Downarrow, + downbracefill, + dp, + % E + edef, + egroup, + eject, + ell, + else, + em, + emergencystretch, + emph, + empty, + emptyset, + endarray, + endcenter, + endcsname, + enddisplaymath, + enddocument, + endenumerate, + endeqnarray, + endequation, + endflushleft, + endflushright, + endgraf, + endgroup, + endinput, + endinsert, + enditemize, + endline, + endlinechar, + endlist, + endlrbox, + endmath, + endminipage, + endnote, + endpicture, + endsloppypar, + endtabbing, + endtabular, + endtrivlist, + endverbatim, + enlargethispage, + enskip, + enspace, + ensuremath, + enumerate, + epsilon, + eqalign, + eqalignno, + eqnarray, + eqno, + equation, + equiv, + errhelp, + errmessage, + errorcontextlines, + errorstopmode, + escapechar, + eta, + evensidemargin, + everycr, + everydisplay, + everyhbox, + everyjob, + everymath, + everypar, + everyvbox, + ExecuteOptions, + exhyphenpenalty, + exists, + exp, + expandafter, + expandonce, + extracolsep, + % F + fam, + fbox, + fboxrule, + fboxsep, + fi, + filbreak, + filecontents, + fill, + finalhypendemerits, + firstmark, + fiverm, + fivebf, + fivei, + fivesy, + flat, + floatingpenalty, + floatpagefraction, + floatsep, + flushbottom, + flushleft, + flushright, + fmtname, + fmtversion, + fnsymbol, + folio, + font, + fontdimen, + fontencoding, + fontfamily, + fontname, + fontseries, + fontshape, + fontsize, + fontspec, + fontsubfuzz, + footins, + footline, + footnote, + footnotemark, + footnoterule, + footnotesep, + footnotesize, + footnotetext, + footskip, + forall, + forlistloop, + foreignlanguage, + frac, + frame, + framebox, + frenchspacing, + frown, + fussy, + futurelet, + % G + gamma, + Gamma, + gcd, + ge, + GenericError, + GenericInfo, + GenericWarning, + geq, + gets, + GetTranslation, + GetTranslationFor, + gdef, + gg, + global, + globaldefs, + glossary, + goodbreak, + grave, + % H + H, + halign, + hang, + hangafter, + hangindent, + hat, + hbadness, + hbar, + hbox, + headheight, + headline, + headsep, + heartsuit, + height, + hfil, + hfill, + hfilneg, + hfuzz, + hglue, + hideskip, + hidewidth, + hline, + hoffset, + holdinginserts, + hom, + hookleftarrow, + hookrightarrow, + hphantom, + hrule, + hrulefill, + hsize, + hskip, + hskip, + hspace, + hss, + ht, + huge, + Huge, + hypersetup, + hyphenation, + hyphenchar, + hyphenpenalty, + % I + i,I, + ialign, + if, + ifblank, + ifbool,ifboolexpe,ifboolexpr, + ifcase, + ifcat, + ifcsdef, + ifcsname, + ifdim, + ifdef, + ifeof, + iff, + iffalse, + IfFileExists, + ifhbox, + ifhmode, + ifinlist, + ifinner, + ifmmode, + ifnum, + ifodd, + ifstr, + ifstrempty, + ifstrequal, + iftrue, + ifvbox, + ifvmode, + ifvoid, + ifx, + ignorespaces, + ignorespacesafterend, + Im, + imath, + immediate, + in, + include, + includeonly, + indent, + inf, + infty, + indent, + index, + input, + InputIfFileExists, + inputlineno, + insert, + insertpenalties, + int, + interdisplaylinepenalty, + interfootnotelinepenalty, + interlinepenalty, + intextsep, + intop, + iota, + it, + item. + itemindent, + itemitem, + itemize, + itemsep, + iterate, + itfam, + itshape, + % J + j, + jmath, + jobname, + Join, + joinrel, + jot, + % K + k, + kappa, + ker, + kern, + kill, + KOMAoption, + KOMAoptions, + % L + l,L, + label, + labelsep, + labelwidth, + labelenumi, + labelenumii, + labelenumiii, + labelenumiv, + labelitemi, + labelitemii, + labelitemiii, + labelitemiv, + lambda, + Lambda, + land, + langle, + language, + large, + Large, + LARGE, + lastbox, + lastkern, + lastpenalty, + lastskip, + LaTeX, + LaTeXe, + lbrace, + lbrack, + lccode, + lceil, + ldotp, + ldots, + le, + leaders, + leadsto, + leavevmode, + left, + leftarrow, + Leftarrow, + leftarrowfill, + lefteqn, + leftharpoondown, + leftharpoonup, + lefthyphenmin, + leftline, + leftmargin, + leftmargini, + leftmarginii, + leftmarginiii, + leftmarginiv, + leftmarginv, + leftmarginvi, + leftmark, + leftskip, + leftrightarrow, + Leftrightarrow, + leq, + leqalignno, + leqno, + let, + lfloor, + limits, + linepenalty, + lineskip, + lineskiplimits, + lg, + lgroup, + lhd, + lhook, + lim, + liminf, + limsup, + line, + linebreak, + linespread, + linethickness, + linewidth, + list, + listadd, + listfiles, + listfiles, + listparindent, + ll, + llap, + lmoustache, + ln, + lnot, + LoadClassWithOptions, + LoadClass, + LoadDictionary, + LoadDictionaryFor, + LoadMicrotypeFile, + log, + long, + longleftarrow, + Longleftarrow, + longleftrightarrow, + Longleftrightarrow, + longmapsto, + longrightarrow, + loop, + looseness, + lor, + lower, + lowercase, + lq, + lslig, + lsstyle, + lstinline, + lstinputlisting, + lrbox, + ltx@ifnextchar, + LuaLaTeX,LuaTeX, + % M + mag, + magnification, + magstep, + magstephalf, + makeatletter, + makeatother, + makebox, + makefootline, + makeglossary, + makeheadline, + makeindex, + makelabel, + MakeLowercase, + maketitle, + MakeUppercase, + mapsto, + mapstochar, + marginpar, + marginparpush, + marginparsep, + marginparwidth, + mark, + markboth, + markright, + math, + mathaccent, + mathbf, + mathbin, + mathchar, + mathchardef, + mathchoice, + mathclose, + mathcode, + mathellipsis, + mathgroup, + mathhexbox, + mathinner, + mathit, + mathop, + mathopen, + mathord, + mathpalette, + mathparagraph, + mathpunct, + mathrel, + mathrm, + mathsection, + mathsf, + mathsterling, + mathstrut, + mathsurround, + mathtt, + mathunderscore, + mathversion, + matrix, + max, + maxdeadcycles, + maxdepth, + maxdimen, + mbox, + mdseries, + meaning, + medbreak, + medmuskip, + medskip, + medskipamount, + message, + MessageBreak, + mho, + microtypecontext, + microtypesetup, + mid, + midinsert, + min, + minipage, + mit, + mkern, + models, + month, + moveleft, + moveright, + mp, + mscount, + mskip, + mu, + multicolumn, + multiply, + multiput, + multispan, + muskip, + muskipdef, + % N + nabla, + narrower, + natural, + ne, + nearrow, + NeedsTeXFormat, + neg, + negthinspace, + neq, + newbox, + newbool, + newcommand, + newcount, + newcounter, + newdimen, + newenvironment, + newfam, + newfont, + newfontfamily, + newhelp, + newif, + newinsert, + newlabel, + newlanguage, + newlength, + newline, + newlinechar, + newmathalphabet, + newmuskip, + newpage, + newread, + newrobustcmd, + newsavebox, + newskip, + newtheorem, + newtoks, + NewTranslation, + newwrite, + next, + ng,NG, + ni, + noalign, + noboundary, + nobreak, + nobreakspace, + nocite, + nocorr, + nocorrlist, + node, + noexpand, + nofiles, + noindent, + nointerlineskip, + nolimits, + nolinebreak, + nonfrenchspacing, + nonscript, + nonstopmode, + nonumber, + nopagebreak, + nopagenumbers, + normalbaselines, + normalbaselineskip, + normalbottom, + normalcolor, + normalfont, + normalmarginpar, + normallineskip, + normallineskiplimit, + normalsize, + notblank, + nopagebreak, + not, + notin, + nu, + null, + nulldelimiterspace, + nullfont, + number, + numberline, + numexpr, + nwarrow, + % O + o,O, + oalign, + obeycr, + obeylines, + obeyspaces, + oddsidemargin, + odot, + oe,OE, + of, + offinterlineskip, + oint, + ointop, + oldstyle, + oldstylenums, + omega, + Omega, + ominus, + omit, + onecolumn, + ooalign, + openin, + openout, + openup, + oplus, + OptionNotUsed, + or, + oslash, + otimes, + othersectionlevelsformat, + outer, + output, + outputpenalty, + oval, + over, + overbrace, + overfullrule, + overleftarrow, + overline, + overrightarrow, + overwithdelims, + owns, + % P + P, + PackageError, + PackageInfo, + PackageWarning, + PackageWarningNoLine, + pagebody, + pagebreak, + pagecontents, + pagedepth, + pagefilllstretch, + pagefillstretch, + pagefilstretch, + pagegoal, + pageinsert, + pageno, + pagenumbering, + pageref, + pageshrink, + pagestretch, + pagestyle, + pagetotal, + paperheight, + paperwidth, + par, + paragraph, + paragraphmark, + parallel, + parbox, + parfillskip, + parindent, + parsep, + parshape, + parskip, + part, + partformat, + partial, + partname, + partopsep, + PassOptionsToClass,PassOptionsToPackage, + patchcmd, + patterns, + pausing, + pdfLaTeX, + pdfstringdefDisableCommands, + pdfTeX, + penalty, + perp, + pgfkeys, + phantom, + phi, + Phi, + pi, + Pi, + picture, + plainoutput, + pm, + pmatrix, + pmod, + poptabs, + postdisplaypenalty, + pounds, + Pr, + prec, + preceq, + predisplaypenalty, + predisplaysize, + preloaded, + preto, + pretolerance, + prevdepth, + prevgraf, + prime, + printacronyms, + printbibliography, + printendnotes, + printindex, + ProcessPgfOptions, + ProcessOptions, + proclaim, + prod, + propto, + protect, + protected, + protecting, + providecommand,providerobustcmd, + ProvidesClass, + ProvideDictionaryFor, + ProvidesFile, + ProvidesPackage, + ProvideTextCommand, + psi, + Psi, + pushtabs, + put, + % Q + qbezier, + qbeziermax, + qquad, + quad, + % R + r, + radical, + raggedbottom, + raggedleft, + RaggedLeft, + raggedright, + RaggedRight, + raise, + raisebox, + rangle, + rbrace, + rbrack, + rceil, + Re, + read, + ref, + refstepcounter, + relax, + relbar, + Relbar, + relpenalty, + removelastskip, + renewcommand, + renewenvironment, + renewrobustcmd, + RenewTranslation, + repeat, + RequirePackage, + RequirePackageWithOptions, + restorecr, + reversemarginpar, + rfloor, + rgroup, + rhd, + rho, + rhook, + right, + rightarrow, + Rightarrow, + rightarrowfill, + rightharpoondown, + rightharpoonup, + righthyphenmin, + rightleftharpoons, + rightline, + rightmargin, + rightmark, + rightskip, + rlap, + rm, + rmfamily, + rmoustache, + robustify, + roman, + Roman, + romannumeral, + root, + rootbox, + rq, + rule, + % S + S, + samepage, + SaveTranslation, + SaveTranslationFor, + sb, + sbox, + scriptfont, + scriptscriptfont, + scriptscriptstyle, + scriptsize, + scriptspace, + scriptstyle, + scrollmode, + scshape, + searrow, + sec, + secdef, + section, + sectionmark, + selectfont, + selectlanguage, + setbox, + setcapindent, + setcounter, + SetExpansion, + SetExtraKerning, + SetExtraSpacing, + setfnpct, + setkomafont, + setlanguage, + setlength, + setmainfont, + setmainlanguage, + SetMathAlphabet, + setminus, + setmonofont, + setotherlanguage, + setotherlanguages, + SetProtrusion, + setsansfont, + SetSymbolFont, + settabs, + settodepth, + settoheight, + settowidth, + SetTracking, + sevenbf, + seveni, + sevensy, + sevenrm, + sfcode, + sffamily, + sharp, + shipout, + shorthandoff, + shorthandon, + shortstack, + show, + showbox, + showboxbreadth, + showboxdepth, + showhyphens, + showlists, + showoutput, + showoverfull, + showthe, + sidenote, + sigma, + Sigma, + sim, + simeq, + sin, + sinh, + skew, + skewchar, + skip, + skipdef, + sl, + slash, + slfam, + sloppy, + sloppypar, + slshape, + small, + smallbreak, + smallint, + smallskip, + smallskipamount, + smash, + smile, + sp, + space, + spacefactor, + spaceskip, + spadesuit, + span, + special, + splitbotmark, + splitfirstmark, + splitmaxdepth, + splittopskip, + sqcap, + sqcup, + sqrt, + sqsubset, + sqsubseteq, + sqsupset, + sqsupseteq, + ss, + SS, + stackrel, + star, + stepcounter, + stop, + stretch, + string, + strut, + strutbox, + subparagraph, + subparagraphmark, + subsection, + subsectionmark, + subset, + subseteq, + subsubsection, + subsubsectionmark, + succ, + succeq, + sum, + sup, + supereject, + suppressfloats, + supset, + supseteq, + surd, + swarrow, + symbol, + % T + t, + tabalign, + tabbing, + tabbingsep, + tabcolsep, + tableofcontents, + tabskip, + tabular, + tabularnewline, + tabs, + tabsdone, + tabsyet, + tan, + tanh, + tau, + tenbf, + tenex, + teni, + tenit, + tenrm, + tensl, + tensy, + tentt, + TeX, + test, + textasciicircum, + textasciitilde, + textasteriskcentered, + textbackslash, + textbar, + textbf, + textbraceleft, + textbraceright, + textbullet, + textcircled, + textcompwordmark, + textcolor, + textdagger, + textdaggerdbl, + textdollar, + textellipsis, + textemdash, + textemdash, + textenglish, + textexclamdown, + textexclamdown, + textfloatsep, + textfont, + textfraction, + textgreater, + textindent, + textit, + textheight, + textless, + textls, + textmicrotypecontext, + textmd, + textnormal, + textogonekcentered, + textparagraph, + textperiodcentered, + textquestiondown, + textquotedbl, + textquotedblleft, + textquotedblright, + textquoteleft, + textquoteright, + textregistered, + textrm, + textsc, + textsection, + textsf, + textsl, + textsterling, + textstyle, + textsuperscript, + textsection, + textsubscript, + textsuperscript, + textsterling, + TextSymbolUnavailable, + texttt, + texttrademark, + textunderscore, + textup, + textvisiblespace, + textwidth, + th,TH, + thanks, + the, + theendnotes, + theenumi,theenumii,theenumiii,theenumiv, + thefootnote, + thefootnotemark, + thempfn, + thempfn, + thempfootnote, + thepage, + thepart, + theta, + Theta, + thicklines, + thickmuskip, + thinlines, + thinmuskip, + thinspace, + thispagestyle, + tikz, + tilde, + time, + times, + tiny, + title, + to, + today + toks, + toksdef, + tolerance,, + top, + topfigrule, + topfraction, + topglue, + topins, + topinsert, + topmargin, + topmark, + topsep, + topskip, + totalheight, + tracingall, + tracingcommands, + tracingfonts, + tracinglostchars, + tracingmacros, + tracingonline, + tracingoutput, + tracingpages, + tracingparagraphs, + tracingrestores, + tracingstats, + triangle, + triangleleft, + triangleright, + trivlist, + tt, + ttfam, + ttfamily, + ttraggedright, + two@digits, + twocolumn, + typein, + typeout, + % U + u, + uccode, + uchyph, + unboldmath, + underbar, + underbrace, + underline, + unhbox, + unhcopy, + unitlength, + unkern, + unlhd, + unpenalty, + unrhd, + unskip, + unvbox, + unvcopy, + uparrow, + Uparrow, + upbracefill, + updownarrow, + Updownarrow, + uplus, + uppercase, + upsilon, + Upsilon, + upshape, + usebox, + usecounter, + usefont, + UseMicrotypeSet, + usepackage, + UseTextAccent,UseTextSymbol, + upshape, + % V + v, + vadjust, + valign, + value, + varepsilon, + varphi, + varpi, + varrho, + varsigma, + vartheta, + vbadness, + vbox, + vcenter, + vdash, + vdots, + vec, + vector, + vee, + verb, + verbatim, + vert, + Vert, + vfil, + vfill, + vfilneg, + vfootnote, + vfuzz, + vglue, + vline, + voffset, + vphantom, + vrule, + vsize, + vskip, + vspace, + vsplit, + vss, + vtop, + % W + wd, + wedge, + widehat, + widetilde, + widowpenalty, + width, + wlog, + wp, + wr, + write, + % X + xdef, + xdefinecolor, + XeLaTeX, + XeTeX + xi, + Xi, + xleaders, + xspaceskip, + % Y + year, + % Z + zeta +} + +% -------------------------------------------------------------------------- +% command names `morekeywords' that are used as not-indexed texcs for the +% listings style `cnltx': +\def\cnltx@predefined@environments{% + array, + center, + description, + displaymath, + document, + enumerate, + eqnarray, + equation, + figure, + flushleft, + flushright, + itemize, + labeling, + list, + longtable, + lrbox, + math, + minipage, + otherlanguage, + picture, + quote,quoting, + sloppypar, + tabbing, + table, + tabu, + tabular, + tabularx, + tabulary, + trivlist, + verbatim +} + +% -------------------------------------------------------------------------- +% helper commands that print the list of additionally defined keywords and +% texcs: +\def\cnltx@print@list@sep{, } + +\pgfkeys{ + cnltx/.cd, + list-sep/.code = \def\cnltx@print@list@sep{#1} +} + +\newrobustcmd*\cnltx@write@list@entry[2]{% + #1*{#2}\def\cnltx@write@list@entry##1##2{\cnltx@print@list@sep ##1*{##2}}% +} + +\newrobustcmd*\cnltx@write@list[2]{% + \cnltx@fullexpand@twoargs + \forcsvlist + {\noexpand\cnltx@write@list@entry\noexpand#2} + {\expandonce#1}% +} + +\newrobustcmd*\listsilentcmds{% + \begingroup + \cnltx@write@list\cnltx@predefined@control@sequences\cs + \endgroup +} +\newrobustcmd*\listsilentenvs{% + \begingroup + \cnltx@write@list\cnltx@predefined@environments\env + \endgroup +} + + +% -------------------------------------------------------------------------- +% read bibfiles and get name and type of entries: +\RequirePackage{catchfile} +\DeclareListParser*{\cnltx@parse@bibfile}{@} + +\def\cnltx@bibfile@entries{} + +\long\def\cnltx@get@bibfile@entry#1{\ifblank{#1}{}{\cnltx@parse@bibfile@entry#1}} + +\long\def\cnltx@parse@bibfile@entry#1#{% + \cnltx@parse@bibfile@entry@aux{#1}% +} + +\def\cnltx@parse@bibfile@entry@aux#1#2{% + \ifblank{#2}{}{% + \cnltx@parse@bibfile@entry@aux@i{#1}#2\q@stop + }% +} +\long\def\cnltx@parse@bibfile@entry@aux@i#1#2,#3\q@stop{% + \cnltx@ifinlist{{#1}{#2}}\cnltx@bibfile@entries{} + {\listadd\cnltx@bibfile@entries{{#1}{#2}}}% +} +\newbool{cnltx@inlist} +\long\protected\def\cnltx@ifinlist#1#2#3#4{% + \def\do##1{% + \boolfalse{cnltx@inlist}% + \ifstrequal{##1}{#1} + {\booltrue{cnltx@inlist}\listbreak} + {}% + }% + \dolistloop{#2}% + \ifbool{cnltx@inlist} + {#3} + {#4}% +} + +\def\cnltx@read@bibfile@entry#1#2#3{#1#2#3} + +\def\cnltx@bibentry@key#1#2#3{% + #1{#3}\def\cnltx@bibentry@key##1##2##3{\cnltx@print@list@sep##1{##3}}} + +\def\cnltx@bibentry@type#1#2#3{% + #1{@#2}\def\cnltx@bibentry@type##1##2##3{\cnltx@print@list@sep##1{@##2}}} + +\def\cnltx@bibentry#1#2#3{% + #1{#3} (#1{@#2})% + \def\cnltx@bibentry##1##2##3{\cnltx@print@list@sep##1{##3} (##1{@##2})}% +} + +% #1: cs with three args: first formats, second is the type of the entry, the +% third is the name +% #2: cs with one arg that formats whatever #1 prints, passed to #1 +% #3: filename +\def\cnltx@read@bibfile#1#2#3{% + \def\cnltx@bibfile@entries{}% + \CatchFileDef\cnltx@tmpa{#3}{}% + \expandafter\cnltx@parse@bibfile + \expandafter\cnltx@get@bibfile@entry + \expandafter{\cnltx@tmpa}% + \forlistloop{\cnltx@read@bibfile@entry#1#2}\cnltx@bibfile@entries +} + +\newrobustcmd*\listbibfilekeys[1]{% + \begingroup + \makeatletter + \cnltx@read@bibfile\cnltx@bibentry@key\code{#1}% + \endgroup +} + +\newrobustcmd*\listbibfiletypes[1]{% + \begingroup + \makeatletter + \cnltx@read@bibfile\cnltx@bibentry@type\code{#1}% + \endgroup +} + +\newrobustcmd*\listbibfileentries[1]{% + \begingroup + \makeatletter + \cnltx@read@bibfile\cnltx@bibentry\code{#1}% + \endgroup +} + +\endinput + +% -------------------------------------------------------------------------- +HISTORY: + +2013/09/15 v0.4 - first published version +2013/09/20 v0.5 - merged with `cnltx-csnames', added a number of command names +2013/09/21 v0.6 - added loads of command names +2013/09/30 v0.7 - added \listbibfilekeys, \listbibfiletypes and + \listbibfileentries + - added listings language `makeindex' +2013/10/04 v0.7a - the \listbib... commands remove duplicate entries from the + list if they're equal both in entry type and cite key + - added drivers `@class' and `@bundle' + +TODO: diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty new file mode 100644 index 00000000000..67765297dfd --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty @@ -0,0 +1,220 @@ +% -------------------------------------------------------------------------- +% the CNLTX bundle +% +% LaTeX source code and output +% +% -------------------------------------------------------------------------- +% Clemens Niederberger +% Web: https://github.com/cgnieder/cnltx/ +% E-Mail: contact@mychemistry.eu +% -------------------------------------------------------------------------- +% Copyright 2013 Clemens Niederberger +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.3 +% 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.3 or later is part of all distributions of LaTeX +% version 2005/12/01 or later. +% +% This work has the LPPL maintenance status `maintained'. +% +% The Current Maintainer of this work is Clemens Niederberger. +% -------------------------------------------------------------------------- +% If you have any ideas, questions, suggestions or bugs to report, please +% feel free to contact me. +% -------------------------------------------------------------------------- +\RequirePackage{cnltx-base} +\ProvidesPackage{cnltx-tools}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info] + +% -------------------------------------------------------------------------- +\cnltx@create@bundle@message{tools}{Error} +\cnltx@create@bundle@message{tools}{Warning} +\cnltx@create@bundle@message{tools}{WarningNoLine} +\cnltx@create@bundle@message{tools}{Info} + +% -------------------------------------------------------------------------- +\newcommand*\cnltx@name@first[1]{#1} +\newcommand*\cnltx@name@last[1]{\textsc{#1}} +\newcommand*\cnltx@name@base[1]{#1} + +\pgfkeys{ + cnltx/.cd, + last-name-format/.code = \def\cnltx@name@last##1{#1} , + first-name-format/.code = \def\cnltx@name@first##1{#1} , + name-format/.code = \def\cnltx@name@base##1{#1} +} + +\newcommand*\cnltx@name@idx[1]{\index{#1@#1}} +\newrobustcmd*\cnltx@name@star[2][]{% + \ifblank{#1} + {\cnltx@name@base{\cnltx@name@last{#2}}} + {\cnltx@name@base{\cnltx@name@first{#1} \cnltx@name@last{#2}}}% +} +\newrobustcmd*\cnltx@name@nostar[2][]{% + \ifblank{#1} + {\cnltx@name@base{\cnltx@name@last{#2}}\cnltx@name@idx{#2}} + {% + \cnltx@name@base{\cnltx@name@first{#1} \cnltx@name@last{#2}}% + \cnltx@name@idx{#2, #1}% + }% +} +\def\cnltx@name{\@ifstar{\cnltx@name@star}{\cnltx@name@nostar}} + +\newrobustcmd*\cnltx@newname[3]{% + \csdef{\cnltx@stripbs#1@short}{\cnltx@name@base{#3}\cnltx@name@idx{#3, #2}}% + \csdef{\cnltx@stripbs#1@long}{\cnltx@name@base{#2 #3}\cnltx@name@idx{#3, #2}}% + \newrobustcmd*#1{% + \@ifstar + {\csuse{\cnltx@stripbs#1@short}} + {\csuse{\cnltx@stripbs#1@long}}% + }% +} + +\newrobustcmd*\newname{\cnltx@newname} + +% -------------------------------------------------------------------------- +\PassOptionsToPackage{space=true}{accsupp} +\RequirePackage{accsupp} +% #1: actual text +% #2: other options +% #3: TeX text +\newrobustcmd\cnltx@accsupp[3]{% + \begingroup + \BeginAccSupp{ ActualText = #1 , #2 }% + #3% + \EndAccSupp{}% + \endgroup +} + +\AtBeginDocument{% + \@ifpackageloaded{hyperref} + {} + {\providecommand\texorpdfstring[2]{#1}}% +} + +\def\cnltx@acronym@format{\scshape} + +\pgfkeys{ + cnltx/.cd, + acronym-format/.code = \def\cnltx@acronym@format{#1} +} + +\newcommand*\cnltx@acronym[2]{% + \ifblank{#1} + {% + \texorpdfstring + {% + \cnltx@accsupp{#2}{}{\cnltx@acronym@format#2}% + \index{#2@{\cnltx@acronym@format#2}}% + } + {#2}% + } + {% + \texorpdfstring + {% + \cnltx@accsupp{#1}{}{\cnltx@acronym@format#2}% + \index{#1@{\cnltx@acronym@format#2}}% + } + {#1}% + }% +} + +\newcommand*\cnltxacronym{\cnltx@acronym} + +% -------------------------------------------------------------------------- +% abbreviations: + +% \def\cnltx@abbr@ifdot{\ltx@ifnextchar@nospace.} +\protected\def\cnltx@abbr@dot#1{\cnltx@ifpunctuation*[.]{#1\@}{#1.\@}} + +% -------------------------------------------------------------------------- +% \defabbr +\protected\def\cnltx@defabbr@dot#1#2{\def#1{\cnltx@abbr@dot{#2}}} +\protected\def\cnltx@defabbr@nodot#1#2{\def#1{#2}} + +% \newabbr +\protected\def\cnltx@newabbr@dot#1#2{% + \cnltx@ifdef#1{}{\protected\def#1{\cnltx@abbr@dot{#2}}}} + +\protected\def\cnltx@newabbr@nodot#1#2{% + \cnltx@ifdef#1{}{\protected\def#1{#2}}} + +% \renewabbr +\protected\def\cnltx@renewabbr@dot#1#2{% + \cnltx@ifdef#1{\protected\def#1{\cnltx@abbr@dot{#2}}}{}} + +\protected\def\cnltx@renewabbr@nodot#1#2{% + \cnltx@ifdef#1{\protected\def#1{#2}}{}} + +\def\cnltx@ifdef#1{% + \ifcsname\expandafter\@gobble\string#1\endcsname + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} + +\newrobustcmd*\newabbr{% + \@ifstar{\cnltx@newabbr@nodot}{\cnltx@newabbr@dot}% +} + +\newrobustcmd*\renewabbr{% + \@ifstar{\cnltx@renewabbr@nodot}{\cnltx@renewabbr@dot}% +} + +\newrobustcmd*\defabbr{% + \@ifstar{\cnltx@defabbr@nodot}{\cnltx@defabbr@dot}% +} + +% -------------------------------------------------------------------------- +\RequirePackage{translations} + +\newcommand*\cnltxlatin[1]{\textit{#1}} + +\DeclareTranslationFallback{cnltx-i.e.}{\cnltxlatin{i.\,e}} +\DeclareTranslation{English}{cnltx-i.e.}{\cnltxlatin{i.\,e}} +\DeclareTranslation{German}{cnltx-i.e.}{d.\,h} + +\DeclareTranslationFallback{cnltx-e.g.}{\cnltxlatin{e.\,g}} +\DeclareTranslation{English}{cnltx-e.g.}{\cnltxlatin{e.\,g}} +\DeclareTranslation{German}{cnltx-e.g.}{z.\,B} + +\DeclareTranslationFallback{cnltx-cf.}{\cnltxlatin{cf}} +\DeclareTranslation{English}{cnltx-cf.}{\cnltxlatin{cf}} +\DeclareTranslation{German}{cnltx-cf.}{vgl} + +\DeclareTranslationFallback{cnltx-etc.}{\cnltxlatin{etc}} +\DeclareTranslation{English}{cnltx-etc.}{\cnltxlatin{etc}} +\DeclareTranslation{German}{cnltx-etc.}{etc} + +\newabbr\ie{\GetTranslation{cnltx-i.e.}} +\newabbr\eg{\GetTranslation{cnltx-e.g.}} +\newabbr\cf{\GetTranslation{cnltx-cf.}} +\newabbr\etc{\GetTranslation{cnltx-etc.}} + +\newabbr\zB{z.\,B} +\newabbr\ZB{Z.\,B} +\newabbr\usw{usw} +\newabbr\usf{usf} +\newabbr\uswusf{usw.\@\space usf} +\newabbr\dsh{d.\,h} +\newabbr\Dsh{D.\,h} +\newabbr\vgl{vgl} +\newabbr\Vgl{Vgl} + +\newcommand*\cnltxtimeformat[1]{\textsc{\,#1}} +\newabbr\PM{\cnltxtimeformat{p.m}} +\newabbr\AM{\cnltxtimeformat{a.m}} +\newabbr\BC{\cnltxtimeformat{b.c}} +\newabbr\AD{\cnltxtimeformat{a.d}} + +\endinput + +% -------------------------------------------------------------------------- +HISTORY: + +2013/09/10 v0.2 - first published version +2013/09/30 v0.7 - added abbreviations + diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx.bbx b/Master/texmf-dist/tex/latex/cnltx/cnltx.bbx new file mode 100644 index 00000000000..16b887ab95c --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx.bbx @@ -0,0 +1,130 @@ +\@ifclassloaded{cnltx-doc}{}{% + \GenericError + {(cnltx.bbx)\@spaces\@spaces\@spaces\@spaces} + {cnltx bibliography style error: invalid class} + {See the cnltx bundle documentation for explanation.} + {% + The `cnltx' bibliography style can only be used with the `cnltx-doc' + document class% + }% +} +\ProvidesFile{cnltx.bbx}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info] + +\RequireBibliographyStyle{alphabetic} +\ExecuteBibliographyOptions{block=ragged} + +\DeclareBibliographyDriver{latex}{% + \usebibmacro{bibindex}% + \usebibmacro{begentry}% + \usebibmacro{author}% + \usebibmacro{maintainer}% + \setunit{\labelnamepunct}\newblock + \usebibmacro{title+subtitle}% + \printfield{version}% + \setunit{\addcomma\addspace}% + \usebibmacro{date}% + \newunit\newblock + \usebibmacro{url+urldate}% + \newunit\newblock + \usebibmacro{finentry}% +} +\DeclareBibliographyAlias{package}{latex} +\DeclareBibliographyAlias{class}{latex} +\DeclareBibliographyAlias{bundle}{latex} + +\newbibmacro{title+subtitle}{% + \iffieldundef{title}{}{% + \printfield{title}% + \ifbibindex{\indexfield{title}}{}% + \setunit{\adddot\addspace}% + \iffieldundef{subtitle}{}{% + \printfield{subtitle}% + \setunit{\adddot\addspace}% + }% + }% +} + +\newbibmacro*{maintainer}{% + \printtext{% + \ifnameundef{maintainer} + {} + {% + \addcomma\addspace + \ifnumgreater{\value{maintainer}}{1} + {\GetTranslation{cnltx-maintainers}} + {\GetTranslation{cnltx-maintainer}}% + \addcolon\addspace + \printnames{maintainer}% + }% + }% +} + +\DeclareNameAlias[package]{maintainer}{default} +\DeclareNameAlias[class]{maintainer}{default} +\DeclareNameAlias[bundle]{maintainer}{default} + +\DeclareIndexNameAlias[package]{maintainer}{default} +\DeclareIndexNameAlias[class]{maintainer}{default} +\DeclareIndexNameAlias[bundle]{maintainer}{default} + +\DeclareFieldFormat[package]{title}{\pkg*{#1}} +\DeclareFieldFormat[class]{title}{\cls*{#1}} +\DeclareFieldFormat[bundle]{title}{\bnd*{#1}} + +\DeclareIndexFieldFormat[package]{title}{% + \ifstrequal{#1}{\KOMAScript} + {\pkgidx[KOMA-Script]{\KOMAScript}} + {\pkgidx{#1}}% +} +\DeclareIndexFieldFormat[class]{title}{% + \ifstrequal{#1}{\KOMAScript} + {\clsidx[KOMA-Script]{\KOMAScript}} + {\clsidx{#1}}% +} +\DeclareIndexFieldFormat[bundle]{title}{% + \ifstrequal{#1}{\KOMAScript} + {\bndidx[KOMA-Script]{\KOMAScript}} + {\bndidx{#1}}% +} + +\DeclareIndexFieldFormat[package]{indextitle}{% + \ifstrequal{#1}{\KOMAScript} + {\pkgidx[KOMA-Script]{\KOMAScript}} + {\pkgidx{#1}}% +} +\DeclareIndexFieldFormat[class]{indextitle}{% + \ifstrequal{#1}{\KOMAScript} + {\clsidx[KOMA-Script]{\KOMAScript}} + {\clsidx{#1}}% +} +\DeclareIndexFieldFormat[bundle]{indextitle}{% + \ifstrequal{#1}{\KOMAScript} + {\bndidx[KOMA-Script]{\KOMAScript}} + {\bndidx{#1}}% +} + +\DeclareFieldFormat[package]{subtitle}{\mkbibemph{#1}} +\DeclareFieldFormat[class]{subtitle}{\mkbibemph{#1}} +\DeclareFieldFormat[bundle]{subtitle}{\mkbibemph{#1}} + +\DeclareLabelname[package,class,bundle]{% + \field{shortauthor} + \field{author} + \field{maintainer} + \field{shorteditor} + \field{editor} + \field{translator} +} + +\DeclareDriverSourcemap[datatype=bibtex]{ + \map{ + \step[fieldsource=info, fieldtarget=subtitle] + } +} + +\endinput + +HISTORY: + +2013/10/04 v0.7a - added drivers `@class' and `@bundle' + diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx.cbx b/Master/texmf-dist/tex/latex/cnltx/cnltx.cbx new file mode 100644 index 00000000000..142467d2af2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx.cbx @@ -0,0 +1,26 @@ +\@ifclassloaded{cnltx-doc}{}{% + \GenericError + {(cnltx.cbx)\@spaces\@spaces\@spaces\@spaces} + {cnltx citation style error: invalid class} + {See the cnltx bundle documentation for explanation.} + {% + The `cnltx' citation style can only be used with the `cnltx-doc' + document class% + }% +} +\ProvidesFile{cnltx.cbx}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info] + +\RequireCitationStyle{alphabetic} + +\renewbibmacro*{citeindex}{% + \ifciteindex + {% + \indexnames{labelname}% + \indexnames{maintainer}% + \indexfield{indextitle}% + } + {}% +} + + +\endinput diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx.dbx b/Master/texmf-dist/tex/latex/cnltx/cnltx.dbx new file mode 100644 index 00000000000..b757744ffe2 --- /dev/null +++ b/Master/texmf-dist/tex/latex/cnltx/cnltx.dbx @@ -0,0 +1,37 @@ +\@ifclassloaded{cnltx-doc}{}{% + \GenericError + {(cnltx.dbx)\@spaces\@spaces\@spaces\@spaces} + {cnltx datamodel error: invalid class} + {See the cnltx bundle documentation for explanation.} + {% + The `cnltx' biblatex datamodel can only be used with the `cnltx-doc' + document class% + }% +} +\DeclareDatamodelFields[type=list, datatype=name]{maintainer} +\DeclareDatamodelEntryfields[package,class,bundle]{ + author, + maintainer, + info, + title, + day, + month, + year, + addendum, + language, + note, + subtitle, + titleaddon, + translator, + url, + urlday, + urlmonth, + urlyear, + version +} + +\endinput + +HISTORY: + +2013/10/04 v0.7a - added drivers `@class' and `@bundle' -- cgit v1.2.3