diff options
author | Karl Berry <karl@freefriends.org> | 2022-09-04 20:49:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-09-04 20:49:03 +0000 |
commit | c1a03fd033a3610271af12de9c0035c45cd91321 (patch) | |
tree | 66693490aa1a6215958a466d21d6b9e7ec09ad87 /Master | |
parent | a8ca3a0abe05d07b59ff73e2c6361c53b7979598 (diff) |
democodetools (4sep22)
git-svn-id: svn://tug.org/texlive/trunk@64287 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/democodetools/README.md | 42 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/democodetools/democodetools.pdf | bin | 0 -> 377361 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/democodetools/democodetools.tex | 355 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/democodetools/democodelisting.sty | 522 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/democodetools/democodetools.sty | 340 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpkg-ctan-check | 2 | ||||
-rwxr-xr-x | Master/tlpkg/libexec/ctan2tds | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 | ||||
-rw-r--r-- | Master/tlpkg/tlpsrc/democodetools.tlpsrc | 0 |
9 files changed, 1262 insertions, 1 deletions
diff --git a/Master/texmf-dist/doc/latex/democodetools/README.md b/Master/texmf-dist/doc/latex/democodetools/README.md new file mode 100644 index 00000000000..78da4c8cdcc --- /dev/null +++ b/Master/texmf-dist/doc/latex/democodetools/README.md @@ -0,0 +1,42 @@ +%%%============================================================================== +%% Copyright 2022 by Alceu Frigeri +%% +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% 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 Alceu Frigeri +%% +%% This is version 1.0beta (2022/09/01) +%% +%% +%% This work consists of the files +%% +%% democodelisting.sty set of macros to typeset and demonstrate LaTeX code +%% democodetools.sty set of macros to document LaTeX packages +%% +%% README.md (this file) quick introduction +%% +%% democode.tex LaTeX documentation +%% democode.pdf documentation in PDF form +%% +%%%============================================================================== + +This is 'yet another doc/docx/doc3' package for LaTeX code documetation (and demonstration). +It is designed to be 'as class independent as possible', +meaning: it makes no assumption about page layout (besides 'having a marginpar') or underline macros. +Furthermore, it's assumed that \maketitle and the abstract environment +were modified by the underline class, so alternatives (based on the article class) are provided. + +For more details, see the documentation, democodetools.pdf (source code: democodetools.tex) + +The main idea is to be able to document a package/class loading it first and then this package, +making it possible not only to document the 'syntax' +but also to show the end result 'as is' when using that other specific class/package. diff --git a/Master/texmf-dist/doc/latex/democodetools/democodetools.pdf b/Master/texmf-dist/doc/latex/democodetools/democodetools.pdf Binary files differnew file mode 100644 index 00000000000..9d55a1d6158 --- /dev/null +++ b/Master/texmf-dist/doc/latex/democodetools/democodetools.pdf diff --git a/Master/texmf-dist/doc/latex/democodetools/democodetools.tex b/Master/texmf-dist/doc/latex/democodetools/democodetools.tex new file mode 100644 index 00000000000..41c7a271ae6 --- /dev/null +++ b/Master/texmf-dist/doc/latex/democodetools/democodetools.tex @@ -0,0 +1,355 @@ +%%%============================================================================== +%% Copyright 2022 by Alceu Frigeri +%% +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% 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 Alceu Frigeri +%% +%% This is version 1.0beta (2022/09/01) +%% +%% +%% This work consists of the files +%% +%% democodelisting.sty set of macros to typeset and demonstrate LaTeX code +%% democodetools.sty set of macros to document LaTeX packages +%% +%% README.md quick introduction +%% +%% democodetools.tex LaTeX documentation (this file) +%% democodetools.pdf documentation in PDF form +%% +%%%============================================================================== +\makeatletter +\def\tc@tmp@packname{democodetoolsdoc} +\def\tc@tmp@altpackname{democodetoolsdoc} +\def\tc@tmp@packdesc{Demo Code Tools Documentantion} +\def\tc@tmp@packdate{2022/09/01} +\def\tc@tmp@packversion{1.0beta} +\let\@exp\expandafter +\@exp\edef\csname\tc@tmp@altpackname version\endcsname{\tc@tmp@packversion} +\makeatother + +\documentclass[dctools,english]{ufrgscca} +\usepackage{democodetools} + +\dcTitle{The democodetools and democodelisting Packages - Version \democodetoolsversion} +\dcAuthor{Alceu Frigeri} +\dcDate{September 2022} + +\begin{document} + +\dcMakeTitle + +\begin{dcAbstract} +This is `yet another doc/docx/doc3' package. It is designed to be `as class independent as possible', meaning: it makes no assumption about page layout (besides `having a marginpar') or underline macros. Furthermore, it's assumed that \Macro{\maketitle}{} and the \Key{abstract} environment were modified by the underline class, so alternatives (based on the article class) are provided. The main idea is to be able to document a package/class loading it first and then this, so that it is possible not only to document the `syntax' but also to show the end result `as is' when using that other specific class/package. + +\end{dcAbstract} + +\tableofcontents + +\section{Introduction} +The packages/classes doc/docx/doc3 (and for that matter doctools) where designed to be used with dtx files, which is handy for package developers, as long as one is fine with the `default article' format (which is true most of the time). This came to be from the willingness of having the `new look and feel' used in doc3, but, instead of having to rely on a standard class, being able to use any class as the base one, which allows to `demonstrate the documented commands with the final layout'.\\ + +\Pack{democodelisting} defines a few macros to display and demonstrate \LaTeX~ code verbatim (using \Pack{listings} and \Pack{scontents}), whilst \Pack{democodetools} defines a series of macros to display/enumerate macros and environments (somewhat resembling the \Pack{doc3} style).\\ +\subsection{Current Version} +This doc regards to \Pack{democodelisting} version \democodelistingversion~ and \Pack{democodetools} version \democodetoolsversion. Those two packages are 'usable' but they haven't been thoroughly tested, nor should anyone consider them stable (they might be considered more or less stable but more due the 'maintainer' lack of time than anything else. Use it at your own risk.) + +\section{democodelisting Package} + +It requires two packages: \Pack{listings} and \Pack{scontents}\\ +Defines an environment: \Env{stcode} and\\ + 4 commands: \Macro{\DemoCode}{}, \Macro{\DisplayCode}{}, \Macro{\TabbedDisplayCode}{} and \Macro{\setdclisting}{}. + +\subsection{In Memory Code Storage} +Thanks to \Pack{scontents} (\Pack{expl3} based) it's possible to store \LaTeX~ code snippets in a \Pack{expl3} key. + +\begin{Envs}{stcode} + \begin{Syntax}% + \Macro{\begin{stcode}}[keys]{} \Macro{\end{stcode}}{} + \end{Syntax} +This environment is an alias to \Env{scontents} environment (from \Pack{scontents} package), all \Pack{scontents} keys are valid, with an additional one: \Key{st} which is an alias to the \Key{store-env} key. +The environment body is stored verbatim in the \Key{st} named key. +\end{Envs} + +\subsection{Code Display/Demo} +\begin{Macros}{\DisplayCode,\DemoCode,\TabbedDemoCode} + \begin{Syntax}% + \Macro{\DisplayCode}[dclisting-keys]{st-name} + \Macro{\DemoCode}[dclisting-keys]{st-name} + \Macro{\TabbedDemoCode}[dclisting-keys]{st-name} + \end{Syntax} +\end{Macros} +\Macro{\DisplayCode}{} just typesets \Arg{st-name} (the key-name created with \Env{stcode}), in verbatim mode with syntax highlight.\\ +\Macro{\DemoCode}{} first typesets \Arg{st-name}, as above, then it \emph{executes} said code. +Finally \Macro{\TabbedDemoCode}{} does the same, but typesetting it, and executed code, side by side. N.B. Both typeset and executed code are placed inside a \Env{minipage} so that, when \emph{executing} the code, one can have, for instance, 'normal' paragraph indentation.\\ +For Example: + +\begin{stcode}[st=demostcode] + \begin{stcode}[st=stmeta] + Some \LaTeX~coding, for example: \ldots. +\end{stcode} +This will just typesets \Key{stmeta}: + + \DisplayCode{stmeta} + +and this will demonstrate it, side by side with source code: + +\TabbedDemoCode[numbers=left,codeprefix={inner code},resultprefix={inner result}]{stmeta} +\end{stcode} + +\DemoCode[emph={DisplayCode,TabbedDemoCode},keywd2={stcode}]{demostcode} + +\begin{Macros}{\setdclisting} + \begin{Syntax}% + \Macro{\setdclisting}{dclisting-keys} + \end{Syntax} +Instead of setting/defining \Meta{dclisting-keys} per \Macro{\Demo}{}/\Macro{\Display}{} call, one can set those \emph{globally}, better said, \emph{in the called context group} .\\ +N.B.: All \Macro{\Display}{}/\Macro{\Demo}{} commands create a local group (\Macro{\begingroup}{}) in which the \Meta{dclisting-keys} are defined, and discarded once said local group is closed. \Macro{\setdclisting}{} defines those keys in the \emph{current} context/group (\Macro{\def}{}, \Macro{\edef}{}) +\end{Macros} + +\subsubsection{\Meta{dclisting-keys}} +Using a \Key{key}\,=\Value{value} syntax, one can fine tune \Pack{listings} syntax highlight. +\begin{Args} +\DescribeArg{dclisting-keys} +\begin{Syntax} % + \Keylst{settexcs,settexcs2,settexcs3} + \Keylst{texcs,texcs2,texcs3} + \Keylst{texcsstyle,texcs2style,texcs3style} +\end{Syntax}Those define sets of \LaTeX~commands (csnames), the \Key{set} variants initialize/redefine those sets (an empty list, clears the set), while the others extend those sets. The \Key{style} ones redefines the command display style (an empty \Meta{par} resets the style to it's default).\\ + +\begin{Syntax} % + \Keylst{setkeywd,setkeywd2,setkeywd3} + \Keylst{keywd,keywd2,keywd3} + \Keylst{keywdstyle,keywd2style,keywd3style} +\end{Syntax} +Same for other \emph{keywords} sets.\\ + +\begin{Syntax} % + \Keylst{setemph,setemph2,setemph3} + \Keylst{emph,emph2,emph3} + \Keylst{emphstyle,emph2style,emph3style} +\end{Syntax} +for some extra emphasis sets.\\ + +\begin{Syntax} % + \Keylst{numbers,numberstyle} +\end{Syntax} +\Key{numbers} possible values are \Value{none} (default) and \Value{left} (to add tinny numbers to the left of the listing). With \Key{numberstyle} one can redefine the numbering style.\\ + +\begin{Syntax} % + \Keylst{stringstyle,commentstyle} +\end{Syntax} +to redefine \Key{strings} and \Key{comments} formatting style.\\ + +\begin{Syntax} % + \Key{bckgndcolor} +\end{Syntax} +to change the listing background's color.\\ + +\begin{Syntax} % + \Keylst{codeprefix,resultprefix} +\end{Syntax} +those set the \Key{codeprefix} (default: \LaTeX~Code:) and \Key{resultprefix} (default: \LaTeX~Result:) +\end{Args} + +\section{democodetools Package} + + + + +\subsection{Environments} +\begin{Envs}{Macros,Envs} +\begin{Syntax}% +\Macro{\begin{Macros}}{macrolist} +\Macro{\begin{Envs}}{envlist} +\end{Syntax} +Those are the two main environments to describe \Env{Macros} and \Env{Environments}. Both typeset \Arg{macrolist} (csv list) or \Arg{envlist} (csv list) in the margin. N.B. Each element of the list gets \Macro{\detokenize}{} +\end{Envs} + +\begin{Envs}{Syntax} +\begin{Syntax}% +\Macro{\begin{Syntax}}{} +\end{Syntax} +The \Env{Syntax} environment sets the fontsize and activates \Macro{\obeylines}{}, so one can list macros/cmds/keys use, one per line. + +\begin{stcode}[st=demoD] +\begin{Envs}{Macros,Envs} +\begin{Syntax}% +\Macro{\begin{Macros}}{macrolist} +\Macro{\begin{Envs}}{envlist} +\end{Syntax} +Those are the two main ... +\end{Envs} +\end{stcode} +\DisplayCode{demoD} + +\end{Envs} + + +\begin{Envs}{Args,Keys,Values,Options} +\begin{Syntax}% +\Macro{\begin{Args}}{} +\Macro{\begin{Args+}}{} +\Macro{\begin{Keys}}{} +\Macro{\begin{Keys+}}{} +\Macro{\begin{Values}}{} +\Macro{\begin{Values+}}{} +\Macro{\begin{Options}}{} +\Macro{\begin{Options+}}{} +\end{Syntax} + +Those environments are all the same, starting a dedicated \emph{description list}. Together with the many \Macro{\Description...}{} commands, one can list all \Keylst{Options, Args, Keys, Values} as needed. The \Key{+} form are meant to be used with the \Macro{\Description...+}{} forms, for \emph{in text} lists. The non \Key{+} form are meant to have the many \emph{'descriptors'} in the \emph{margin par}. +\end{Envs} + +\subsection{Describe Commands} +\begin{Macros}{\DescribeMacro} +\begin{Syntax}% +\Macro!{\DescribeMacro}<*!+>{\marg{csname}\oarg{oarglist}\marg{marglist}} +\end{Syntax} +\begin{Args+} +\DescribeKey+{*} typesets the macro name in bold face. +\DescribeKey+{!} \Arg{marglist} is treated as an expandable code, 'as is'. +\DescribeKey+{+} the macro name is typeseted in text. +\DescribeArg+{csname} macro name (\Macro{\detokenize}{}) +\DescribeArg+{oarglist} csv list of optional args. +\DescribeArg+{marglist} csv list of mandatory args. +\end{Args+} +\end{Macros} + +\begin{Macros}{\DescribeArg,\DescribeKey,\DescribeValue,\DescribeOption,\DescribePackage,} +\begin{Syntax}% +\Macro{\DescribeArg}<*+>[type]{arg} +\Macro{\DescribeKey}<*+>[type]{arg} +\Macro{\DescribeValue}<*+>[type]{arg} +\Macro{\DescribeOption}<*+>[type]{arg} +\Macro{\DescribePackage}<*+>[type]{arg} +\end{Syntax} +\begin{Args+} +\DescribeKey+{*} typesets it in bold face. +\DescribeKey+{+} typesets in text (not in marginpar) +\DescribeArg+{type} key/arg/... format +\DescribeArg+{arg} key/arg/... name. +\end{Args+} +\end{Macros} + + +\subsection{Macros Typeset} +\begin{Macros}{\Macro} + \begin{Syntax}% + \Macro!{\Macro}{\marg{csname}\xarg{embl}\oarg{olist}\marg{mlist}} + \Macro!{\Macro}<!>{\marg{csname}\xarg{embl}\marg{par.desc.}} + \end{Syntax} + When describing a macro \Arg{csname} (Command Sequence, csname) the \Arg{olist} and \Arg{mlist} are comma separated lists (csv) of optional and mandatory arguments. \Arg{embl} are optional, single char, 'embellishment' tokens, like {\bfseries * ! +}. Finally, in the {\bfseries !} form, the \Arg{par.desc.} is any text representing the macro parameter list (for non regular, non usual, cases). + + \begin{stcode}[st=demoB] + \Macro + {\Macro}<*!>[opt1,opt2]{arg3} + \Macro! + {\Macro}<!>{\xarg{embl}\marg{par.desc.}} +\end{stcode} + \TabbedDemoCode{demoB} +\end{Macros} + +\subsection{Args Typeset} +\begin{Macros}{\oarg,\marg,\parg,\xarg,\Arg,\Meta} + \begin{Syntax}% + \Macro{\oarg}[type]{arg} + \Macro{\marg}[type]{arg} + \Macro{\parg}[type]{arg} + \Macro{\xarg}[type]{arg} + \Macro{\Arg}[type]{arg} + \Macro{\Meta}{arg} + \end{Syntax} + Those are meant to typeset the diverse kinds of 'command's arguments' (mandatory, optional, parenthesis . . .). \Macro{\Meta{arg}}{} typesets \emph{arg} as \Meta{arg}. + \begin{Args} + \DescribeArg{type} defaults to \Value{Meta} (it's the csname of any valid formatting command, like Meta, textbf, etc.) + \DescribeArg{arg} the argument name itself. + \end{Args} + \begin{stcode}[st=demoA] + \oarg{fam} + \parg{xtra} + \marg[textbf]{text} + \xarg{x-text} +\end{stcode} + \TabbedDemoCode{demoA} +\end{Macros} + +\subsection{Keys Typeset} +\begin{Macros}{\Key,\Keylst,\KeyUse} + \begin{Syntax}% + \Macro{\Key}[pre]{key} + \Macro{\Keylst}[default]{keylst} + \Macro{\KeyUse}{key}{value} + \end{Syntax} + To typeset a \Arg{Key} or \Arg{keylst} (csv list). \Arg{pre} is just prepended to \Arg{key} whilst \Arg{default} is the default key value. \Macro{\KeyUse}{} is just a short-cut for a, possible, common construction. + + \begin{stcode}[st=demoC] + \Key{Akey} + + \Keylst[Bkey]{Akey,Bkey} + + \KeyUse{keyA}{arg} +\end{stcode} + \TabbedDemoCode{demoC} + +\end{Macros} + +\begin{Macros}{\Env,\Pack,\Value} + \begin{Syntax}% + \Macro{\Env}[pre]{key} + \Macro{\Pack}[pre]{key} + \Macro{\Value}[pre]{key} + \end{Syntax} + Similar to \Macro{\Key}{} above, they will typeset a \Arg{Key}. \Arg{pre} is just prepended to \Arg{key} whilst \Arg{default} is the default key value. + + +\end{Macros} + + +\subsection{Others} +\begin{Macros}{\MetaFmt} + \begin{Syntax}% + \Macro{\MetaFmt}<*>[type]{} + \end{Syntax} +It sets the font size, series, face as defined by \Meta{type}, \Meta{type} being one of \Keylst{Oarg,Marg,Parg,Xarg,Macro,Code,Key,KeyVal,Option,Value,Default}. The star version uses bold. +\end{Macros} + + +\begin{Macros}{\MarginNote} + \begin{Syntax}% + \Macro{\MarginNote}{text} + \end{Syntax} +As the name implies, to add small margin notes. +\end{Macros} + + +\begin{Macros}{\dcAuthor,\dcDate,\dcTitle,\dcMakeTitle} + \begin{Syntax}% + \Macro{\dcAuthor}{name} + \Macro{\dcDate}{date} + \Macro{\dcTitle}{title} + \Macro{\dcMakeTitle}{} + \end{Syntax} +Those allow one to define (as in standard article, book, report classes) the document \emph{author}, \emph{date} and \emph{date} \Macro{\dcMakeTitle}{} will write a typical title+author heading (as in the article class). +\end{Macros} + +\begin{Envs}{dcAbstract} + \begin{Syntax}% + \Macro{\begin{dcAbstract}}{} \Macro{\end{dcAbstract}}{} + \end{Syntax} +Same as above, for the abstract. +\end{Envs} + + + + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/democodetools/democodelisting.sty b/Master/texmf-dist/tex/latex/democodetools/democodelisting.sty new file mode 100644 index 00000000000..21e74cac82f --- /dev/null +++ b/Master/texmf-dist/tex/latex/democodetools/democodelisting.sty @@ -0,0 +1,522 @@ +%%%============================================================================== +%% Copyright 2022 by Alceu Frigeri +%% +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% 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 Alceu Frigeri +%% +%% This is version 1.0beta (2022/09/01) +%% +%% +%% This work consists of the files +%% +%% democodelisting.sty set of macros to typeset and demonstrate LaTeX code +%% democodetools.sty set of macros to document LaTeX packages +%% +%% README.md quick introduction +%% +%% democodetools.tex LaTeX documentation +%% democodetools.pdf documentation in PDF form +%% +%%%============================================================================== +\NeedsTeXFormat{LaTeX2e}[2022/06/01] +\def\tc@tmp@packname{democodelisting} +\def\tc@tmp@altpackname{democodelisting} +\def\tc@tmp@packdesc{Demo Code Listing} +\def\tc@tmp@packdate{2022/09/01} +\def\tc@tmp@packversion{1.0beta} +\let\@exp\expandafter +\@exp\edef\csname\tc@tmp@altpackname version\endcsname{\tc@tmp@packversion} +\@exp\@exp\@exp\ProvidesPackage\@exp\@exp\@exp{\@exp\tc@tmp@packname\@exp}\@exp[\tc@tmp@packdate\space v\tc@tmp@packversion\space\tc@tmp@packdesc] + +\RequirePackage{listings} +\RequirePackage{scontents} + +\newlength{\dc@demo@parindent} +\newlength{\dc@org@parindent} +\setlength\dc@org@parindent{\parindent} +\setlength\parindent{0pt} + + +\colorlet{dc@lightcyan}{white!97!cyan} +\colorlet{dc@lightgray}{white!97!black} +\definecolor{dc@grayblack}{rgb}{0.8,0.8,0.8} + +\colorlet{dc@darkgreen}{green!45!black!100} +\colorlet{dc@darkteal}{teal!45!black!100} +\colorlet{dc@darkblue}{blue!40!black!100} +\colorlet{dc@darkred}{red!45!black!100} + +\colorlet{dc@blueishblack}{blue!75!black!100} +\colorlet{dc@reddishblack}{red!60!black!100} +\colorlet{dc@greenishblack}{green!45!black!100} + +\def\dc@lstbckgndcolordefault{dc@lightgray}% +\def\dc@lststringcolordefault{dc@darkteal} +\def\dc@lstcommentcolordefault{dc@darkgreen} +\def\dc@lsttexcscolordefault{dc@darkblue} +\def\dc@lstkeywdcolordefault{dc@darkblue} + +\def\dc@lsttexcsBcolordefault{dc@blueishblack} +\def\dc@lstkeywdBcolordefault{dc@greenishblack} +\def\dc@lstemphcolordefault{dc@reddishblack} + +\colorlet{dc@lstnumbercolordefault}{white!50!black!100} + +\def\dc@lstrulecolordefault{gray} +\def\dc@lstnumbercolordefault{gray} + +\DeclareKeys[dclisting]{ + settexcs.usage = general, + settexcs.code = {\ifblank{#1}{\def\dc@lsttexcs{}}{\def\dc@lsttexcs{#1}}}, + texcs.usage = general, + texcs.code = {\ifblank{#1}{}{\edef\dc@lsttexcs{\dc@lsttexcs,#1}}}, + texcsstyle.usage = general, + texcsstyle.code = {\ifblank{#1}{\def\dc@lsttexcsstyle{\bfseries\color{\dc@lsttexcscolordefault}}}{\def\dc@lsttexcsstyle{#1}}}, + + settexcs2.usage = general, + settexcs2.code = {\ifblank{#1}{\def\dc@lsttexcsB{}}{\def\dc@lsttexcsB{#1}}}, + texcs2.usage = general, + texcs2.code = {\ifblank{#1}{}{\edef\dc@lsttexcsB{\dc@lsttexcsB,#1}}}, + texcs2style.usage = general, + texcs2style.code = {\ifblank{#1}{\def\dc@lsttexcsBstyle{\bfseries\color{\dc@lsttexcsBcolordefault}}}{\def\dc@lsttexcsBstyle{#1}}}, + + settexcs3.usage = general, + settexcs3.code = {\ifblank{#1}{\def\dc@lsttexcsC{}}{\def\dc@lsttexcsC{#1}}}, + texcs3.usage = general, + texcs3.code = {\ifblank{#1}{}{\edef\dc@lsttexcsC{\dc@lsttexcsC,#1}}}, + texcs3style.usage = general, + texcs3style.code = {\ifblank{#1}{\def\dc@lsttexcsCstyle{\bfseries\color{\dc@lsttexcsBcolordefault}}}{\def\dc@lsttexcsCstyle{#1}}}, + + setkeywd.usage = general, + setkeywd.code = {\ifblank{#1}{\def\dc@lstkeywd{}}{\def\dc@lstkeywd{#1}}}, + keywd.usage = general, + keywd.code = {\ifblank{#1}{}{\edef\dc@lstkeywd{\dc@lstkeywd,#1}}}, + keywdstyle.usage = general, + keywdstyle.code = {\ifblank{#1}{\def\dc@lstkeywdstyle{\bfseries\color{\dc@lstkeywdcolordefault}}}{\def\dc@lstkeywdstyle{#1}}}, + + setkeywd2.usage = general, + setkeywd2.code = {\ifblank{#1}{\def\dc@lstkeywdB{}}{\def\dc@lstkeywdB{#1}}}, + keywd2.usage = general, + keywd2.code = {\ifblank{#1}{}{\edef\dc@lstkeywdB{\dc@lstkeywdB,#1}}}, + keywd2style.usage = general, + keywd2style.code = {\ifblank{#1}{\def\dc@lstkeywdBstyle{\bfseries\color{\dc@lstkeywdBcolordefault}}}{\def\dc@lstkeywdBstyle{#1}}}, + + setkeywd3.usage = general, + setkeywd3.code = {\ifblank{#1}{\def\dc@lstkeywdC{}}{\def\dc@lstkeywdC{#1}}}, + keywd3.usage = general, + keywd3.code = {\ifblank{#1}{}{\edef\dc@lstkeywdC{\dc@lstkeywdC,#1}}}, + keywd3style.usage = general, + keywd3style.code = {\ifblank{#1}{\def\dc@lstkeywdCstyle{\bfseries\color{\dc@lstkeywdBcolordefault}}}{\def\dc@lstkeywdCstyle{#1}}}, + + setemph.usage = general, + setemph.code = {\ifblank{#1}{\def\dc@lstemph{}}{\def\dc@lstemph{#1}}}, + emph.usage = general, + emph.code = {\ifblank{#1}{}{\edef\dc@lstemph{\dc@lstemph,#1}}}, + emphstyle.usage = general, + emphstyle.code = {\ifblank{#1}{\def\dc@lstemphstyle{\bfseries\color{\dc@lstemphcolordefault}}}{\def\dc@lstemphstyle{#1}}}, + + setemph2.usage = general, + setemph2.code = {\ifblank{#1}{\def\dc@lstemphB{}}{\def\dc@lstemphB{#1}}}, + emph2.usage = general, + emph2.code = {\ifblank{#1}{}{\edef\dc@lstemphB{\dc@lstemphB,#1}}}, + emph2style.usage = general, + emph2style.code = {\ifblank{#1}{\def\dc@lstemphBstyle{\bfseries\color{\dc@lstemphcolordefault}}}{\def\dc@lstemphBstyle{#1}}}, + + setemph3.usage = general, + setemph3.code = {\ifblank{#1}{\def\dc@lstemphC{}}{\def\dc@lstemphC{#1}}}, + emph3.usage = general, + emph3.code = {\ifblank{#1}{}{\edef\dc@lstemphC{\dc@lstemphC,#1}}}, + emph3style.usage = general, + emph3style.code = {\ifblank{#1}{\def\dc@lstemphCstyle{\bfseries\color{\dc@lstemphcolordefault}}}{\def\dc@lstemphCstyle{#1}}}, + + stringstyle.usage = general, + stringstyle.code = {\ifblank{#1}{\def\dc@lststringstyle{\color{\dc@lststringcolordefault}}}{\def\dc@lststringstyle{#1}}}, + + commentstyle.usage = general, + commentstyle.code = {\ifblank{#1}{\def\dc@lstcommentstyle{\color{\dc@lstcommentcolordefault}}}{\def\dc@lstcommentstyle{#1}}}, + + bckgndcolor.usage = general, + bckgndcolor.code = {\ifblank{#1}{\def\dc@lstbckgndcolor{\color{\dc@lstbckgndcolordefault}}}{\def\dc@lstbckgndcolor{#1}}}, + + rulecolor.usage = general, + rulecolor.code = {\ifblank{#1}{\def\dc@lstrulecolor{\color{\dc@lstrulecolordefault}}}{\def\dc@lstrulecolor{#1}}}, + + numbers.usage = general, + numbers.code = {\ifblank{#1}{\def\dc@lstnumbers{none}}{\def\dc@lstnumbers{#1}}}, + + numberstyle.usage = general, + numberstyle.code = {\ifblank{#1}{\def\dc@lstnumberstyle{\tiny\color{\dc@lstnumbercolordefault}}}{\def\dc@lstnumberstyle{#1}}}, + + parindent.usage = general, + parindent.code = {\setlength\dc@demo@parindent{\parindent}\setdcpar{#1}}, + + default.usage = general, + default.code = {\dc@lstkeysdefault}, +} +\NewDocumentCommand{\setdclisting}{m}{\SetKeys[dclisting]{#1}} +\NewDocumentCommand{\dc@lstkeysdefault}{}{% + \setdclisting{% + settexcs,texcsstyle,settexcs2,texcs2style,settexcs3,texcs3style,% + setkeywd,keywdstyle,setkeywd2,keywd2style,setkeywd3,keywd3style,% + setemph,emphstyle,setemph2,emph2style,setemph3,emph3style,% + stringstyle,commentstyle,bckgndcolor,rulecolor,% + numbers,numberstyle,% + }% +} +\setdclisting{default} + +\DeclareKeys[dcpar]{ + org.usage = general, + org.code = {\setlength\dc@demo@parindent\dc@org@parindent}, + default.usage = general, + default.code = {\setlength\dc@demo@parindent\parindent}, +} +\DeclareUnknownKeyHandler[dcpar]{\ifblank{#1}{\setlength\dc@demo@parindent\dc@org@parindent}{\setlength\dc@demo@parindent{#1}}} + +\NewDocumentCommand{\setdcpar}{m}{\SetKeys[dcpar]{#1}} + +\DeclareKeys[dclisting]{ + codeprefix.usage = general, + codeprefix.code = {\ifblank{#1}{\def\dc@codeprefix{\LaTeX~Code:}}{\def\dc@codeprefix{#1}}}, + + resultprefix.usage = general, + resultprefix.code = {\ifblank{#1}{\def\dc@resultprefix{\LaTeX~Result:}}{\def\dc@resultprefix{#1}}}, + + defaulttools.usage = general, + defaulttools.code = {\SetKeys[dclisting]{codeprefix,resultprefix}} , +} +%\DeclareUnknownKeyHandler[dclisting]{\setdclisting{#1={#2}}} + +%\NewDocumentCommand{\setdctools}{m}{\SetKeys[dctools]{#1}} +\SetKeys[dclisting]{defaulttools} + + + +%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%% +%%% +%%% From doctools.dtx file +%%% lstlistings 'definitions' +%%% +%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%% + +%%% listings +% +\lstdefinestyle{lstStyleDefault}{ +%%% appearance + ,basicstyle=\small\ttfamily % Standardschrift +%%% Space and placement + ,floatplacement=tbp % is used as float place specifier + ,aboveskip=\medskipamount % define the space above and + ,belowskip=\medskipamount % below displayed listings. + ,lineskip=0pt % specifies additional space between lines in listings. + ,boxpos=c % c,b,t +%%% The printed range + ,showlines=false % prints empty lines at the end of listings +%%% characters + ,extendedchars=true % allows or prohibits extended characters + % in listings, that means (national) + % characters of codes 128-255. + ,upquote=true % determines printing of quotes + ,tabsize=2, % chars of tab + ,showtabs=false % do not show tabs + ,showspaces=false % do not show spaces + ,showstringspaces=false % do not show blank spaces in string +%%% Line numbers + ,numbers=none % left, right, none +%%% Captions + ,numberbychapter=true % + ,captionpos=b % t,b + ,abovecaptionskip=\smallskipamount % the vertical space respectively above + ,belowcaptionskip=\smallskipamount % or below each caption +%%% Margins and line shape + ,linewidth=\linewidth % defines the base line width for listings. + ,xleftmargin=0pt % extra margins + ,xrightmargin=0pt % + ,resetmargins=false % indention from list environments like enumerate + % or itemize is reset, i.e. not used. + ,breaklines=true % line breaking of long lines. + ,breakatwhitespace=false % allows line breaks only at white space. + ,breakindent=0pt % is the indention of the second, third, ... + % line of broken lines. + ,breakautoindent=true % apply intendation + ,columns=flexible % + ,keepspaces=true % +} + + +\lstdefinestyle{lstDocStyleBase}{ +%%% base style +% + ,style=lstStyleDefault +%%% appearance + ,commentstyle=\slshape +%%% Line numbers + ,numbers=left % left, right, none + ,stepnumber=1 % seperation between numbers + ,numberfirstline=false % number first line always + ,numberstyle={\dc@lstnumberstyle} % style of numbers + ,numbersep=5pt % distance to text + ,numberblanklines=true % +%%% language + ,language = [LaTeX]TeX +%%% commands + % LaTeX programming + ,moretexcs={setlength,usepackage,newcommand,renewcommand,providecommand,RequirePackage,SelectInputMappings,ifpdftex,ifpdfoutput,AtBeginEnvironment,ProvidesPackage}, + % other commands + ,moretexcs={maketitle,text,includegraphics,chapter,section,subsection, + subsubsection,paragraph,textmu,enquote,blockquote,ding,mathds,ifcsdef,Bra,Ket,Braket,subcaption,lettrine,mdfsetup,captionof,listoffigures,listoftables,tableofcontents,appendix} + % tables + ,moretexcs={newcolumntype,rowfont,taburowcolors,rowcolor,rowcolors,bottomrule, + toprule,midrule,} + % hyperref + ,moretexcs={hypersetup} + % glossaries + ,moretexcs={gls,printglossary,glsadd,newglossaryentry,newacronym} + % Koma + ,moretexcs={mainmatter,frontmatter,geometry,KOMAoptions,setkomafont,addtokomafont} + % SI, unit + ,moretexcs={si,SI,sisetup,unit,unitfrac,micro} + % biblatex package + ,moretexcs={newblock,ExecuteBibliographyOptions,addbibresource} + % math packages + ,moretexcs={operatorname,frac,sfrac,dfrac,DeclareMathOperator,mathcal,underset} + % demo package + ,moretexcs={democodefile,package,cs,command,env,DemoError,PrintDemo} + % tablestyles + ,moretexcs={theadstart,tbody,tsubheadstart,tsubhead,tend} + % code section package + ,moretexcs={DefineCodeSection,SetCodeSection,BeginCodeSection, + EndCodeSection} + % template tools package + ,moretexcs={IfDefined,IfUndefined,IfElseDefined,IfElseUndefined,IfMultDefined,IfNotDraft,IfNotDraftElse,IfDraft,IfPackageLoaded,IfElsePackageLoaded,IfPackageNotLoaded,IfPackagesLoaded,IfPackagesNotLoaded,ExecuteAfterPackage,ExecuteBeforePackage,IfTikzLibraryLoaded,IfColumntypeDefined,IfColumntypesDefined,IfColorDefined,IfColorsDefined,IfMathVersionDefined,SetTemplateDefinition,UseDefinition,IfFileExists,iflanguage} + % tablestyles + ,moretexcs={setuptablefontsize,tablefontsize,setuptablestyle,tablestyle, setuptablecolor,tablecolor,disablealternatecolors, tablealtcolored,tbegin,tbody,tend,thead, theadstart,tsubheadstart,tsubhead,theadrow,tsubheadrow,resettablestyle,theadend,tsubheadend,tableitemize,PreserveBackslash} + % todonotes + ,moretexcs={todo,missingfigure} + % listings + ,moretexcs={lstloadlanguages,lstdefinestyle,lstset} + % index + ,moretexcs={indexsetup} + % glossaries + ,moretexcs={newglossarystyle,glossarystyle,deftranslation,newglossary} + % tikz + ,moretexcs={usetikzlibrary} + % color + ,moretexcs={definecolor,colorlet} + % caption + ,moretexcs={captionsetup,DeclareCaptionStyle} + % floatrow + ,moretexcs={floatsetup} + % doc.sty + ,moretexcs={EnableCrossrefs,DisableCrossrefs,PageIndex,CodelineIndex,CodelineNumbered} + % refereces + ,moretexcs={cref,Cref,vref,eqnref,figref,tabref,secref,chapref} +} + +%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%% +%%% +%%% From doctools.dtx file +%%% lstlistings 'definitions' +%%% +%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%% + + + +\lstloadlanguages{[LaTeX]TeX} +\lstdefinestyle{codestyle}{ +%%% base style + style=lstDocStyleBase, + language=[LaTeX]{TeX}, + numbers=none,%{\dc@lstnumbers},% + %%% colors + rulecolor={\dc@lstrulecolor}, + backgroundcolor={\dc@lstbckgndcolor},% + stringstyle={\dc@lststringstyle}, + commentstyle={\dc@lstcommentstyle}, + framerule=0pt,%0.4pt, + nolol=true, + frame=none, + aboveskip=-2ex, + belowskip=-2ex, + basicstyle=\footnotesize\ttfamily , % Standardschrift + rulesep = 0pt, + breaklines=true, + breakindent=3em, + moretexcs={\dc@lsttexcs}, + moretexcs=[2]{\dc@lsttexcsB}, + moretexcs=[3]{\dc@lsttexcsC}, + texcsstyle=*{\dc@lsttexcsstyle}, + texcsstyle=*[2]{\dc@lsttexcsBstyle}, + texcsstyle=*[3]{\dc@lsttexcsCstyle}, + morekeywords={\dc@lstkeywd}, + morekeywords=[2]{\dc@lstkeywdB}, + morekeywords=[3]{\dc@lstkeywdC}, + keywordstyle={\dc@lstkeywdstyle}, + keywordstyle=[2]{\dc@lstkeywdBstyle}, + keywordstyle=[3]{\dc@lstkeywdCstyle}, + emph={\dc@lstemph}, + emph=[2]{\dc@lstemphB}, + emph=[3]{\dc@lstemphC}, + emphstyle={\dc@lstemphstyle}, + emphstyle=[2]{\dc@lstemphBstyle}, + emphstyle=[3]{\dc@lstemphCstyle}, +} +\lstset{style=codestyle} + +%%% +%%% Using scontents package !!!! +%%% +\ExplSyntaxOn +\keys_define:nn { scontents / scontents} + { + st.meta:nn = { scontents } { store-env = #1 }, + st.value_required:n = true + } +\ExplSyntaxOff + +\newenvsc{stcode} +\let\verbatimsc\@undefined +\let\verbatimsc@\@undefined +\let\endverbatimsc\@undefined +\lstnewenvironment{verbatimsc}{\lstset{style=codestyle}}{} + + +\NewDocumentEnvironment{verbsc}{m}{% + \let\verbatimsc\@undefined + \let\verbatimsc@\@undefined + \let\endverbatimsc\@undefined + \setdclisting{#1} + \edef\dc@tmp{style=codestyle,moretexcs={\dc@lsttexcs},moretexcs=[2]{\dc@lsttexcsB},moretexcs=[3]{\dc@lsttexcsC},% + morekeywords={\dc@lstkeywd},morekeywords=[2]{\dc@lstkeywdB},morekeywords=[3]{\dc@lstkeywdC},% + emph={\dc@lstemph},emph=[2]{\dc@lstemphB},emph=[3]{\dc@lstemphC},% + numbers={\dc@lstnumbers}} + \lstnewenvironment{verbatimsc}{\expandafter\lstset\expandafter{\dc@tmp}}{} +}{% +} + +\NewDocumentCommand{\DisplayCodeB}{O{}m}{% + {% + \begin{verbsc}{#1}% + \begin{tabular}{J{.98\textwidth}}\dc@codeprefix \\ + \typestored{#2}% + \end{tabular}% + \end{verbsc}% + }% +} + +\NewDocumentCommand{\DemoCodeB}{O{}m}{{% + \setlength\parindent\dc@org@parindent + \begin{verbsc}{#1}% + \begin{tabular}{J{.98\textwidth}}% + \dc@codeprefix \\% + \typestored{#2}\\% + \end{tabular}% + + \begin{tabular}{J{.98\textwidth}}% + \dc@resultprefix \\\hline\\[-1ex]% + \getstored{#2}\\\hline% + \end{tabular}% + \end{verbsc}% +}} + +\NewDocumentCommand{\TabbedDemoCodeB}{O{}m}{{% + \setlength\parindent\dc@org@parindent + \begin{verbsc}{#1}% + \arrayrulecolor{gray} + \begin{tabular}{J{.49\textwidth}@{}J{.49\textwidth}}% + \dc@codeprefix & \dc@resultprefix\\\hline\\[-1ex]% + \typestored{#2} & \getstored{#2}\\\hline% + \end{tabular}% + \end{verbsc}% +}} + + +\NewDocumentCommand{\DisplayCode}{O{}m}{{% + \begin{verbsc}{#1}% + \vspace*{0.5ex} + \begin{minipage}{1\textwidth}\dc@codeprefix \\ + \typestored{#2}% + \end{minipage}% + \\[1.5ex]% + \end{verbsc}% +}} + +\NewDocumentCommand{\DemoCode}{O{}mO{1ex}}{{% + \begin{verbsc}{#1}% + \vspace*{1ex} + \begin{minipage}{1\textwidth}\dc@codeprefix \\ + \typestored{#2}% + \end{minipage}% + \\[3ex] + \begin{minipage}{1\textwidth}% + \dc@resultprefix \\[-1.5ex]% + \rule{\textwidth}{0.2pt}\vspace*{0.75ex}% + \setlength\parindent\dc@demo@parindent% + + \getstored{#2}% + \end{minipage}% + \\[#3]% + \rule{1\textwidth}{0.2pt}%\vspace*{0.25ex} + \end{verbsc}% +}} + +\NewDocumentCommand{\TabbedDemoCode}{O{}mO{1ex}}{{% + \begin{verbsc}{#1}% + \begin{minipage}{.5\textwidth}% + \dc@codeprefix% + \end{minipage}% + \begin{minipage}{.5\textwidth}% + \dc@resultprefix% + \end{minipage}\\[-1.5ex]% + \rule{\textwidth}{0.2pt}\vspace*{1ex}% + + \begin{minipage}{.5\textwidth}\vspace*{2ex}% + \typestored{#2}\vspace*{1.5ex}% + \end{minipage}% + \begin{minipage}{.5\textwidth}% + \setlength\parindent\dc@demo@parindent% + \getstored{#2}% + \end{minipage}% + \\[#3]% + \rule{1\textwidth}{0.2pt}%\vspace*{0.5ex} + \end{verbsc}% +}} +%%% +%%% Using scontents package !!!! +%%% + + +%%% +%%% from https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings#Encoding_issue +\lstset{literate= + {á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1 + {Á}{{\'A}}1 {É}{{\'E}}1 {Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1 + {à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1 {ù}{{\`u}}1 + {À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1 + {ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1 + {Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1 + {â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1 + {Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1 + {ã}{{\~{a}}}1 {õ}{{\~{o}}}1 + {Ã}{{\~{A}}}1 {Õ}{{\~{O}}}1 + {ý}{{\'{y}}}1 {Ý}{{\'{Y}}}1 {ÿ}{{\"{y}}}1 {Ÿ}{{\"{Y}}}1 + {œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1 + {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1 + {€}{{\EUR}}1 {£}{{\pounds}}1 +} + +\endinput diff --git a/Master/texmf-dist/tex/latex/democodetools/democodetools.sty b/Master/texmf-dist/tex/latex/democodetools/democodetools.sty new file mode 100644 index 00000000000..f5d613ee313 --- /dev/null +++ b/Master/texmf-dist/tex/latex/democodetools/democodetools.sty @@ -0,0 +1,340 @@ +%%%============================================================================== +%% Copyright 2022 by Alceu Frigeri +%% +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% 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 Alceu Frigeri +%% +%% This is version 1.0beta (2022/09/01) +%% +%% +%% This work consists of the files +%% +%% democodelisting.sty set of macros to typeset and demonstrate LaTeX code +%% democodetools.sty set of macros to document LaTeX packages +%% +%% README.md quick introduction +%% +%% democodetools.tex LaTeX documentation +%% democodetools.pdf documentation in PDF form +%% +%%%============================================================================== +\NeedsTeXFormat{LaTeX2e}[2022/06/01] +\def\tc@tmp@packname{democodetools} +\def\tc@tmp@altpackname{democodetools} +\def\tc@tmp@packdesc{Demo Code Tools} +\def\tc@tmp@packdate{2022/09/01} +\def\tc@tmp@packversion{1.0beta} +\let\@exp\expandafter +\@exp\edef\csname\tc@tmp@altpackname version\endcsname{\tc@tmp@packversion} +\@exp\@exp\@exp\ProvidesPackage\@exp\@exp\@exp{\@exp\tc@tmp@packname\@exp}\@exp[\tc@tmp@packdate\space v\tc@tmp@packversion\space\tc@tmp@packdesc] + +\RequirePackage{democodelisting} + + + + +\setdclisting{settexcs2={Macro,Arg,xarg,oarg,marg,parg,Key,Keylst,DescribeMacro,DescribeKey,DescribeValue,DescribeOption,DescribeArg},setkeywd2={Envs,Macros,Args,Syntax,Keys,Values,Options}} + + +\def\dc@keyvaluestr{Value} +\def\dc@keyvaluemeanstr{Meaning} +\def\dc@keydefaultstr{Default} +\def\dc@csfontsize{\small} + + +\NewDocumentCommand{\MarginNote}{+m}{\marginpar{{\scriptsize\hfill#1}}} + + +%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%% +\DeclareDocumentCommand{\Meta}{m}{\ensuremath\langle#1\ensuremath\rangle} + +%%% +%%% In text arg +%%% +\gdef\dc@ArgHack{} +\NewDocumentCommand{\dc@arg}{st+O{Code}O{}mmm}{{\MetaFmt[#3]{\dc@ArgHack#5\csname #4\endcsname{{\IfBooleanT{#1}{\bfseries}\IfBooleanTF{#2}{#6}{\detokenize{#6}}}}#7}}\gdef\dc@ArgHack{\,}} +\NewDocumentCommand{\oarg}{O{Meta}m}{\dc@arg+[Oarg][#1]{[}{#2}{]}} +\NewDocumentCommand{\marg}{O{Meta}m}{\dc@arg+[Marg][#1]{\{}{#2}{\}}} +\NewDocumentCommand{\parg}{O{Meta}m}{\dc@arg+[Parg][#1]{(}{#2}{)}} +\NewDocumentCommand{\xarg}{O{Meta}m}{\dc@arg+[Xarg][#1]{<}{#2}{>}} +\NewDocumentCommand{\Arg}{m}{\def\dc@ArgHack{}\dc@arg+[Marg][Meta]{}{#1}{}} + +\NewDocumentCommand{\dc@x}{O{}O{}m}{#1\dc@arg+[#2][]{}{#3}{}}% single mandatory value => \dc@arg +\NewDocumentCommand{\dc@xhack}{O{}m}{\dc@x[\dc@XHack][#1]{#2}\def\dc@XHack{\,, }}% single mandatory value => \dc@arg +\NewDocumentCommand{\dc@xlst}{O{}O{}m}{\gdef\dc@ArgHack{}\def\dc@XHack{}\forcsvlist{\dc@xhack[#2]}{#3}\ifblank{#1}{}{\hfill\dc@keydefaultstr:~{\bfseries\Key{#1}}}}%single KEY... LIST of ValueS... default Value (if any) + + +\NewDocumentCommand{\Key}{O{}m}{\dc@x[#1][Value]{#2}} +\NewDocumentCommand{\Keylst}{O{}m}{\dc@xlst[#1][Value]{#2}} + +\NewDocumentCommand{\KeyUse}{mm}{\Key{#1}\space $=$ \Meta{#2}} + + +\NewDocumentCommand{\Env}{O{}m}{\dc@x[#1][Env]{#2}} +\NewDocumentCommand{\Envlst}{O{}m}{\dc@xlst[#1][Env]{#2}} + +\NewDocumentCommand{\Pack}{O{}m}{\dc@x[#1][Pack]{#2}} +\NewDocumentCommand{\Packlst}{O{}m}{\dc@xlst[#1][Pack]{#2}} + +\NewDocumentCommand{\Value}{O{}m}{\dc@x[#1][Value]{#2}} +\NewDocumentCommand{\Valuelst}{O{}m}{\dc@xlst[#1][Value]{#2}} + +\NewDocumentCommand{\Option}{O{}m}{\dc@x[#1][Option]{#2}} +\NewDocumentCommand{\Optionlst}{O{}m}{\dc@xlst[#1][Option]{#2}} + + +%%% +%%% In text macro +%%% +\NewDocumentCommand{\Macro}{t!mD<>{}O{}m}{{\MetaFmt[Code]{\expandafter\zap@space\detokenize{#2#3} \@empty}}\IfBooleanTF{#1}{#5}{\gdef\dc@ArgHack{\,}\forcsvlist{\oarg}{#4}\forcsvlist{\marg}{#5}}}% + + +\NewDocumentCommand{\dc@Describe}{st+O{Key}O{Meta}m}{% + \IfBooleanTF{#2}% + {\item[{\dc@arg+[#3][#4]{}{#5}{}}]}% + {\item[]~\hspace{-0.6675em}\IfBooleanTF{#1}% + {\dc@margincode*+[#3]{{\dc@arg+[#3][#4]{}{#5}{}}}}% + {\dc@margincode+[#3]{{\dc@arg+[#3][#4]{}{#5}{}}}}}% +}% + +\NewDocumentCommand{\DescribeArg}{st+O{Key}m}{% + \IfBooleanTF{#2}% + {\dc@Describe+[#3][Meta]{#4}}% + {\IfBooleanTF{#1}% + {\dc@Describe*[#3][Meta]{#4}}% + {\dc@Describe[#3][Meta]{#4}}}% +}% +\NewDocumentCommand{\DescribeKey}{st+O{Key}m}{% + \IfBooleanTF{#2}% + {\dc@Describe+[#3][]{#4}}% + {\IfBooleanTF{#1}% + {\dc@Describe*[#3][]{#4}}% + {\dc@Describe[#3][]{#4}}}% +}% +\let\DescribeValue\DescribeKey +\let\DescribeOption\DescribeKey +\let\DescribePackage\DescribeKey + +\NewDocumentCommand{\DescribeMacro}{st!t+mO{}m}{% + \IfBooleanTF{#3}% + {\item[{\Macro{#4}{}}]}% + {\item[]~\hspace{-0.6675em}\IfBooleanTF{#1}% + {\dc@margincode*{#4}}% + {\dc@margincode{#4}}}\IfBooleanTF{#2}{{\Macro!{}[]{#6}}}{{\Macro{}[#5]{#6}}}% +}% + +\SetEnumitemKey{marginlst}{leftmargin=0mm,labelindent=0mm,listparindent=0mm,labelwidth=0mm,labelsep=0mm} +\SetEnumitemKey{intextlst}{leftmargin=7.5mm,labelindent=0mm,listparindent=0mm,labelwidth=20mm,labelsep=2.5mm} + +\NewDocumentCommand{\dc@margincode}{st+O{Code}m}{\ifvmode\leavevmode\else\fi{\marginpar{\raggedleft\MetaFmt[#3]{\IfBooleanT{#1}{\bfseries}\vspace{-1.35ex}\IfBooleanTF{#2}{#4}{\expandafter\zap@space\detokenize{#4} \@empty}\vspace{0.3ex}}}}} + +\NewDocumentEnvironment{Macros}{m}{% + \ifvmode\vspace{1ex}\leavevmode\else\fi{\marginpar{\vspace*{-1.755ex}~\color{gray}\hrule\vspace{0.3ex}}\forcsvlist\dc@margincode{#1}\marginpar{\vspace{-1.1ex}~\color{gray}\hrule}}% + }{} + \NewDocumentEnvironment{Envs}{m}{\begin{Macros}{#1}}{\end{Macros}}% + +\NewDocumentEnvironment{Syntax}{}{\begingroup\setlength{\parindent}{0pt}\obeylines\hspace{-0.382em}\dc@csfontsize}{\endgroup} + +\NewDocumentEnvironment{Args}{}{\begin{description}[nosep,marginlst]\vspace{0.5ex}}{\end{description}} +\NewDocumentEnvironment{Args+}{}{\begin{description}[nosep,intextlst]\vspace{0.5ex}}{\end{description}} +\NewDocumentEnvironment{Keys}{}{\begin{Args}}{\end{Args}} +\NewDocumentEnvironment{Keys+}{}{\begin{Args+}}{\end{Args+}} +\NewDocumentEnvironment{Values}{}{\begin{Args}}{\end{Args}} +\NewDocumentEnvironment{Values+}{}{\begin{Args+}}{\end{Args+}} +\NewDocumentEnvironment{Options}{}{\begin{Args}}{\end{Args}} +\NewDocumentEnvironment{Options+}{}{\begin{Args+}}{\end{Args+}} + + +%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%% + + +\colorlet{dc@ColorCode}{blue!40!black} +\colorlet{dc@ColorMacro}{blue!40!black} +\colorlet{dc@ColorMarg}{gray!60!black} +\colorlet{dc@ColorOarg}{gray!90!black} +\colorlet{dc@ColorParg}{gray!60!black} +\colorlet{dc@ColorXarg}{gray!60!black} +\colorlet{dc@ColorDefaultVal}{blue!60!black} +\colorlet{dc@ColorDefault}{blue!60!black} +\colorlet{dc@ColorKeys}{teal!40!black} +\colorlet{dc@ColorValue}{teal!40!black} +\colorlet{dc@ColorKey}{teal!40!black} +\colorlet{dc@ColorOptions}{green!30!black} +\colorlet{dc@ColorOthers}{green!30!black} +\colorlet{dc@ColorEnv}{green!30!black} +\colorlet{dc@ColorPack}{green!30!black} + + + +\def\dc@metafont{\dc@csfontsize\ttfamily} + +\DeclareKeys[MetaFormat]{ + Oarg.usage = general, + Oarg.code = {\def\dc@Metafmt{\color{dc@ColorOarg}\dc@metafont}}, + % + Marg.usage = general, + Marg.code = {\def\dc@Metafmt{\color{dc@ColorMarg}\dc@metafont}}, + % + Parg.usage = general, + Parg.code = {\def\dc@Metafmt{\color{dc@ColorParg}\dc@metafont}}, + % + Xarg.usage = general, + Xarg.code = {\def\dc@Metafmt{\color{dc@ColorXarg}\dc@metafont}}, + % + Macro.usage = general, + Macro.code = {\def\dc@Metafmt{\color{dc@ColorCode}\dc@metafont}}, + % + Code.usage = general, + Code.code = {\def\dc@Metafmt{\color{dc@ColorCode}\dc@metafont}}, + % + Key.usage = general, + Key.code = {\def\dc@Metafmt{\color{dc@ColorKey}\dc@metafont\slshape}}, + % + KeyVal.usage = general, + KeyVal.code = {\def\dc@Metafmt{\color{dc@ColorKeyVal}\dc@metafont\slshape}}, + % + Option.usage = general, + Option.code = {\def\dc@Metafmt{\color{dc@ColorOptions}\dc@metafont}}, + % + Default.usage = general, + Default.code = {\def\dc@Metafmt{\color{dc@ColorDefault}\dc@metafont}}, + % + Value.usage = general, + Value.code = {\def\dc@Metafmt{\color{dc@ColorValue}\dc@metafont\slshape}}, + % + Env.usage = general, + Env.code = {\def\dc@Metafmt{\color{dc@ColorEnv}\dc@metafont\slshape}}, + % + Pack.usage = general, + Pack.code = {\def\dc@Metafmt{\color{dc@ColorPack}\dc@metafont\slshape}}, + } +\DeclareUnknownKeyHandler[MetaFormat]{\def\dc@Metafmt{\color{dc@ColorOthers}\ttfamily}} + +\NewDocumentCommand{\MetaFmt}{sO{}}{\ifblank{#2}{}{\dc@@MetaFmt{#2}}\IfBooleanT{#1}{\bfseries}\dc@Metafmt} +\NewDocumentCommand{\dc@@MetaFmt}{m}{\SetKeys[MetaFormat]{#1}} +\dc@@MetaFmt{Code} + + +\titleformat{\chapter}{\sffamily\bfseries\selectfont\large}{\thechapter}{2ex}{} +\titleformat{name=\chapter,numberless}{\sffamily\bfseries\selectfont\large\center}{}{0pt}{} +\titlespacing{\chapter}{0pt}{\tc@chapbefore}{\tc@chapafter} + + +\def\tc@chapbefore{18pt plus 4pt minus 4pt} +\def\tc@chapafter{12pt plus 3pt minus 3pt} +\def\tc@secbefore{12pt plus 3pt minus 3pt} +\def\tc@secafter{8pt plus 2pt minus 2pt} + +\titleformat{\section}[hang]{\normalfont\selectfont\large}{\thesection}{.5em}{} +\titlespacing{\section}{0pt}{\tc@secbefore}{\tc@secafter} +\titleformat{\subsection}[hang]{\normalfont\sffamily\slshape\selectfont}{\thesubsection}{.5em}{} + +\titleformat{name=\section,numberless}[hang]{\normalfont\large\bfseries\scshape\selectfont\center}{}{0pt}{} +\titlespacing{name=\section,numberless}{0pt}{\tc@secbefore}{\tc@secafter} + + + +\reversemarginpar + + +\NewDocumentCommand{\dcAuthor}{m}{\def\dc@author{#1}} +\NewDocumentCommand{\dcDate}{m}{\def\dc@date{#1}} +\NewDocumentCommand{\dcTitle}{m}{\def\dc@title{#1}} + +\NewDocumentCommand\dcMakeTitle{}{\par + \begingroup + \renewcommand\thefootnote{\@fnsymbol\c@footnote}% + \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% + \long\def\@makefntext##1{\parindent 1em\noindent + \hb@xt@1.8em{% + \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% + \if@twocolumn + \ifnum \col@number=\@ne + \dc@maketitle + \else + \twocolumn[\dc@maketitle]% + \fi + \else + \newpage + \global\@topnum\z@ % Prevents figures from going at top of page. + \dc@maketitle + \fi + \thispagestyle{plain}\@thanks + \endgroup +} +\def\dc@maketitle{% + \newpage + \null + \vskip 2em% + \begin{center}% + \let \footnote \thanks + {\LARGE \dc@title \par}% + \vskip 1.5em% + {\large + \lineskip .5em% + \begin{tabular}[t]{c}% + \dc@author + \end{tabular}\par}% + \vskip 1em% + {\large \dc@date}% + \end{center}% + \par + \vskip 1.5em} + +\NewDocumentEnvironment{dcAbstract}{}{% + \if@twocolumn + \section*{\abstractname}% + \else + \small + \begin{center}% + {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}% + \end{center}% + \quotation + \fi}{\if@twocolumn\else\endquotation\fi} + + + +\def\convertto#1#2{\strip@pt\dimexpr #2*65536/\number\dimexpr 1#1} + +\NewDocumentCommand{\bigtab}{}{ +\begin{center}\begin{tabular} + {>{\def\colunit{pt}}l<{\convertto{\rowunit}{1\colunit}} + >{\def\colunit{mm}}l<{\convertto{\rowunit}{1\colunit}} + >{\def\colunit{cm}}l<{\convertto{\rowunit}{1\colunit}} + >{\def\colunit{ex}}l<{\convertto{\rowunit}{1\colunit}} + >{\def\colunit{em}}l<{\convertto{\rowunit}{1\colunit}} + >{\def\colunit{bp}}l<{\convertto{\rowunit}{1\colunit}} + >{\def\colunit{dd}}l<{\convertto{\rowunit}{1\colunit}} + >{\def\colunit{pc}}l<{\convertto{\rowunit}{1\colunit}} +% >{\def\colunit{in}}l<{\convertto{\rowunit}{1\colunit}} + >{\bfseries}l} +\multicolumn{1}{l}{\bfseries 1pt} & \multicolumn{1}{l}{\bfseries 1mm} & \multicolumn{1}{l}{\bfseries 1cm} & \multicolumn{1}{l}{\bfseries 1ex} & \multicolumn{1}{l}{\bfseries 1em} & \multicolumn{1}{l}{\bfseries 1bp} & \multicolumn{1}{l}{\bfseries 1dd} & \multicolumn{1}{l}{\bfseries 1pc} & \\%\multicolumn{1}{l}{\bfseries 1in} & \\ +\gdef\rowunit{pt} & & & & & & & & \rowunit\\ +\gdef\rowunit{mm} & & & & & & & & \rowunit\\ +\gdef\rowunit{cm} & & & & & & & & \rowunit\\ +\gdef\rowunit{ex} & & & & & & & & \rowunit\\ +\gdef\rowunit{em} & & & & & & & & \rowunit\\ +\gdef\rowunit{bp} & & & & & & & & \rowunit\\ +\gdef\rowunit{dd} & & & & & & & & \rowunit\\ +\gdef\rowunit{pc} & & & & & & & & \rowunit\\ +%\gdef\rowunit{in} & & & & & & & & & \rowunit\\ +\end{tabular}\end{center} +} + + + +\endinput
\ No newline at end of file diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 8e08a7b4511..29fb7323010 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -253,7 +253,7 @@ my @TLP_working = qw( ddphonism de-macro debate decimal decision-table decorule dehyph dehyph-exptl dejavu dejavu-otf - delim delimseasy delimset delimtxt denisbdoc derivative dhua + delim delimseasy delimset delimtxt democodetools denisbdoc derivative dhua diabetes-logbook diadia diagbox diagmac2 dialogl diagnose dice dichokey dickimaw dictsym diffcoeff digiconfigs dijkstra dimnum din1505 dinat dinbrief dingbat directory dirtree dirtytalk disser ditaa dithesis diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index e38a3f31799..ed82537007a 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -417,6 +417,7 @@ chomp (my $ctan_root = `tlpkginfo --ctan-root`); 'dejavu-math', "&MAKEflatten", 'dejavu-otf', "&MAKEflatten", 'deleq', "die 'skipping, nosell license'", + 'democodetools', "&MAKEflatten", 'denisbdoc', "&MAKEflatten", 'deproc', "die 'skipping, for latex 2.09'", 'designcon', "die 'skipping, requires nonfree fonts'", diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index 2fafcc98237..94a273deab3 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -338,6 +338,7 @@ depend debate depend decimal depend decorule depend delimtxt +depend democodetools depend denisbdoc depend diabetes-logbook depend diagbox diff --git a/Master/tlpkg/tlpsrc/democodetools.tlpsrc b/Master/tlpkg/tlpsrc/democodetools.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/Master/tlpkg/tlpsrc/democodetools.tlpsrc |