summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/democodetools/latex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/democodetools/latex')
-rw-r--r--macros/latex/contrib/democodetools/latex/democodelisting.sty1044
-rw-r--r--macros/latex/contrib/democodetools/latex/democodetools.sty678
2 files changed, 861 insertions, 861 deletions
diff --git a/macros/latex/contrib/democodetools/latex/democodelisting.sty b/macros/latex/contrib/democodetools/latex/democodelisting.sty
index 1041b6f249..21e74cac82 100644
--- a/macros/latex/contrib/democodetools/latex/democodelisting.sty
+++ b/macros/latex/contrib/democodetools/latex/democodelisting.sty
@@ -1,522 +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
+%%%==============================================================================
+%% 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/macros/latex/contrib/democodetools/latex/democodetools.sty b/macros/latex/contrib/democodetools/latex/democodetools.sty
index 1360cd7fc6..f5d613ee31 100644
--- a/macros/latex/contrib/democodetools/latex/democodetools.sty
+++ b/macros/latex/contrib/democodetools/latex/democodetools.sty
@@ -1,340 +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}
-}
-
-
-
+%%%==============================================================================
+%% 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