diff options
-rw-r--r-- | Master/texmf-dist/bibtex/bib/cnltx/cnltx.bib | 103 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/cnltx/README | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/cnltx/cnltx_en.pdf | bin | 684495 -> 758577 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/cnltx/cnltx_en.tex | 367 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx-base.sty | 120 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx-example.sty | 365 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx-listings.sty | 51 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx-tools.sty | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx.bbx | 25 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx.cbx | 25 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx.dbx | 24 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/cnltx/cnltx.sty | 46 |
12 files changed, 948 insertions, 186 deletions
diff --git a/Master/texmf-dist/bibtex/bib/cnltx/cnltx.bib b/Master/texmf-dist/bibtex/bib/cnltx/cnltx.bib index 654614a2d56..1f71ef2ce1b 100644 --- a/Master/texmf-dist/bibtex/bib/cnltx/cnltx.bib +++ b/Master/texmf-dist/bibtex/bib/cnltx/cnltx.bib @@ -41,6 +41,13 @@ version = {0.1}, url = {http://mirror.ctan.org/macros/latex/contrib/acroterm/} } +@package{pkg:adjustbox, + title = {adjustbox}, + author = {Martin Scharrer}, + date = {2012-05-21}, + version = {1.0}, + url = {http://mirror.ctan.org/macros/latex/contrib/adjustbox/} +} @package{pkg:amsmath, title = {amsmath} , author = {{American Mathematical Society}} , @@ -105,8 +112,8 @@ @bundle{bnd:cnltx, title = {cnltx} , author = {Clemens Niederberger} , - date = {2013-10-04} , - version = {0.7a} , + date = {2013-11-20} , + version = {0.9} , url = {http://mirror.ctan.org/macros/latex/contrib/cnltx/} } @class{cls:cnpkgdoc, @@ -116,6 +123,14 @@ version = {0.3a} , url = {https://bitbucket.org/cgnieder/cnpkgdoc/} } +@package{pkg:endnotes, + title = {endnotes} , + author = {John Lavagnino} , + maintainer = {Robin Fairbairns} , + date = {2003-01-15} , + version = {NA} , + url = {http://mirror.ctan.org/macros/latex/contrib/endnotes} +} @package{pkg:enumitem, title = {enumitem}, author = {Javier Bezos}, @@ -130,6 +145,13 @@ version = {0.3}, url = {http://mirror.ctan.org/macros/latex/contrib/environ/} } +@package{pkg:epic, + title = {epic}, + author = {Sunil Podar}, + date = {1986-07-14}, + version = {1.2}, + url = {http://mirror.ctan.org/macros/latex/contrib/epic/} +} @package{pkg:eqexam, title = {eqexam}, author = {D. P. Story}, @@ -186,6 +208,13 @@ version = {0.6}, url = {http://mirror.ctan.org/macros/latex/contrib/exsol/} } +@package{pkg:fnpct, + title = {fnpct} , + author = {Clemens Niederberger} , + date = {2013-02-28} , + version = {0.2j} , + url = {http://mirror.ctan.org/macros/latex/contrib/fnpct} +} @package{pkg:fontenc, title = {fontenc} , author = {{The \LaTeX\ team}} , @@ -250,6 +279,13 @@ version = {2.3} , url = {http://mirror.ctan.org/macros/latex/contrib/oberdiek/} } +@package{pkg:ifplatform, + title = {ifplatform} , + author = {Johannes Gro\ss e and Will Robertson} , + date = {2010-10-22} , + version = {0.4} , + url = {http://mirror.ctan.org/macros/latex/contrib/ifplatform/} +} @package{pkg:ifxetex, title = {ifxetex} , author = {Will Robertson} , @@ -362,6 +398,13 @@ version = {1.9b} , url = {http://mirror.ctan.org/macros/latex/contrib/mdframed/} } +@class{cls:memoir, + title = {memoir} , + author = {Peter Wilson and Lars Madsen} , + date = {2011-03-06} , + version = {3.6j} , + url = {http://mirror.ctan.org/macros/latex/contrib/memoir} +} @package{pkg:mfirstuc, title = {mfirstuc}, author = {Nicola L.C. Talbot}, @@ -412,6 +455,20 @@ version = {4.2}, url = {http://mirror.ctan.org/macros/latex/contrib/nomencl/} } +@package{pkg:pdftexcmds, + title = {pdftexcmds} , + author = {Heiko Oberdiek} , + date = {2011-11-29} , + version = {0.20} , + url = {http://mirror.ctan.org/macros/latex/contrib/oberdiek/} +} +@package{pkg:perpage, + title = {perpage}, + author = {David Kastrup}, + date = {2006-07-15}, + version = {1.12}, + url = {http://mirror.ctan.org/macros/latex/contrib/perpage/} +} @package{pkg:pgf, title = {TikZ/pgf} , author = {Till Tantau} , @@ -458,6 +515,27 @@ version = {2.1} , url = {http://mirror.ctan.org/macros/latex/contrib/ms/ragged2e/} } +@package{pkg:scrlfile, + title = {scrlfile} , + author = {Markus Kohm} , + date = {2012-06-15} , + version = {3.12} , + url = {http://mirror.ctan.org/macros/latex/contrib/koma-script} +} +@package{pkg:sepfootnotes, + title = {sepfootnotes} , + author = {Eduardo C. Louren\c{c}o de Lima} , + date = {2013-01-17} , + version = {0.2} , + url = {http://mirror.ctan.org/macros/latex/contrib/sepfootnotes} +} +@package{pkg:sidenotes, + title = {sidenotes}, + author = {Andy Thomas and Oliver Schebaum}, + date = {2012-11-09}, + version = {0.92}, + url = {http://mirror.ctan.org/macros/latex/contrib/sidenotes/} +} @package{pkg:siunitx, title = {siunitx} , author = {Joseph Wright} , @@ -465,6 +543,13 @@ date = {2013-07-31} , url = {http://mirror.ctan.org/macros/latex/contrib/siunitx} } +@package{pkg:superiors, + title = {superiors}, + author = {Michael Sharpe}, + date = {2012-08-13}, + version = {1.02}, + url = {http://mirror.ctan.org/macros/latex/contrib/superiors/} +} @package{pkg:textgreek, title = {textgreek} , author = {Leonard Michlmayr} , @@ -486,6 +571,13 @@ version = {1.1} , url = {http://mirror.ctan.org/macros/latex/contrib/trimspaces/} } +@class{cls:tufte, + title = {tufte-latex}, + author = {Kevin Godby and Bil Kleb and Bill Wood}, + date = {2009-12-11}, + version = {3.5.0}, + url = {http://mirror.ctan.org/macros/latex/contrib/tufte-latex/} +} @package{pkg:ulem, title = {ulem} , author = {Donald Arseneau} , @@ -506,6 +598,13 @@ version = {2.11} , url = {http://mirror.ctan.org/macros/latex/contrib/xcolor/} } +@package{pkg:xpatch, + title = {xpatch} , + author = {Enrico Gregorio} , + date = {2012-10-02} , + version = {0.3} , + url = {http://mirror.ctan.org/macros/latex/contrib/xpatch} +} @package{pkg:xspace, title = {xspace} , author = {David Carlisle and Morten H\o{}gholm} , diff --git a/Master/texmf-dist/doc/latex/cnltx/README b/Master/texmf-dist/doc/latex/cnltx/README index 316013a15d6..ac81de19dfb 100644 --- a/Master/texmf-dist/doc/latex/cnltx/README +++ b/Master/texmf-dist/doc/latex/cnltx/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the CNLTX bundle v0.8 2013/10/24 +the CNLTX bundle v0.9 2013/11/22 LaTeX tools and documenting facilities @@ -24,9 +24,9 @@ The Current Maintainer of this work is Clemens Niederberger. -------------------------------------------------------------------------- The cnltx bundle consists of the files - cnltx-base.sty, cnltx-doc.cls, cnltx-example.sty, cnltx-listings.sty, - cnltx-tools.sty + cnltx-tools.sty, cnltx.sty, - cnltx.ist, cnltx.bib, cnltx.bbx, cnltx.cbx, cnltx.dbx, - - cnltx_en.tex, cnltx_en.pdf + - cnltx_en.tex, cnltx_en.pdf, - README -------------------------------------------------------------------------- If you have any ideas, questions, suggestions or bugs to report, please diff --git a/Master/texmf-dist/doc/latex/cnltx/cnltx_en.pdf b/Master/texmf-dist/doc/latex/cnltx/cnltx_en.pdf Binary files differindex ba32515d7af..a776f8d595e 100644 --- a/Master/texmf-dist/doc/latex/cnltx/cnltx_en.pdf +++ b/Master/texmf-dist/doc/latex/cnltx/cnltx_en.pdf diff --git a/Master/texmf-dist/doc/latex/cnltx/cnltx_en.tex b/Master/texmf-dist/doc/latex/cnltx/cnltx_en.tex index c1d6ef812db..e061be42bb3 100644 --- a/Master/texmf-dist/doc/latex/cnltx/cnltx_en.tex +++ b/Master/texmf-dist/doc/latex/cnltx/cnltx_en.tex @@ -1,6 +1,7 @@ +% !arara: pdflatex: { shell: on } +% arara: pdflatex +% arara: biber % arara: pdflatex -% !arara: biber -% !arara: pdflatex % arara: pdflatex % -------------------------------------------------------------------------- % the CNLTX bundle @@ -33,7 +34,7 @@ \usepackage[utf8]{inputenc} \usepackage{varioref} - +\usepackage{amsmath} \usepackage{array,booktabs} \usepackage{tikz} \usetikzlibrary{chains} @@ -70,6 +71,7 @@ cnltx@ifpunctuation, cnltx@ifsym, cnltx@listings@style, + cnltx@makeindex@listings@style, cnltx@mdframed@options, cnltx@scrartcl@options, cnltx@trailpunct, @@ -88,6 +90,7 @@ dsh, eg,env,envidx,environment, expandable, + iftest, indexcs, inputexample,inputsidebyside,inputsourcecode, key,keybool,keychoice,keyval, @@ -121,8 +124,10 @@ foo, foothree, GetTranslation, + lipsum, minusone,multoffourrm, nohyperpage, + pdf@shellescape, superiors@spaced, textsu, twodigits @@ -163,7 +168,11 @@ \newname\hoffmann{Jobst}{Hoffmann} \newname\daniel{Marco}{Daniel} +\usepackage{fixfoot} +\DeclareFixedFootnote\oberdiekfn{\CTANurl{oberdiek}} + \newcommand*\file[1]{\code{#1}} +\newidxcmd\prg{\code{#1}}[ (program)] \newcommand*\latin[1]{\cnltxlatin{#1}} \newcommand*\PDF{\cnltxacronym{PDF}{pdf}} @@ -194,7 +203,7 @@ documentation of my packages. The intention behind the new bundle is a cleaner interface and less unnecessary ballast, hence the separation into packages and classes. This is actually a bit of a contradiction: the document class \cnltxdoc\ loads \emph{all} packages of the bundle which makes it more -feature-rich than \cls{cnpkgdoc} eber used to be. The bundle provides source +feature-rich than \cls{cnpkgdoc} ever used to be. The bundle provides source code environments that also print the output and defines quite a lot of macros for formatting of control sequence names, package names, package options and so on. @@ -213,7 +222,7 @@ database files and index style files. It provides a \pkg{biblatex} citation and bibliography style closely linked to \cnltxdoc. It provides a bibliography database file containing many \LaTeX\ packages. It provides\ldots\ Let's stop here. You see that the bundle provides a lot of -different features which explains why this manual is more than 50~pages long. +different features which explains why this manual is more than 60~pages long. The most detailed documentation for the bundle is as always the source code of the \file{sty} and \file{cls} files but I'm trying to provide a documentation @@ -238,7 +247,7 @@ environments will lead to wrong page numbers. The fancy frames of the source code examples are realized with the \pkg{mdframed} package by \daniel~\cite{pkg:mdframed}, loaded with the option -\keyis*{framemethod}{tikz}. +\keyis*-{framemethod}{tikz}. Besides all this I included some other ideas of mine in this bundle which are all provided by \cnltxtools. This includes a mechansim for defining clever @@ -251,6 +260,10 @@ abbreviations or macros that make it easy to index names the same way The \cnltx\ bundle currently bundles the following packages, classes and files: \begin{itemize} + \item \sinceversion{0.9}\cnltx\ -- a wrapper package for usage in documents. + It loads one or more of the following packages. See + section~\ref{sec:usage-bundle} for details on the usage. \\ + \verbcode+\usepackage{cnltx}+ \item \cnltxbase\ -- a package that defines base macros for error-messaging, expansion control, tokenlist manipulation and defining of expandable macros. It also provides color definitions and defines a few color @@ -281,8 +294,9 @@ files: \option{add-index} for \cnltxdoc\ is activated and the option \option{index-style} is not used. \item \sinceversion{0.4}\file{cnltx.bib} -- a bibliography file that - contains a small but growing number of package entries. Used by - \cnltxdoc\ when the \option{add-bib} is used. + contains a small but growing number of package entries, see + section~\ref{sec:list-entr-bib}. Used by \cnltxdoc\ when the + \option{add-bib} is used. \item \sinceversion{0.4}\file{cnltx.bbx}, \file{cnltx.cbx} and \file{cnltx.dbx} -- files related to the \pkg{biblatex} style \code{cnltx}. The \pkg{biblatex} style defined in those files is used @@ -295,7 +309,8 @@ files: The \cnltxbase\ package loads the following packages: \needpackage{pgfopts}~\cite{pkg:pgfopts}, \needpackage{etoolbox}~\cite{pkg:etoolbox}, -\pkg{ltxcmds}\footnote{\CTANurl{oberdiek}}~\cite{pkg:ltxcmds}, +\pkg{ltxcmds}\oberdiekfn~\cite{pkg:ltxcmds}, +\pkg{pdftexcmds}\oberdiekfn~\cite{pkg:pdftexcmds}, \needpackage{trimspaces}~\cite{pkg:trimspaces} and \needpackage{xcolor}~\cite{pkg:xcolor}. @@ -313,21 +328,50 @@ additional packages, see section~\vref{sec:preamble} for details. The \cnltxexample\ package loads the packages: \cnltxbase, \cnltxlistings, \cnltxtools, \needpackage{translations}, -\needpackage{mdframed}~\cite{pkg:mdframed} and -\needpackage{idxcmds}~\cite{pkg:idxcmds}. +\needpackage{mdframed}~\cite{pkg:mdframed}, +\needpackage{idxcmds}~\cite{pkg:idxcmds}, +\needpackage{ifxetex}~\cite{pkg:ifxetex}, +\needpackage{adjustbox}~\cite{pkg:adjustbox}. The \cnltxlistings\ package loads the packages \cnltxbase, \needpackage{listings}~\cite{pkg:listings} and \needpackage{catchfile}~\cite{pkg:catchfile}. The \cnltxtools\ package loads the packages \cnltxbase\ and -\needpackage[macros/latex/contrib/oberdiek]{accsupp}~\cite{pkg:accsupp}. +\pkg{accsupp}\oberdiekfn~\cite{pkg:accsupp}. All other packages that are loaded are loaded by the mentioned packages and not directly by any of the packages or classes of the \cnltx\ bundle. Like all of my packages \cnltx\ implicitly relies on an up to date \TeX\ distribution. +\section{Usage of the Bundle}\label{sec:usage-bundle} +The intended use of this bundle is three-fold: +\begin{itemize} + \item The main use-case is documenting my own \LaTeX\ packages. This is + done with + \begin{sourcecode}[gobble=6] + \documentclass{cnltx-doc} + \end{sourcecode} + and actually loads most if not all of the bundle. + \item The module \cnltxbase\ is also intended as a programming tools package + that will be used in other packages eventually. It is already used by the + \pkg{cntformats} package from the \bnd{exsheets} + bundle~\cite{bnd:exsheets}. + \item In case parts of this bundle prove useful to be used in a document the + recommended way is to add + \begin{sourcecode}[gobble=6] + \usepackage{cnltx} + \end{sourcecode} + to the preamble which will load the \cnltxbase\ module. Other needed + modules can be given as package option by using the name part after the + dash as option. + \begin{sourcecode}[gobble=6] + \usepackage[example]{cnltx} + \end{sourcecode} + would load \cnltxexample. +\end{itemize} + \part{Details of Available Commands, Environments and Options} \section{Options and Setup} @@ -414,9 +458,10 @@ provided macros, options and the like. index entry, the optional \code{-} strips the braces around \meta{value}; \cs{key}\Marg{key}\Marg{value}: \key{key}{value}; \cs{key}\code{-}\Marg{key}\Marg{value}: \key-{key}{value} - \command{keyis}[\sarg\marg{name}\marg{value}] + \command{keyis}[\sarg\code{-}\marg{name}\marg{value}] \sinceversion{0.2}A key \meta{name} set to value \meta{value}, the - optional star prevents an index entry, \cs{key}\Marg{keyis}\Marg{value}: + optional star prevents an index entry, the optional \code{-} strips the + braces around \code{value}; \cs{key}\Marg{keyis}\Marg{value}: \keyis{key}{value}. \command{choices}[\marg{clist of choices}] A list of choices, \cs{choices}\Marg{one,two,three}: @@ -822,7 +867,7 @@ Both environments can be influenced by options: \env*{minipage} environments with all consequences that come with them (think of \cs*{parindent}, page breaks \ldots). Since a \code{minipage} cannot be broken across pages the surrounding \pkg{mdframed} frame gets - the option \keyis*{nobreak}{true}. This option has no effect on the + the option \keyis*-{nobreak}{true}. This option has no effect on the \env{sourcecode} environment. \keybool{code-left}\Default{true} If \code{true} and the option \option{side-by-side} is chosen the source @@ -841,7 +886,7 @@ same as using the \env{sidebyside} environment): a \LaTeX\ code example \end{example} -\option{side-by-side} and \keyis{code-left}{false}: +\option{side-by-side} and \keyis-{code-left}{false}: \begin{example}[side-by-side,code-left=false] a \LaTeX\ code example @@ -900,6 +945,201 @@ section~\vref{sec:listings-sourcecode}. Like \option{add-silent-cmds} but for environment names. \end{options} +\subsection{Compile Source Examples}\label{sec:comp-source-exampl} +\subsubsection{The Compliation Process}\label{sec:compliation-process} +When you input an example like +\begin{sourcecode} + \begin{example} + \documentclass{article} + \begin{document} + foo + \end{document} + \end{example} +\end{sourcecode} +you'll get an error since the code is input as is and you'll end up with +\cs*{documentclass} after \verbcode=\begin{document}=. There's a way out, +though. + +\cnltxexample\sinceversion{0.9} provides the possibility to compile the source +code file externally and input the compiled \PDF. + +\begin{sourcecode} + \begin{example}[compile] + \documentclass{article} + \begin{document} + foo + \end{document} + \end{example} +\end{sourcecode} + +This needs \code{shellescape} enabled. The default compilation program is +\prg{pdflatex} which will compile the file two times. The process can be +customized with the following options: + +\begin{options} + \keybool{compile}\Default{false} + Compile the source code file. Although this option can be set globally it + really shouldn't be! It's best to give this option explicitly to the + source code environment whose body should be compiled. If enabled + globally \emph{all} examples would be compiled and most likely lead to + various errors since most examples won't be complete \LaTeX\ documents. + \keychoice{program}{pdflatex,lualatex,xelatex,arara}\Default{pdflatex} + The program to compile the source file. + \keyval{runs}{number}\Default{2} + The number of compilations. + \keyval{exe-with}{options}\Default + Command line options that can be given to the compilation program chosen + with \option{program}. + \keyval{file-ext}{extension}\Default{pdf} + The file extension of the included file of a compiled example. +\end{options} + +The compiled document will be input with \cs*{includegraphics}, each page +separately. Since the pages of the document are most likely as large as the +ones from the main document itself they are scaled down. This is best +demonstrated with an example. The following input +\begin{sourcecode} + \begin{example}[compile] + \documentclass[a5paper]{scrartcl} + \usepackage{showframe,lipsum} + \author{Clemens Niederberger} + \title{A Test File} + \begin{document} + \maketitle + \tableofcontents + \section{A Section Title} + \lipsum[1-10] + \end{document} + \end{example} +\end{sourcecode} +will lead to this output: + +\begin{example}[compile] + \documentclass[a5paper]{scrartcl} + \usepackage{showframe,lipsum} + \author{Clemens Niederberger} + \title{A Test File} + \begin{document} + \maketitle + \tableofcontents + \section{A Section Title} + \lipsum[1-10] + \end{document} +\end{example} + +The pages get scaled according to two parameters: +\begin{options} + \keyval{max-pages}{number}\Default{4} + The maximum number of pages in a row. The width of the pages is scaled to + $\text{\cs*{linewidth}}/n$ where $n$ is either the number of pages $p$ of + the compiled document or \meta{number} if $p>\text{\meta{number}}$. + \keyval{max-height}{dimension}\Default{.5\cs*{textheight}} + The maximum height of a page. +\end{options} + +There's another possibility to influence the appearance of the output: +\begin{options} + \keyval{graphics}{options}\Default + \meta{options} are passed to \cs*{includegraphics} for every page that is + input. +\end{options} + +\subsubsection{Floating Output}\label{sec:floating-output} +Since the output can become a quite large figure it might be preferable to +have it as a floating figure. This is also possible by using the option +\option{float}. +\begin{options} + \keychoice{float}{\default{true},false,\meta{float + parameters}}\Default{false} + Choose if the output should be placed in a \env*{figure} of it's own. You + can also use this option to specify the floating parameters for the float. + \keyval{float-pos}{float parameters}\Default{tbp} + Set the standard floating parameters that are used if + \keyis-{float}{true}. The default is actually the expansion of + \cs*{fps@figure} and not directly \code{tbp}. + \keyval{caption}{text}\Default + \meta{text} will be used as caption. If left blank no caption will be + typeset. Implicitly sets \keyis-{float}{true}. +\end{options} +Please note that \option{float} only has an effect if \keyis-{compile}{true} +has been set. + +\subsubsection{Selective Output}\label{sec:selective-output} +Sometimes it may be preferable not to include all pages of a compiled document +but only specific pages. This is possible with the following option. + +\begin{options} + \keyval{pages}{specifications} + Select the included pages. \meta{specification} is a comma-separated list + of page numbers and page ranges, \eg, \code{1,3,4} or + \code{1,3-5}. \code{1,3-5} is the same as \code{1,3,4,5}. If the list + includes page numbers larger than the maximum number of pages the \PDF\ + has a warnung message will be issued and a replacement text will occur in + the output where the page would have been. +\end{options} + +The input +\begin{sourcecode} + \begin{example}[compile,pages=1] + \documentclass[a5paper]{scrartcl} + \usepackage{showframe,lipsum} + \author{Clemens Niederberger} + \title{A Test File} + \begin{document} + \maketitle + \tableofcontents + \section{A Section Title} + \lipsum[1-10] + \end{document} + \end{example} +\end{sourcecode} +will lead to this output: + +\begin{example}[compile,pages=1] + \documentclass[a5paper]{scrartcl} + \usepackage{showframe,lipsum} + \author{Clemens Niederberger} + \title{A Test File} + \begin{document} + \maketitle + \tableofcontents + \section{A Section Title} + \lipsum[1-10] + \end{document} +\end{example} + +Together with the \option{graphics} option this can be used to output a part +of a page. The following source + +\begin{sourcecode} + \begin{example}[compile,pages=1,graphics={trim={0pt 12cm 0pt 0pt},clip}] + \documentclass[a5paper]{scrartcl} + \usepackage{showframe,lipsum} + \author{Clemens Niederberger} + \title{A Test File} + \begin{document} + \maketitle + \tableofcontents + \section{A Section Title} + \lipsum[1-10] + \end{document} + \end{example} +\end{sourcecode} +will give this output: + +\begin{example}[compile,pages=1,graphics={trim={0pt 12cm 0pt 0pt},clip}] + \documentclass[a5paper]{scrartcl} + \usepackage{showframe,lipsum} + \author{Clemens Niederberger} + \title{A Test File} + \begin{document} + \maketitle + \tableofcontents + \section{A Section Title} + \lipsum[1-10] + \end{document} +\end{example} + \subsection{Example File} Let's say you're documenting a package called \code{mypackage} that provides the command \cs*{mycommand} and the environment \env*{myenv}. The basic @@ -1027,8 +1267,8 @@ with the (integer) value of the counter. Redefines an existing counter representation command and its internal equivalent. In the \meta{definition} \code{\#1} is used to refer to the counter \emph{number}, that is, the value of \cs*{c@\meta{counter}}. This - command will issue an error if either the user command or the internal - command (\cf\ \cs*{arabic} and \cs*{@arabic}) or both already exist. + command will issue an error if neither the user command nor the internal + command (\cf\ \cs*{arabic} and \cs*{@arabic}) already exist. \end{commands} Let's take a look at what is actually defined by these commands: @@ -1095,7 +1335,6 @@ The commands presented in this section are highly experimental. \emph{Use them opt}\marg{definition}] \sinceversion{0.7}The equivalent of \cs*{renewcommand}. See description of \cs{newexpandablecmd} for further details. - is to \cs*{newcommand}. \command{provideexpandablecmd}[\sarg\marg{cs}\oarg{num args}\oarg{default opt}\marg{definition}] \sinceversion{0.7}The equivalent of \cs*{providecommand}. See description @@ -1119,7 +1358,7 @@ functionality also in contexts \emph{not} documenting a \LaTeX\ package. string} as \PDF\ string and for sorting the index entry that is added. This command was used to define \cs{lppl} and \cs{ctan}. \emph{This is not intended as a replacement for packages like - \pkg*{acro}~\cite{pkg:acro} or \pkg*{glossaries}\cite{pkg:glossaries}!} + \pkg*{acro}~\cite{pkg:acro} or \pkg*{glossaries}~\cite{pkg:glossaries}!} In fact it is a ``poor man's'' solution that allows me not to require one of those packages. \command{newabbr}[\sarg\marg{control sequence}\marg{definition}] @@ -1187,7 +1426,7 @@ Let's see some example: \ttfamily% <= this will amplify the visual effect of \nonfrenchspacing \newabbr\ab{a.b}% \newabbr\AB{A.B}% - \newabbr*\cd{c.d.}% + \newabbr*\cd{cd}% \ab\ and some words\par \ab. and some words\par \AB\ and some words\par @@ -1411,7 +1650,7 @@ The \cnltxdoc\ class only knows a few options: See section~\vref{sec:predefined-indexing} for details. \keyval{babel-options}{options}\Default{english} Options given to the \needpackage[macros/latex/required]{babel} package. - This option only has an effect if \keyis{load-preamble}{true}. + This option only has an effect if \keyis-{load-preamble}{true}. \keyval{scrartcl}{options}\Default Options that are passed to the underlying class \cls{scrartcl}. \emph{All global options you want to use should be given here.} @@ -1701,8 +1940,8 @@ entry types and the \code{maintainer} entry field. Along with the bibliography style a citation style \code{cnltx} is provided, again a clone of the \code{alphabetic} style. The only addition it makes is that indexing of maintainer names is enabled if \pkg{biblatex}'s -\code{indexing} option is used. \emph{The styles can only be used with the - \cnltxdoc\ class} as it relies on definitions made by it. +\code{indexing} option is used. The styles load \cnltxexample\ as it relies +on definitions made by it. This document uses the following call of \pkg{biblatex}: \begin{sourcecode} @@ -2124,7 +2363,7 @@ used in indexing strings and in different parts of the document. \cnltxdoc & cnltx-maintainer & \GetTranslation{cnltx-maintainer} & \GetTranslationFor{German}{cnltx-maintainer} \\ - \cnltxdoc & cnltx-maintainer & + \cnltxdoc & cnltx-maintainers & \GetTranslation{cnltx-maintainers} & \GetTranslationFor{German}{cnltx-maintainers} \\ \cnltxtools & cnltx-i.e. & @@ -2206,7 +2445,7 @@ the other packages and classes. message \emph{except for the error command which gets two arguments}, the first for the short version and the second for the detailed message. \meta{prefix} will be all lowercase in the generated command. - \command{cnltx\at par} + \expandable\command{cnltx\at par} Expands to \cs*{par}. Sometimes you need to smuggle a \cs*{par} in a short macro \ldots \expandable\command{iftest}[\marg{test directive}\marg{true}\marg{false}] @@ -2243,7 +2482,14 @@ the other packages and classes. \expandable\command{cnltx\at ifisnum}[\marg{token list}\marg{true}\marg{false}] \sinceversion{0.6}Checks if \meta{token list} is an integer zero or greater and leaves \meta{true} in the input stream if it is an - \meta{false} if it isn't. + \meta{false} if it isn't. There is one hopefully extremely unlikely case + where the test fails: when \meta{token list} starts with + ``\code{\meta{integer}\%}'' where \code{\%} has a category code different + than 9 (ignored) or 14 (comment). + \expandable\command{cnltx\at ifshellescape}[\marg{true}\marg{false}] + \sinceversion{0.9}Checks if shellescape is enabled. It returns true if + \pkg{pdftexcmds}' \cs*{pdf@shellescape} has the value~\code{1}. This is a + wrapper for \verbcode+\iftest{\ifnum\pdf@shellescape=1 }+. \command{cnltx\at expandargs}[\darg{specs}\meta{control sequence}] \sinceversion{0.7}This is a \LaTeXe\ version of expl3's \cs*{exp\_args:N}\meta{specs}. The command expands the arguments of @@ -2265,27 +2511,46 @@ the other packages and classes. \command{cnltx\at replace\at once}[\marg{cs}\marg{search}\marg{replace}] Replaces the first occurence of \meta{search} in the first expansion of \meta{cs} with \meta{replace}. - \command{cnltx\at long\at replace\at once}[\marg{cs}\marg{search}\marg{replace}] - \sinceversion{0.3}The same as \cs{cnltx\at replace\at once} but \meta{cs} - will be redefined with \cs*{long}. + \command{cnltx\at greplace\at once}[\marg{cs}\marg{search}\marg{replace}] + \sinceversion{0.9}The same as \cs{cnltx\at replace\at once} but acts + globally. \command{cnltx\at replace\at all}[\marg{cs}\marg{search}\marg{replace}] Replaces all occurences of \meta{search} in the first expansion of \meta{cs} with \meta{replace}. - \command{cnltx\at long\at replace\at all}[\marg{cs}\marg{search}\marg{replace}] - \sinceversion{0.3}The same as \cs{cnltx\at replace\at all} but \meta{cs} - will be redefined with \cs*{long}. + \command{cnltx\at greplace\at all}[\marg{cs}\marg{search}\marg{replace}] + \sinceversion{0.9}The same as \cs{cnltx\at replace\at all} but acts + globally. \command{cnltx\at remove\at once}[\marg{cs}\marg{search}] \sinceversion{0.3}Removes the first occurence of \meta{search} in the first expansion of \meta{cs}. - \command{cnltx\at long\at remove\at once}[\marg{cs}\marg{search}] - \sinceversion{0.3}The same as \cs{cnltx\at remove\at once} but \meta{cs} - will be redefined with \cs*{long}. + \command{cnltx\at gremove\at once}[\marg{cs}\marg{search}] + \sinceversion{0.9}The same as \cs{cnltx\at remove\at once} but acts + globally. \command{cnltx\at remove\at all}[\marg{cs}\marg{search}] \sinceversion{0.3}Removes all occurences of \meta{search} in the first expansion of \meta{cs}. - \command{cnltx\at long\at remove\at all}[\marg{cs}\marg{search}] - \sinceversion{0.3}The same as \cs{cnltx\at remove\at all} but \meta{cs} - will be redefined with \cs*{long}. + \command{cnltx\at gremove\at all}[\marg{cs}\marg{search}] + \sinceversion{0.9}The same as \cs{cnltx\at remove\at all} but acts + globally. + \command{cnltxat} + Robust command that typesets `\at' with category code 11. An @ in command + names confuses the indexing of the command names. Either one uses another + symbol for makeindex's ``actual'' recognition and also tells + \pkg{idxcmds}~\cite{pkg:idxcmds} about it or one uses \cs{cnltxat} in + \cs{cs} and friends. For the sake of convenience you can define a command + like \cs*{at} that expands to it\footnote{This is important. If you + \cs*{let} it to \cs{cnltxat} index entries may be sorted differently! + Remember: \cs{cnltxat} is robust.}. In order not to overwrite any such + existing macro it is not defined by \cnltxexample. This document for + example defines \verbcode+\def\at{\cnltxat}+. + \command{cnltxletterat} + An alias of \cs{cnltxat}. + \command{cnltxotherat} + The same as \cs{cnltxat} but with a `\at' with category code 12. + \command{cnltxbang} + The same as \cs{cnltxotherat} except that it contains a `\bang'. + \command{cnltxequal} + The same as \cs{cnltxotherat} except that it contains a `\equal'. \end{commands} \subsection{Defined by \cnltxdoc} @@ -2326,25 +2591,6 @@ the other packages and classes. Issue a warning message using \cs*{PackageWarningNoLine}\Marg{cnltx-example}. \command{cnltx\at example\at info}[\marg{message}] Issue a message using \cs*{PackageInfo}\Marg{cnltx-example}. - \command{cnltxat} - Robust command that typesets `\at' with category code 11. An @ in command - names confuses the indexing of the command names. Either one uses another - symbol for makeindex's ``actual'' recognition and also tells - \pkg{idxcmds}~\cite{pkg:idxcmds} about it or one uses \cs{cnltxat} in - \cs{cs} and friends. For the sake of convenience you can define a command - like \cs*{at} that expands to it\footnote{This is important. If you - \cs*{let} it to \cs{cnltxat} index entries may be sorted differently! - Remember: \cs{cnltxat} is robust.}. In order not to overwrite any such - existing macro it is not defined by \cnltxexample. This document for - example defines \verbcode+\def\at{\cnltxat}+. - \command{cnltxletterat} - An alias of \cs{cnltxat}. - \command{cnltxotherat} - The same as \cs{cnltxat} but with a `\at' with category code 12. - \command{cnltxbang} - The same as \cs{cnltxotherat} except that it contains a `\bang'. - \command{cnltxequal} - The same as \cs{cnltxotherat} except that it contains a `\equal'. \command{cnltx\at isvalue} Used in definitions of the key/value option typesetting commands. Inserts a \code{=} with some stretchable space around and a legal break-point @@ -2370,7 +2616,8 @@ the other packages and classes. \changedversion{0.2}Command used to define the argument commands: \verbcode+\newarg\marg{\{}{\}}+. The optional argument determines how the argument of the new command will be formatted. This is done with - \cs{meta} per default. \verbcode+\newarg[\code]\Marg{\{}{\}}+ + \cs{meta} per default. \cs{Marg} is defined + \verbcode+\newarg[\code]\Marg{\{}{\}}+ \command{MakePercentComment} Sets the category code of \code{\%} to 14. \command{cnltx\at copyablespace} @@ -2460,7 +2707,7 @@ as ``silent'' names by \cnltx, that is, those defined by \cnltxlistings. \RaggedRight\listsilentenvs \end{multicols} -\section{List of Entries in \code{cnltx.bib}} +\section{List of Entries in \code{cnltx.bib}}\label{sec:list-entr-bib} Most entries in \code{cnltx.bib} are entries of the \code{@package} type. The cite keys that the file currently contains are listed below. This list is very likely to be extended significantly in the future. 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 + + |