summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-22 23:05:26 +0000
committerKarl Berry <karl@freefriends.org>2013-11-22 23:05:26 +0000
commitceb5cab24f76ddccfaca698332238bb0fca4d2fc (patch)
tree7bc143f170cce7ec9623380bd409762740b16dd7 /Master/texmf-dist/tex/latex
parentc50741873ba695ded131eba618db95962a0e5f27 (diff)
cnltx (22nov13)
git-svn-id: svn://tug.org/texlive/trunk@32212 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty120
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty365
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty51
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty2
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx.bbx25
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx.cbx25
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx.dbx24
-rw-r--r--Master/texmf-dist/tex/latex/cnltx/cnltx.sty46
8 files changed, 537 insertions, 121 deletions
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty
index 441a155d42d..41d910c4bcc 100644
--- a/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty
@@ -25,11 +25,11 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-\def\cnltx@@date{2013/10/24}
-\def\cnltx@@version{v0.8}
+\def\cnltx@@date{2013/11/22}
+\def\cnltx@@version{v0.9}
\def\cnltx@@info{LaTeX tools and documenting facilities (CN)}
\ProvidesPackage{cnltx-base}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info]
-\RequirePackage{pgfopts,etoolbox,ltxcmds}
+\RequirePackage{pgfopts,etoolbox,ltxcmds,pdftexcmds}
% --------------------------------------------------------------------------
% error messaging
@@ -119,6 +119,29 @@
\newrobustcmd\setcnltx[1]{\pgfqkeys{/cnltx}{#1}}
\def\cnltx@par{\par}
+% --------------------------------------------------------------------------
+% scratch variables
+\newcounter{cnltx@tmpa}
+\newcounter{cnltx@tmpb}
+\newcounter{cnltx@tmpc}
+
+\newlength\cnltx@tmpa@length
+\newlength\cnltx@tmpb@length
+\newlength\cnltx@tmpc@length
+
+\newcommand*\cnltx@tmpa{}
+\newcommand*\cnltx@tmpb{}
+\newcommand*\cnltx@tmpc{}
+
+% --------------------------------------------------------------------------
+% who knows what they might be good for -- well, for indexing:
+\newrobustcmd*\cnltxat{@}
+\let\cnltxletterat\cnltxat
+\makeatother
+\newrobustcmd*\cnltxotherat{@}
+\makeatletter
+\newrobustcmd*\cnltxbang{!}
+\newrobustcmd*\cnltxequal{=}
% --------------------------------------------------------------------------
% generic conditionals
@@ -144,11 +167,29 @@
\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}%
+% test if shellescape is enabled:
+\newcommand*\cnltx@ifshellescape{%
+ \iftest{\ifnum\pdf@shellescape=1 }%
}
+% an idea by Herbert Voß (http://tex.stackexchange.com/a/7183/5049):
+% make the test character an (hopefully extremely) unlikely % with
+% catcode!=14; let's make & a temporary comment char
+% save both catcodes just in case someone changed the defaults:
+\edef\cnltx@tmpa{\catcode`\%=\the\catcode`\% \catcode`\&=\the\catcode`\&}
+\catcode`\%=3
+\catcode`\&=14
+& the test:
+\newcommand*\cnltx@ifisnum[1]{&
+ \iftest{\if%\ifnum9<1#1%\else_\fi}&
+}
+\cnltx@tmpa
+
+% an idea by Enrico Gregorio (http://tex.stackexchange.com/a/34449/5049):
+\newcommand*\cnltx@truncdiv[2]{((#1-(#2-1)/2)/#2)}
+\newcommand*\cnltx@modulo@op[2]{(#1-\cnltx@truncdiv{#1}{#2}*#2)}
+\newcommand*\cnltx@modulo[2]{\number\numexpr\cnltx@modulo@op{#1}{#2}\relax}
+
% ``\@ifnextchars''
% list parser with no separator:
\DeclareListParser*\cnltx@add@tokens{}
@@ -182,6 +223,11 @@
}
% --------------------------------------------------------------------------
+
+% \newcount\pdflastximagepages
+% \def\pdfximage#1{\pdflastximagepages=\XeTeXpdfpagecount"#1"\relax}
+
+% --------------------------------------------------------------------------
% expansion helper
% \cnltx@expandargs(<spec>)
% this is heavily inspired by expl3's \exp_args:N<spec>; in fact the code
@@ -250,6 +296,7 @@
% tokenlist manipulation
\newcommand*\cnltx@stripbs{\expandafter\@gobble\string}
+% again we borrow an idea from expl3:
% \cnltx@if@in{tokenlist}{search}{true}{false}
\newrobustcmd\cnltx@if@in[2]{%
\def\cnltx@ifin@tmp##1#2{}%
@@ -259,42 +306,44 @@
}
% \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}
+% \cnltx@replace@all{macro}{search}{replace}
+\newrobustcmd*\cnltx@replace@once {\@@cnltx@replace\@@cnltx@replace@once\edef}
+\newrobustcmd*\cnltx@greplace@once{\@@cnltx@replace\@@cnltx@replace@once\xdef}
+\newrobustcmd*\cnltx@replace@all {\@@cnltx@replace\@@cnltx@replace@all \edef}
+\newrobustcmd*\cnltx@greplace@all {\@@cnltx@replace\@@cnltx@replace@all \xdef}
+
+\long\def\cnltx@remove@to@q@stop#1\q@stop{}
-\newrobustcmd\cnltx@replace@once@longorshort[4]{%
- \expandafter\cnltx@if@in\expandafter{#2}{#3}
+\newrobustcmd\@@cnltx@replace[5]{%
+ \ifstrempty{#4}
+ {}
{%
- #1\def\cnltx@ro@tmp##1#3##2\q@stop{%
- #1\def#2{##1#4##2}%
+ \ifnum\iffalse{\fi`}=\z@\fi
+ \edef\cnltx@tmpa##1##2#4{%
+ ##2%
+ \noexpand\q@mark
+ \noexpand\cnltx@remove@to@q@stop
+ \unexpanded{\unexpanded{#5}}%
+ ##1%
}%
- \expandafter\cnltx@ro@tmp#2\q@stop
- }
- {}%
+ \ifnum`{=\z@}\fi
+ #2#3{\expandafter#1#3\q@mark#4\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}}
- {}%
+\long\def\@@cnltx@replace@aux#1\q@mark#2{\expandonce{#1}}
+\newcommand*\@@cnltx@replace@all{%
+ \expandafter\@@cnltx@replace@aux\cnltx@tmpa\@@cnltx@replace@all\@empty
}
-
-\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}}
- {}%
+\def\@@cnltx@replace@once{%
+ \expandafter\@@cnltx@replace@aux\cnltx@tmpa
+ {\@@cnltx@replace@once@end\@empty}\@empty
}
+\long\def\@@cnltx@replace@once@end#1\q@mark#2\q@stop{\expandonce{#1}}
% \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@once[2]{\cnltx@replace@once#1{#2}{}}
\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
@@ -744,3 +793,10 @@ HISTORY:
\exp_arg:N<spec> idea)
- \iftest and \nottest
2013/10/21 v0.8 - \cnltx@ifnextchars
+2013/11/22 v0.9 - \cnltx@modulo
+ - scratch variables
+ - \cnltx@ifshellescape
+ - \cnltx@greplace@once, \cnltx@greplace@all,
+ \cnltx@gremove@once, \cnltx@gremove@all
+ - \cnltx@ifisnum now also returns <false> if the test
+ argument is `<num>!'
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty
index c30173150f1..cdc72321c06 100644
--- a/Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty
@@ -39,16 +39,8 @@
\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{=}
+\RequirePackage{adjustbox}
+\RequirePackage{ifxetex}
% --------------------------------------------------------------------------
% \code
@@ -82,44 +74,49 @@
\newidxcmd\option{\code{\textcolor{option}{#1}}}
\newidxcmd\module{\code{\textcolor{module}{#1}}}
-\newcommand*\key{\@ifstar{\cnltx@key@star}{\cnltx@key@nostar}}
+\newrobustcmd*\key{\@ifstar{\cnltx@key@star}{\cnltx@key@nostar}}
-\def\cnltx@key@star{%
+\newrobustcmd*\cnltx@key@star{%
\cnltx@ifdash
{\cnltx@key@aux*\meta}
{\cnltx@key@aux*\marg}%
}
-\def\cnltx@key@nostar{%
+\newrobustcmd*\cnltx@key@nostar{%
\cnltx@ifdash
{\cnltx@key@aux{}\meta}
{\cnltx@key@aux{}\marg}%
}
-\def\cnltx@key@aux#1#2#3#4{%
+\newcommand*\cnltx@key@aux[4]{%
\code{\option#1{#3}\cnltx@isvalue#2{#4}}%
}
-\newcommand*\keyis{%
+\newrobustcmd*\keyis{%
\@ifstar
- {\cnltx@key@aux*\@firstofone}
- {\cnltx@key@aux{}\@firstofone}%
+ {\cnltx@keyis*}
+ {\cnltx@keyis{}}%
+}
+\newrobustcmd*\cnltx@keyis[1]{%
+ \cnltx@ifdash
+ {\cnltx@key@aux{#1}\@firstofone}
+ {\cnltx@key@aux{#1}\Marg}%
}
% \DeclareListParser*\cnltx@choices{|}
-\newcommand*\choices[1]{%
+\newrobustcmd*\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}}
+\newrobustcmd*\default[1]{\uline{#1}}
\pgfkeys{
cnltx/.cd,
default-value/.code = \def\default##1{#1{##1}}
}
-\newcommand*\choicekey{%
+\newrobustcmd*\choicekey{%
\@ifstar
{\cnltx@choicekey@star}
{\cnltx@choicekey@nostar}%
@@ -434,26 +431,48 @@
{\expandonce\cnltx@mdframed@options,\unexpanded{#1}}%
}
-\newbool{cnltx@sidebyside}
-\newbool{cnltx@codeleft}
+\newbool {cnltx@sidebyside}
+\newbool {cnltx@codeleft}
\booltrue{cnltx@codeleft}
-\newbool{cnltx@codeonly}
+\newbool {cnltx@codeonly}
+\newbool {cnltx@compile}
+\newbool {cnltx@float}
+\newbool {cnltx@pagelist}
\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{}
-
+\newcommand*\cnltx@image@max@height{.5\textheight}
+\newcommand*\cnltx@image@options{}
+\newcommand*\cnltx@example@fileext{pdf}
+\newcommand*\cnltx@float@type{figure}
+\newcommand*\cnltx@float@pos{}
+ \edef\cnltx@float@pos{[\csuse{fps@\cnltx@float@type}]}
+\newcommand*\cnltx@float@caption{}
+\newcommand*\cnltx@float@start{}
+\newcommand*\cnltx@init@float{%
+ \edef\cnltx@float@start{%
+ \noexpand\begin{\expandonce\cnltx@float@type}\expandonce\cnltx@float@pos}%
+}
+\cnltx@init@float
+
+\newcounter{cnltx@filenumber}
+\newcounter{cnltx@runs}
+\setcounter{cnltx@runs}{2}
+\newcounter{cnltx@pdfpages}
+\newcounter{cnltx@maxpages}
+\setcounter{cnltx@maxpages}{4}
\pgfkeys{
cnltx/.cd,
side-by-side/.is if = cnltx@sidebyside ,
code-only/.is if = cnltx@codeonly ,
code-left/.is if = cnltx@codeleft ,
+ compile/.is if = cnltx@compile ,
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} ,
@@ -462,23 +481,117 @@
add-frame-options/.code = \cnltx@addmdframedoptions{#1} ,
frame-options/.code = \mdfdefinestyle{cnltx}{#1} ,
gobble/.code = \def\cnltx@gobble{#1} ,
+ max-pages/.code = \setcounter{cnltx@maxpages}{#1} ,
+ max-height/.code = \def\cnltx@image@max@height{#1} ,
+ pages/.code =
+ \cnltx@get@page@list{#1}
+ \booltrue{cnltx@pagelist} ,
+ runs/.code = \setcounter{cnltx@runs}{#1} ,
+ program/.code = \def\cnltx@compilation@method{#1} ,
+ file-ext/.code = \def\cnltx@example@fileext{#1} ,
+ exe-with/.code = \def\cnltx@compilation@options{#1} ,
+ graphics/.code = \def\cnltx@image@options{#1} ,
+ float/.code =
+ \ifstrequal{#1}{true}
+ {%
+ \booltrue{cnltx@float}%
+ \edef\cnltx@float@pos{[\csuse{fps@\cnltx@float@type}]}%
+ }{%
+ \ifstrequal{#1}{false}
+ {\boolfalse{cnltx@float}}
+ {%
+ \booltrue{cnltx@float}%
+ \def\cnltx@float@pos{[#1]}%
+ }%
+ }
+ \cnltx@init@float ,
+ float/.default = true ,
+ caption/.code =
+ \booltrue{cnltx@float}%
+ \renewcommand\cnltx@float@caption{#1} ,
+ float-pos/.code = \def\cnltx@float@pos{[#1]}\cnltx@init@float
+}
+
+\newcommand*\cnltx@get@page@list[1]{%
+ \forcsvlist{\cnltx@read@page@list@item}{#1}%
+}
+\newcommand*\cnltx@read@page@list@item[1]{%
+ \cnltx@if@in{#1}{-}
+ {\cnltx@addrangeto@page@list#1\q@stop}
+ {\cnltx@addto@page@list{#1}}%
+}
+\newcommand*\cnltx@pagelist{}
+\newcommand*\cnltx@addto@page@list[1]{\listadd\cnltx@pagelist{#1}}
+\newcommand*\cnltx@addrangeto@page@list{}
+\def\cnltx@addrangeto@page@list#1-#2\q@stop{%
+ \setcounter{cnltx@tmpa}{#1}%
+ \setcounter{cnltx@tmpb}{#2}%
+ \whileboolexpr
+ { test {\ifnumgreater{\value{cnltx@tmpb}+1}{\value{cnltx@tmpa}}} }
+ {%
+ \listeadd\cnltx@pagelist{\arabic{cnltx@tmpa}}%
+ \stepcounter{cnltx@tmpa}%
+ }%
}
\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
+ \begingroup
+ \trivlist\item\relax
+ % what about those:
+ % \leftskip\@totalleftmargin
+ % \rightskip\z@skip
+ % \@topsep\z@
+ % \parskip\z@
+ % \partopsep\z@
+ % 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
+ \endgroup
+}
+
+\newcommand*\cnltx@exe{\immediate\write18}
+\newcommand*\cnltx@program@pdflatex{pdflatex}
+\newcommand*\cnltx@program@lualatex{lualatex}
+\newcommand*\cnltx@program@xelatex {xelatex}
+\newcommand*\cnltx@program@arara {arara}
+\newcommand*\cnltx@compile[3]{%
+ \ifcsdef{cnltx@program@#1}
+ {%
+ \setcounter{cnltx@tmpa}{\value{cnltx@runs}}%
+ \whileboolexpr
+ { test {\ifnumgreater{\value{cnltx@tmpa}}{0}} }
+ {
+ \cnltx@exe{\csuse{cnltx@program@#1}\ifblank{#2}{}{ #2} #3}%
+ \addtocounter{cnltx@tmpa}{-1}%
+ }%
+ }
+ {\cnltx@example@error{Unknown compilation method `#1'}}%
+}
+\newcommand*\cnltx@compilation@method{pdflatex}
+\newcommand*\cnltx@compilation@options{}
+
+\newrobustcmd*\cnltx@get@pdfpages[1]{%
+ \begingroup
+ \ifxetex
+ \edef\cnltx@tmpa{\the\XeTeXpdfpagecount #1 }%
+ \setcounter{cnltx@pdfpages}{\cnltx@tmpa}%
+ \else
+ \sbox0{%
+ \includegraphics{#1}%
+ \setcounter{cnltx@pdfpages}{\pdflastximagepages}%
+ }%
+ \fi
+ \endgroup
}
\newcommand*\cnltx@source@input@start[1]{%
@@ -493,8 +606,6 @@
{\egroup}{\cnltx@after@source@hook}%
}
-%
-
\newcommand*\cnltx@example@start[1]{%
\pgfqkeys{/cnltx}{#1}%
\cnltx@expandargs(x)\lstset{
@@ -506,15 +617,74 @@
{\mdframed[style=cnltx,nobreak=false]}%
}
+% #1: filename
+% #2: number of pages
+% #3: current page
+\newcommand*\cnltx@print@documentpage[3]{%
+ \cnltx@expandargs(x)\setlength\cnltx@tmpa@length{%
+ \strip@pt\dimexpr1pt/%
+ \ifnumgreater{#2}{\value{cnltx@maxpages}}
+ {\value{cnltx@maxpages}}
+ {#2}%
+ \relax \noexpand\linewidth
+ }%
+ \ifblank{#3}{}{%
+ \adjustbox{
+ frame,
+ max width = \cnltx@tmpa@length ,
+ max height = \cnltx@image@max@height
+ }{%
+ \ifnumgreater{#3}{\value{cnltx@pdfpages}}
+ {%
+ \cnltx@example@warning
+ {
+ The file `#1.\cnltx@example@fileext' has less than #3 pages,
+ namely \arabic{cnltx@pdfpages}%
+ }%
+ \parbox[b]{\cnltx@tmpa@length}{%
+ \raggedright
+ Page number #3 does not exist. \code{#1} only has
+ \arabic{cnltx@pdfpages} pages.%
+ }%
+ }
+ {%
+ \expandafter\includegraphics
+ \expandafter[\cnltx@image@options,page=#3]
+ {\jobname-cnltx-\arabic{cnltx@filenumber}.\cnltx@example@fileext}%
+ }%
+ }%
+ \ifboolexpr
+ {
+ test
+ {\ifnumgreater{#2}{\value{cnltx@maxpages}}}
+ and test
+ {
+ \ifnumequal
+ {\cnltx@modulo{#3}{\value{cnltx@maxpages}}}
+ {0}
+ }
+ }
+ {\newline}{}%
+ }%
+}
+
+\newcommand*\cnltx@stepcounter@ifnotempty[2]{%
+ \ifblank{#2}{}{\stepcounter{#1}}%
+}
+
\newcommand*\cnltx@example@end[1]{%
\ifblank{#1}{\booltrue{cnltx@codeonly}}{}
- \ifbool{cnltx@codeonly}
+ \ifboolexpr
+ {
+ bool {cnltx@codeonly} or
+ bool {cnltx@compile}
+ }
{}
- {%
+ {% direct input of code example
\ifbool{cnltx@sidebyside}
- {%
+ {% side-by-side
\ifbool{cnltx@codeleft}
- {%
+ {% code on the left
\minipage[c]{%
\dimexpr
.49\linewidth
@@ -532,11 +702,11 @@
\relax
}%
\cnltx@pre@example@hook
- \cnltx@example@input{#1}%
+ \cnltx@example@input{#1.code}%
\cnltx@after@example@hook
\endminipage
}
- {%
+ {% code on the right
\minipage[c]{%
\dimexpr
.49\linewidth
@@ -544,7 +714,7 @@
\relax
}%
\cnltx@pre@example@hook
- \cnltx@example@input{#1}%
+ \cnltx@example@input{#1.code}%
\cnltx@after@example@hook
\endminipage\hfill
\minipage[c]{%
@@ -559,14 +729,86 @@
\endminipage
}%
}
- {%
+ {% example below
\par\noindent\cnltx@examplesep
\cnltx@pre@example@hook
- \cnltx@example@input{#1}%
+ \cnltx@example@input{#1.code}%
\cnltx@after@example@hook
}%
}%
- \endmdframed
+ \ifbool{cnltx@compile}
+ {% compile file and include document
+ \cnltx@ifshellescape
+ {%
+ \cnltx@example@info
+ {%
+ Compiling example `#1.tex' \arabic{cnltx@runs}
+ time\ifnum\value{cnltx@runs}>1s\fi\space with
+ \cnltx@compilation@method
+ }%
+ \cnltx@expandargs(oo)\cnltx@compile
+ {\cnltx@compilation@method}
+ {\cnltx@compilation@options}
+ {#1.tex}%
+ }
+ {%
+ \cnltx@example@warning
+ {`shellescape' or `write18' nor enabled -- I'm not compiling}%
+ }%
+ \IfFileExists{#1.\cnltx@example@fileext}
+ {%
+ \cnltx@get@pdfpages{#1.\cnltx@example@fileext}%
+ \setcounter{cnltx@tmpa}{1}%
+ \setcounter{cnltx@tmpb}{\value{cnltx@pdfpages}}%
+ \ifbool{cnltx@float}
+ {%
+ \endmdframed
+ \cnltx@float@start
+ }
+ {\par\noindent\cnltx@examplesep\par}%
+ \cnltx@pre@example@hook
+ \ifbool{cnltx@pagelist}
+ {%
+ \setcounter{cnltx@tmpa}{0}%
+ \forlistloop
+ {\cnltx@stepcounter@ifnotempty{cnltx@tmpa}}
+ \cnltx@pagelist
+ \ifnumgreater{\value{cnltx@tmpa}}{1}
+ {\noindent}
+ {\centering}%
+ \forlistloop
+ {\cnltx@print@documentpage{#1.\cnltx@example@fileext}{\value{cnltx@tmpa}}}
+ \cnltx@pagelist
+ }
+ {%
+ \ifnumequal{\value{cnltx@pdfpages}}{1}
+ {\centering}
+ {\noindent}%
+ \whileboolexpr
+ { test {\ifnumgreater{\value{cnltx@tmpb}}{0}} }
+ {%
+ \cnltx@print@documentpage
+ {#1.\cnltx@example@fileext}
+ {\value{cnltx@pdfpages}}
+ {\value{cnltx@tmpa}}%
+ \stepcounter{cnltx@tmpa}%
+ \setcounter{cnltx@tmpb}{\numexpr\value{cnltx@tmpb}-1\relax}%
+ }
+ }%
+ \ifbool{cnltx@float}
+ {%
+ \cnltx@after@example@hook
+ \ifdefvoid\cnltx@float@caption{}{\caption{\cnltx@float@caption}}%
+ \expandafter\end\expandafter{\cnltx@float@type}%
+ }
+ {%
+ \cnltx@after@example@hook
+ \endmdframed
+ }%
+ }
+ {\endmdframed}%
+ }%
+ {\endmdframed}%
\ignorespacesafterend
}
@@ -574,11 +816,16 @@
\lstnewenvironment{#2}[1][]
{%
\cnltx@example@start{##1,#1}%
- \cnltx@source@input@start{\jobname.cnltx.code}%
+ \ifbool{cnltx@compile}{%
+ \stepcounter{cnltx@filenumber}%
+ \cnltx@source@input@start{\jobname-cnltx-\arabic{cnltx@filenumber}.tex}%
+ }{\cnltx@source@input@start{\jobname-cnltx.code}}%
}
{%
\cnltx@source@input@end
- \cnltx@example@end{\jobname.cnltx.code}%
+ \ifbool{cnltx@compile}
+ {\cnltx@example@end{\jobname-cnltx-\arabic{cnltx@filenumber}}}
+ {\cnltx@example@end{\jobname-cnltx}}%
% see http://tex.stackexchange.com/a/136264/5049
% for the reasoning behind this:
\if@nobreak
@@ -695,4 +942,16 @@ HISTORY:
2013/10/04 v0.7a - new command \cnltx@treat@lst@index
- changed \envidx in listings into \indexenv
- added \bnd for package bundles
+2013/11/22 v0.9 - new option `compile' that allows to compile source code
+ examples (which need to be complete, of course) with
+ pdflatex and include the documents afterwards
+ - new options `max-pages' that determines the maximum number
+ of pages before a line break if documents are included with
+ `compile'
+ - new option `graphics'
+ - new option `runs' that specifies the number of compilation
+ runs of the included example
+ - new options `program' and `exe-with'
+ - new option `float', `float-pos' and `caption'
+
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty
index 5c7a552ecf3..2ae39f065b8 100644
--- a/Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty
@@ -285,7 +285,7 @@
-,@,
% csnames beginning with @:
@alph,@Alph,@arabic,
- @ctrerr,
+ @car,@cdr,@ctrerr,
@empty,
@firstofone,@firstoftwo,
@gobble,
@@ -294,6 +294,7 @@
@ifpackageloaded,
@ifstar,
@makefnmark,
+ @nil,
@roman,@Roman,
@secondoftwo,
@slowromancap,
@@ -337,6 +338,7 @@
angle,
approx,
appto,
+ apptocmd,
arabic,
arccos,
arcsin,
@@ -501,10 +503,19 @@
cr,
crcr,
cref,
- csdef,
+ csappto,cseappto,csgappto,csxappto,
csc,
+ csdef,csedef,csgdef,csxdef,
+ csdimdef,csdimgdef,
+ csexpandonce,
+ csgluedef,csgluegdef,
cslet,csletcs,
+ csmudef,csmugdef,
csname,
+ csnumdef,csnumgdef,
+ cspreto,csepreto,csgpreto,csxpreto,
+ csshow,
+ csundef,
csuse,
cup,
CurrentOption,
@@ -575,8 +586,10 @@
defaultscriptratio,
defaultscriptscriptratio,
defaultskewchar,
+ defcounter,
deffootnote,deffootnotemark,
definecolor,
+ deflength,
deg,
delcode,
delimiter,
@@ -592,6 +605,7 @@
diamond,
diamondsuit,
dim,
+ dimdef,dimgdef,
dimen,
dimendef,
dimexpr,
@@ -622,6 +636,7 @@
downbracefill,
dp,
% E
+ eappto,
edef,
egroup,
eject,
@@ -655,6 +670,7 @@
enskip,
enspace,
ensuremath,
+ epreto,
epsilon,
eqalign,
eqalignno,
@@ -738,6 +754,7 @@
% G
gamma,
Gamma,
+ gappto,
gcd,
ge,
GenericError,
@@ -752,7 +769,9 @@
global,
globaldefs,
glossary,
+ gluedef,gluegdef,
goodbreak,
+ gpreto,
grave,
% H
H,
@@ -820,9 +839,11 @@
ifmmode,
ifnum,
ifodd,
+ ifpatchable,
ifstr,
ifstrempty,
ifstrequal,
+ iftoggle,
iftrue,
ifvbox,
ifvmode,
@@ -937,7 +958,7 @@
leq,
leqalignno,
leqno,
- let,
+ let,letcs,
lfloor,
limits,
linepenalty,
@@ -1077,6 +1098,7 @@
mscount,
mskip,
mu,
+ mudef,mugdef,
multicolumn,
multiply,
multiput,
@@ -1119,6 +1141,7 @@
newsavebox,
newskip,
newtheorem,
+ newtoggle,
newtoks,
NewTranslation,
newwrite,
@@ -1155,6 +1178,8 @@
normallineskiplimit,
normalsize,
notblank,
+ notbool,
+ nottoggle,
nopagebreak,
not,
notin,
@@ -1164,6 +1189,7 @@
nullfont,
number,
numberline,
+ numdef,numgdef,
numexpr,
nwarrow,
% O
@@ -1277,6 +1303,7 @@
predisplaysize,
preloaded,
preto,
+ pretocmd,
pretolerance,
prevdepth,
prevgraf,
@@ -1292,13 +1319,21 @@
propto,
protect,
protected,
+ protected@eappto,protected@xappto,
+ protected@edef.protected@xdef,
+ protected@epreto,protected@xpreto,
+ protected@cseappto,protected@csxappto,
+ protected@csedef,protected@csxdef,
+ protected@csepreto,protected@csxpreto,
protecting,
+ providebool,
providecommand,providerobustcmd,
ProvidesClass,
ProvideDictionaryFor,
ProvidesFile,
ProvidesPackage,
ProvideTextCommand,
+ providetoggle,
psi,
Psi,
pushtabs,
@@ -1392,6 +1427,7 @@
sectionmark,
selectfont,
selectlanguage,
+ setbool,
setbox,
setcapindent,
setcounter,
@@ -1414,6 +1450,7 @@
SetSymbolFont,
settabs,
settodepth,
+ settoggle,
settoheight,
settowidth,
SetTracking,
@@ -1624,6 +1661,7 @@
title,
to,
today
+ togglefalse,toggletrue,
toks,
toksdef,
tolerance,,
@@ -1647,6 +1685,7 @@
tracingoutput,
tracingpages,
tracingparagraphs,
+ tracingpatches,
tracingrestores,
tracingstats,
triangle,
@@ -1666,6 +1705,7 @@
uccode,
uchyph,
unboldmath,
+ undef,
underbar,
underbrace,
underline,
@@ -1747,6 +1787,7 @@
wr,
write,
% X
+ xappto,
xdef,
xdefinecolor,
XeLaTeX,
@@ -1754,6 +1795,7 @@
xi,
Xi,
xleaders,
+ xpreto,
xspaceskip,
% Y
year,
@@ -1928,5 +1970,6 @@ HISTORY:
list if they're equal both in entry type and cite key
- added drivers `@class' and `@bundle'
2013/10/21 v0.8 - added missing comma in list of commands
+2013/10/21 v0.9 - added internal LaTeX commands and a number of `etoolbox'
+ macros
-TODO:
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty
index 67765297dfd..8fa35c97df4 100644
--- a/Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty
@@ -199,6 +199,7 @@
\newabbr\usw{usw}
\newabbr\usf{usf}
\newabbr\uswusf{usw.\@\space usf}
+\newabbr\bzw{bzw}
\newabbr\dsh{d.\,h}
\newabbr\Dsh{D.\,h}
\newabbr\vgl{vgl}
@@ -217,4 +218,5 @@ HISTORY:
2013/09/10 v0.2 - first published version
2013/09/30 v0.7 - added abbreviations
+2013/11/22 v0.9 - \bzw
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx.bbx b/Master/texmf-dist/tex/latex/cnltx/cnltx.bbx
index 16b887ab95c..de65f393e8c 100644
--- a/Master/texmf-dist/tex/latex/cnltx/cnltx.bbx
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx.bbx
@@ -1,13 +1,14 @@
-\@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%
- }%
-}
+% \@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%
+% }%
+% }
+\RequirePackage{cnltx-example}
\ProvidesFile{cnltx.bbx}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info]
\RequireBibliographyStyle{alphabetic}
@@ -125,6 +126,8 @@
\endinput
HISTORY:
-
+2013/09/14 v0.4 - first version added to the bundle
2013/10/04 v0.7a - added drivers `@class' and `@bundle'
+2013/11/22 v0.9 - made independent from the `cnltx-doc' class
+
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx.cbx b/Master/texmf-dist/tex/latex/cnltx/cnltx.cbx
index 142467d2af2..3d7493b3cf7 100644
--- a/Master/texmf-dist/tex/latex/cnltx/cnltx.cbx
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx.cbx
@@ -1,13 +1,14 @@
-\@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%
- }%
-}
+% \@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%
+% }%
+% }
+\RequirePackage{cnltx-example}
\ProvidesFile{cnltx.cbx}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info]
\RequireCitationStyle{alphabetic}
@@ -24,3 +25,7 @@
\endinput
+
+HISTORY
+2013/01/14 v0.4 - first version added to the bundle
+2013/11/22 v0.9 - made independent from the `cnltx-doc' class
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx.dbx b/Master/texmf-dist/tex/latex/cnltx/cnltx.dbx
index b757744ffe2..94fd0e2c721 100644
--- a/Master/texmf-dist/tex/latex/cnltx/cnltx.dbx
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx.dbx
@@ -1,13 +1,14 @@
-\@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%
- }%
-}
+% \@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%
+% }%
+% }
+\RequirePackage{cnltx-example}
\DeclareDatamodelFields[type=list, datatype=name]{maintainer}
\DeclareDatamodelEntryfields[package,class,bundle]{
author,
@@ -33,5 +34,6 @@
\endinput
HISTORY:
-
+2013/09/14 v0.4 - first version added to the bundle
2013/10/04 v0.7a - added drivers `@class' and `@bundle'
+2013/11/22 v0.9 - made independent from the `cnltx-doc' class
diff --git a/Master/texmf-dist/tex/latex/cnltx/cnltx.sty b/Master/texmf-dist/tex/latex/cnltx/cnltx.sty
new file mode 100644
index 00000000000..6be04404bff
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/cnltx/cnltx.sty
@@ -0,0 +1,46 @@
+% --------------------------------------------------------------------------
+% 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}[\cnltx@@date\space \cnltx@@version\space \cnltx@@info]
+
+\newcommand*\cnltx@register@module[1]{%
+ \DeclareOption{#1}{\AtEndOfPackage{\RequirePackage{cnltx-#1}}}%
+}
+
+\cnltx@register@module{listings}
+\cnltx@register@module{example}
+\cnltx@register@module{tools}
+
+\ProcessOptions*
+
+\endinput
+
+HISTORY:
+2013/11/22 v0.9 - first added to the bundle
+
+