diff options
Diffstat (limited to 'macros/latex')
46 files changed, 1234 insertions, 763 deletions
diff --git a/macros/latex/contrib/changes/changes.drv b/macros/latex/contrib/changes/changes.drv index f10e708732..0ca29f10a1 100644 --- a/macros/latex/contrib/changes/changes.drv +++ b/macros/latex/contrib/changes/changes.drv @@ -260,11 +260,11 @@ % document title \ifENGLISH \title{The \chpackage{changes}-package} - \subtitle{Manual change markup --- version 3.2.0} + \subtitle{Manual change markup --- version 3.2.1} \fi \ifGERMAN \title{Das \chpackage{changes}-Paket} - \subtitle{Manuelle Änderungsmarkierung -- Version 3.2.0} + \subtitle{Manuelle Änderungsmarkierung -- Version 3.2.1} \fi \author{Ekkart Kleinod} diff --git a/macros/latex/contrib/changes/changes.dtx b/macros/latex/contrib/changes/changes.dtx index 8d6fa6e251..0604223858 100644 --- a/macros/latex/contrib/changes/changes.dtx +++ b/macros/latex/contrib/changes/changes.dtx @@ -1,4 +1,4 @@ -% \CheckSum{1510} +% \CheckSum{1509} % % \iffalse meta-comment % @@ -60,6 +60,7 @@ % \changes{v3.1.2}{2019/01/26}{bugfix: problems with amsart class} % \changes{v3.1.3}{2019/07/21}{bugfix: option clash for ulem and truncate; documentation of known problems and solutions} % \changes{v3.2.0}{2019/10/28}{Merge changes script (pyMergeChanges): Support nested brackets} +% \changes{v3.2.1}{2019/11/17}{removed obsolete package pdfcolmk} % \GetFileInfo{changes.dtx} % \RecordChanges % @@ -100,8 +101,8 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{changes} -[2019/10/28 v3.2.0 changes package] -\typeout{*** changes package 2019/10/28 v3.2.0 ***} +[2019/11/17 v3.2.1 changes package] +\typeout{*** changes package 2019/11/17 v3.2.1 ***} % \end{macrocode} % % Package \chpackage{xkeyval} provides options with key-value-pairs. @@ -533,12 +534,10 @@ % \end{macro} % % Package \chpackage{xcolor} provides colored text. -% Package \chpackage{pdfcolmk} solves the problem of colored text and page breaks (has to be loaded after \chpackage{xcolor}). % \begin{macrocode} \ifthenelse{\isColored} { \RequirePackage{xcolor} - \RequirePackage{pdfcolmk} } {} % \end{macrocode} diff --git a/macros/latex/contrib/changes/changes.english.pdf b/macros/latex/contrib/changes/changes.english.pdf Binary files differindex 12ca7fa7ca..d3033ecd1d 100644 --- a/macros/latex/contrib/changes/changes.english.pdf +++ b/macros/latex/contrib/changes/changes.english.pdf diff --git a/macros/latex/contrib/changes/changes.english.withcode.pdf b/macros/latex/contrib/changes/changes.english.withcode.pdf Binary files differindex d8bfff1dfc..38254d42a2 100644 --- a/macros/latex/contrib/changes/changes.english.withcode.pdf +++ b/macros/latex/contrib/changes/changes.english.withcode.pdf diff --git a/macros/latex/contrib/changes/changes.ins b/macros/latex/contrib/changes/changes.ins index 06da2e778c..acf9b77468 100644 --- a/macros/latex/contrib/changes/changes.ins +++ b/macros/latex/contrib/changes/changes.ins @@ -1,6 +1,6 @@ %% This file creates the needed files from changes.dtx %% -\def\filedate{2019/10/28} +\def\filedate{2019/11/17} \def\batchfile{changes.ins} \input docstrip diff --git a/macros/latex/contrib/changes/changes.ngerman.pdf b/macros/latex/contrib/changes/changes.ngerman.pdf Binary files differindex 497dad2b47..037fd7967f 100644 --- a/macros/latex/contrib/changes/changes.ngerman.pdf +++ b/macros/latex/contrib/changes/changes.ngerman.pdf diff --git a/macros/latex/contrib/chemmacros/README b/macros/latex/contrib/chemmacros/README index 2661b9f427..d97f1818e4 100644 --- a/macros/latex/contrib/chemmacros/README +++ b/macros/latex/contrib/chemmacros/README @@ -1,5 +1,5 @@ -------------------------------------------------------------------------- -the CHEMMACROS package v5.8e 2019/09/27 +the CHEMMACROS package v5.9 2019/11/17 comprehensive support for typesetting chemistry documents diff --git a/macros/latex/contrib/chemmacros/chemmacros.history b/macros/latex/contrib/chemmacros/chemmacros.history index 2b2429f9f8..ac061221f7 100644 --- a/macros/latex/contrib/chemmacros/chemmacros.history +++ b/macros/latex/contrib/chemmacros/chemmacros.history @@ -381,3 +381,7 @@ Version history 2019/09/23 - version 5.8d - add some Norwegian translations (reactions, scheme) 2019/09/27 - version 5.8e - change `O{}' argument of reactions into `!O{}' (reactions) +2019/09/30 - version 5.8f - fix bug introduced in the last version +2019/11/17 - version 5.9 - correction: torr -> Torr (units) + - define latin phrases on the go instead of at begin + document diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex index 596d36f65a..9cb5969ed2 100644 --- a/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex +++ b/macros/latex/contrib/chemmacros/chemmacros.module.nomenclature.code.tex @@ -862,7 +862,9 @@ \chemmacros_latin:n {#2} \group_end: } +\EndChemCompatibility +\ChemCompatibilityBetween{5.7}{5.9} \AtBeginDocument { \AfterPackage* {chemstyle} { \cs_undefine:N \invacuo } @@ -870,7 +872,13 @@ \NewChemLatin \abinitio {ab~initio} \NewChemLatin \invacuo {in~vacuo} } +\EndChemCompatibility +\ChemCompatibilityFrom{5.9} +\cs_undefine:N \invacuo +\NewChemLatin \invacuo {in~vacuo} +\NewChemLatin \abinitio {ab~initio} +\NewChemLatin \insitu {in~situ} \EndChemCompatibility % -------------------------------------------------------------------------- diff --git a/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex b/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex index 18bf0e5b9e..4584c8a631 100644 --- a/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex +++ b/macros/latex/contrib/chemmacros/chemmacros.module.units.code.tex @@ -25,19 +25,21 @@ % % The Current Maintainer of this work is Clemens Niederberger. % -------------------------------------------------------------------------- -\ChemModule{units}{2015/09/28 chemical units} +\ChemModule{units}{2019/11/07 chemical units} \RequirePackage{siunitx} % -------------------------------------------------------------------------- -\DeclareSIUnit {\atm } {atm} -\DeclareSIUnit {\atmosphere} {atm} -\DeclareSIUnit {\calory } {cal} -\DeclareSIUnit {\cal } {cal} -\DeclareSIUnit {\moLar } {\mole\per\liter} -\DeclareSIUnit {\MolMass } {\gram\per\mole} -\DeclareSIUnit {\normal } {\textsc{n}} -\DeclareSIUnit {\torr } {torr} +\DeclareSIUnit \atm {atm} +\DeclareSIUnit \atmosphere {atm} +\DeclareSIUnit \calory {cal} +\DeclareSIUnit \cal {cal} +\DeclareSIUnit \moLar {\mole\per\liter} +\DeclareSIUnit \MolMass {\gram\per\mole} +\DeclareSIUnit \normal {\textsc{n}} +\chemmacros_if_compatibility:nnTF {<} {5.8g} + { \DeclareSIUnit \torr {torr} } + { \DeclareSIUnit \Torr {Torr} } \AtEndPreamble { @@ -53,4 +55,5 @@ \file_input_stop: 2015/09/28 - change \AtBeginDocument into \AtEndPreamble +2019/11/07 - correction torr -> Torr diff --git a/macros/latex/contrib/chemmacros/chemmacros.sty b/macros/latex/contrib/chemmacros/chemmacros.sty index bb1e94bd3f..3865e1a860 100644 --- a/macros/latex/contrib/chemmacros/chemmacros.sty +++ b/macros/latex/contrib/chemmacros/chemmacros.sty @@ -31,10 +31,10 @@ % -------------------------------------------------------------------------- % package information: -\tl_const:Nn \c_chemmacros_date_tl {2019/09/30} +\tl_const:Nn \c_chemmacros_date_tl {2019/11/17} \tl_const:Nn \c_chemmacros_version_major_number_tl {5} -\tl_const:Nn \c_chemmacros_version_minor_number_tl {8} -\tl_const:Nn \c_chemmacros_version_subrelease_tl {f} +\tl_const:Nn \c_chemmacros_version_minor_number_tl {9} +\tl_const:Nn \c_chemmacros_version_subrelease_tl {} \tl_const:Nx \c_chemmacros_version_number_tl { \c_chemmacros_version_major_number_tl . diff --git a/macros/latex/contrib/chemmacros/chemmacros_en.pdf b/macros/latex/contrib/chemmacros/chemmacros_en.pdf Binary files differindex b62e8b0501..ee2ecb6eee 100644 --- a/macros/latex/contrib/chemmacros/chemmacros_en.pdf +++ b/macros/latex/contrib/chemmacros/chemmacros_en.pdf diff --git a/macros/latex/contrib/chemmacros/chemmacros_en.tex b/macros/latex/contrib/chemmacros/chemmacros_en.tex index feb89102c4..3fccfe7634 100644 --- a/macros/latex/contrib/chemmacros/chemmacros_en.tex +++ b/macros/latex/contrib/chemmacros/chemmacros_en.tex @@ -139,9 +139,14 @@ ]{geometry} -\expandafter\def\csname libertine@figurestyle\endcsname{LF} +\makeatletter +\def\libertine@figurestyle{LF} +\usepackage{amsmath} +\undef\lvert \undef\lVert +\undef\rvert \undef\rVert \usepackage[libertine]{newtxmath} -\expandafter\def\csname libertine@figurestyle\endcsname{OsF} +\def\libertine@figurestyle{OsF} +\makeatother \usepackage[biblatex]{embrac} \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] @@ -1374,20 +1379,6 @@ existing ones: If you additionally load \pkg{chemstyle}~\cite{pkg:chemstyle} said package will \emph{not} define its own \cs{latin}. -% The package \pkg{chemstyle}~\cite{pkg:chemstyle} provides the command -% \cs{latin} to typeset common latin phrases in a consistent way. \chemmacros\ -% defines a similar \cs{latin} only if \pkg{chemstyle} has \emph{not} been -% loaded and additionally provides these commands: -% \begin{center} -% \cs{insitu} \insitu \quad -% \cs{abinitio} \abinitio \quad -% \cs{invacuo} \invacuo -% \end{center} - -% \emph{If the package \pkg{chemstyle} has been loaded they are defined using -% \pkg{chemstyle}'s \cs{latin} command. This means that then the appearance -% depends on \pkg{chemstyle}'s option \code{abbremph}.} - The last three commands mentioned above are defined through \begin{commands} \command{NewChemLatin}[\marg{cs}\marg{phrase}] @@ -3461,7 +3452,7 @@ units. Like all \pkg{siunitx} units they're only valid inside \command{Molar} \si{\Molar} \command{MolMass} \si{\MolMass} \command{normal} \si{\normal} - \command{torr} \si{\torr} + \command{Torr} \si{\Torr} \end{commands} By the way: \cs*{mmHg} \si{\mmHg} already is defined by \pkg{siunitx}. diff --git a/macros/latex/contrib/etoc/README.md b/macros/latex/contrib/etoc/README.md index 88f2d05bf8..9a186ade41 100644 --- a/macros/latex/contrib/etoc/README.md +++ b/macros/latex/contrib/etoc/README.md @@ -1,6 +1,6 @@ <!-- --> - Source: etoc.dtx (v1.09-2019/03/09) + Source: etoc.dtx (v1.09b-2019/11/17) Author: Jean-Francois Burnol Author: Christine Roemer et al. (German tranlation) Info: Completely customisable TOCs @@ -48,22 +48,13 @@ to the standard `.toc` file. INSTALLATION ============ -The simplest is to download +To extract the package (.sty) and driver (.tex) files from etoc.dtx, +execute `etex etoc.dtx`. -> <http://mirrors.ctan.org/install/macros/latex/contrib/etoc.tds.zip> - -and then run `unzip etoc.tds.zip -d <DEST>` where `<DEST>` is a -TDS-compliant repertory. - -Else, to extract the package (.sty) and driver (.tex) files from etoc.dtx: - -- if etoc.ins is present: etex etoc.ins -- without etoc.ins: etex etoc.dtx - -It is also possible to run latex or pdflatex directly on etoc.dtx. +It is also possible to execute latex or pdflatex directly on etoc.dtx. To produce etoc.pdf one can run pdflatex (thrice) directly on etoc.dtx or on -the file etoc.tex which was extracted from previous step. +the file etoc.tex which was extracted from `etex etoc.dtx` step. Options can be set in etoc.tex: @@ -110,12 +101,21 @@ The Authors of this Work are: collaborators for the translation into German of the documentation. This Work consists of the main source file etoc.dtx and the -derived files etoc.sty, etoc.ins, etoc.tex, etoc-DE.tex, +derived files etoc.sty, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf, etoc.dvi, etoc-DE.dvi. RECENT CHANGES ============== +v1.09a, v1.09b \[2019/11/17\] +----------------------------- + +Sync with `memoir v3.7i` which has a better location of the TOC +hyperref anchor. The `\etocaftertitlehook` can now freely be +used also with memoir class (formerly its usage in case of +memoir class was preempted by etoc itself). For more details +refer to the section "Compatibility with the memoir class". + v1.09 \[2019/03/09\] -------------------- diff --git a/macros/latex/contrib/etoc/etoc-DE.pdf b/macros/latex/contrib/etoc/etoc-DE.pdf Binary files differindex 7c82540906..6b443b78ae 100644 --- a/macros/latex/contrib/etoc/etoc-DE.pdf +++ b/macros/latex/contrib/etoc/etoc-DE.pdf diff --git a/macros/latex/contrib/etoc/etoc.dtx b/macros/latex/contrib/etoc/etoc.dtx index 9c997ac56a..a500a3b01d 100644 --- a/macros/latex/contrib/etoc/etoc.dtx +++ b/macros/latex/contrib/etoc/etoc.dtx @@ -2,12 +2,12 @@ % N.B.: this dtx file is NOT for use with \DocInput. The latex source of the % user manual is not prefixed with percent signs. %<*none> -\def\etocdtxtimestamp {Time-stamp: <10-03-2019 at 09:35:44 CET>}% +\def\etocdtxtimestamp {Time-stamp: <17-11-2019 at 13:36:39 CET>}% %</none> %<*!readme> %% %% Package: etoc -%% Version: 1.09-2019/03/09 +%% Version: 1.09b-2019/11/17 %% License: LPPL 1.3c %% Copyright (C) 2012-2019 Jean-Francois Burnol %% <jfbu at free dot fr> @@ -16,15 +16,13 @@ %% and collaborators for the translation into German of the documentation %% %</!readme> -%<*insfile> -\def\etocpkgdate {2019/03/09} -\def\etocdocdate {2019/03/09} -\def\etocpkgversion {v1.09} -\def\etocpkgdescription {Completely customisable TOCs (JFB)} -%</insfile> %<*none> -\def\etocDEpkgdate {09.03.2019}% METTRE À JOUR À CHAQUE BUMP! -\def\etocDEdocdate {09.03.2019} +\def\etocpkgdate {2019/11/17} +\def\etocdocdate {2019/11/17} +\def\etocpkgversion {v1.09b} +\def\etocpkgdescription {Completely customisable TOCs (JFB)} +\def\etocDEpkgdate {17.11.2019}% METTRE À JOUR À CHAQUE BUMP! +\def\etocDEdocdate {17.11.2019} \def\etocDEDEdocdate {09.04.2015}% \def\etocDEDEpkgversion {v1.08d}% % Definition of \etocLicense @@ -35,7 +33,7 @@ \catcode32=13\catcode`\\=12^^Brelax^^A ^^Bfirstofone{^^Bendgroup^^Bdef^^BetocLicense^^A {% Package: etoc -% Version: 1.09-2019/03/09 +% Version: 1.09b-2019/11/17 % License: LPPL 1.3c % Copyright (C) 2012-2019 Jean-Francois Burnol <jfbu at free dot fr> % Copyright (C) 2014-2019 Christine Roemer <Christine_Roemer at t-online dot de> @@ -57,11 +55,11 @@ % for the translation into German of the documentation. % % This Work consists of the main source file etoc.dtx and the derived -% files etoc.sty, etoc.ins, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf, +% files etoc.sty, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf, % etoc.dvi, etoc-DE.dvi, README.md. % % Running etex (or latex or pdflatex) on etoc.dtx extracts etoc.sty, -% etoc.ins, etoc.tex, etoc-DE.tex, and README.md. See README.md for +% etoc.tex, etoc-DE.tex, and README.md. See README.md for % further instructions. }}% \bgroup\catcode2 0 \catcode`\\ 12 ^^Biffalse @@ -69,7 +67,7 @@ %<*readme> <!-- --> - Source: etoc.dtx (v1.09-2019/03/09) + Source: etoc.dtx (v1.09b-2019/11/17) Author: Jean-Francois Burnol Author: Christine Roemer et al. (German tranlation) Info: Completely customisable TOCs @@ -117,22 +115,13 @@ to the standard `.toc` file. INSTALLATION ============ -The simplest is to download - -> <http://mirrors.ctan.org/install/macros/latex/contrib/etoc.tds.zip> - -and then run `unzip etoc.tds.zip -d <DEST>` where `<DEST>` is a -TDS-compliant repertory. - -Else, to extract the package (.sty) and driver (.tex) files from etoc.dtx: +To extract the package (.sty) and driver (.tex) files from etoc.dtx, +execute `etex etoc.dtx`. -- if etoc.ins is present: etex etoc.ins -- without etoc.ins: etex etoc.dtx - -It is also possible to run latex or pdflatex directly on etoc.dtx. +It is also possible to execute latex or pdflatex directly on etoc.dtx. To produce etoc.pdf one can run pdflatex (thrice) directly on etoc.dtx or on -the file etoc.tex which was extracted from previous step. +the file etoc.tex which was extracted from `etex etoc.dtx` step. Options can be set in etoc.tex: @@ -179,12 +168,21 @@ The Authors of this Work are: collaborators for the translation into German of the documentation. This Work consists of the main source file etoc.dtx and the -derived files etoc.sty, etoc.ins, etoc.tex, etoc-DE.tex, +derived files etoc.sty, etoc.tex, etoc-DE.tex, etoc.pdf, etoc-DE.pdf, etoc.dvi, etoc-DE.dvi. RECENT CHANGES ============== +v1.09a, v1.09b \[2019/11/17\] +----------------------------- + +Sync with `memoir v3.7i` which has a better location of the TOC +hyperref anchor. The `\etocaftertitlehook` can now freely be +used also with memoir class (formerly its usage in case of +memoir class was preempted by etoc itself). For more details +refer to the section "Compatibility with the memoir class". + v1.09 \[2019/03/09\] -------------------- @@ -364,69 +362,6 @@ Thanks to Christine Römer! %%% mode: latex %%% End: %</DEtex>----------------------------------------------------------------------- -%<*insfile>--------------------------------------------------------------------- -%% Run etex on this file to extract from etoc.dtx: -%% etoc.sty, etoc.tex, etoc-DE.tex and README.md -%% -%% To produce etoc.pdf run pdflatex (thrice) on etoc.tex. -%% -%% Options can be set in etoc.tex (and etoc-DE.tex): -%% - scrdoc class options (paper size, font size, ...) -%% - with or without source code, -%% - with dvipdfmx or with latex/pdflatex. -%% -%% Since release 1.08h pdflatex is the default in etoc.tex (prior it -%% was latex+dvipdfmx as it produces smaller PDFs) in order to allow -%% inclusion via the use of package `attachfile` of about 25 code -%% samples as file attachment annotations. -%% -%% Um etoc-DE.pdf zu erzeugen ist pdflatex dreimal mit etoc-DE.tex -%% laufen zu lassen. -%% -%% Installation: -%% -%% etoc.sty -> TDS:tex/latex/etoc/etoc.sty -%% etoc.dtx -> TDS:source/latex/etoc/etoc.dtx -%% etoc.pdf -> TDS:doc/latex/etoc/etoc.pdf -%% etoc-DE.pdf -> TDS:doc/latex/etoc/etoc-DE.pdf -%% README.md -> TDS:doc/latex/etoc/README.md -%% -\input docstrip.tex -\askforoverwritefalse -\def\etocpkgpreamble{\defaultpreamble^^J\MetaPrefix^^J% -\string\NeedsTeXFormat{LaTeX2e}^^J% -\string\ProvidesPackage{etoc}^^J% -\space[\etocpkgdate\space\etocpkgversion\space\etocpkgdescription]}% -\generate{\nopreamble\nopostamble -\file{README.md}{\from{etoc.dtx}{readme}}% -\usepostamble\defaultpostamble -\file{etoc.tex}{\from{etoc.dtx}{tex}}% -\file{etoc-DE.tex}{\from{etoc.dtx}{DEtex}}% -\usepreamble\etocpkgpreamble -\file{etoc.sty}{\from{etoc.dtx}{package}}}% -\catcode32=13\relax% active space -\let =\space% -\Msg{************************************************************************} -\Msg{*} -\Msg{* To finish the installation you have to move the following} -\Msg{* file into a directory searched by TeX:} -\Msg{*} -\Msg{* etoc.sty} -\Msg{*} -\Msg{* To produce the documentation run latex thrice on file etoc.tex} -\Msg{* (or etoc-DE.tex) and then run dvipdfmx on file etoc.dvi, resp.} -\Msg{* etoc-DE.dvi} -\Msg{*} -\Msg{* Happy TeXing!} -\Msg{*} -\Msg{************************************************************************} -\ifx\numexpr\undefined -\Msg{* warning: to get correct utf-8 encoded README.md }% -\Msg{* do etex etoc.ins and not as here tex etoc.ins }% -\Msg{************************************************************************} -\fi -\endbatchfile -%</insfile>--------------------------------------------------------------------- %<*none>------------------------------------------------------------------------ ^^Bfi^^Begroup % @@ -483,7 +418,6 @@ Thanks to Christine Römer! \generate{\nopreamble\nopostamble \file{README.md}{\from{etoc.dtx}{readme}}% \usepostamble\defaultpostamble - \file{etoc.ins}{\from{etoc.dtx}{insfile}}% \file{etoc.tex}{\from{etoc.dtx}{tex}}% \file{etoc-DE.tex}{\from{etoc.dtx}{DEtex}}% \usepreamble\etocpkgpreamble @@ -4774,55 +4708,50 @@ Issue \csb{etocdisplay} to return to the default situation that |\tableofcontents| and variants issue a |\par| to switch to vertical mode before typesetting the TOC title and contents. -\section{Starred variants of the \csbhyp{tableofcontents} etc... commands} +\section{Starred variants and hooks} \label{tableofcontents*} \label{localtableofcontents*} \label{etocbeforetitlehook} \label{etocaftertitlehook} \label{etocaftercontentshook} \label{etocaftertochook} -\label{etocmemoirtoctotocfmt} -The \toc, \localtoc, \csa{etocmulticol}, and all their cousins and -variants have starred variants (the star must be before the other -arguments). For all but the |memoir| class, they are like the original. -For the |memoir| class, the original prints an entry in the |.toc| file, -as is the usage for the original \toc command in that class, whereas the -starred variants do not, as is the habit in that class. - -As soon as one starts using local table of contents one -discovers that the default |memoir| thing which is to create a -|chapter| entry for each TOC is not convenient. The command -\csb{etocmemoirtoctotocfmt}\marg{kind}\marg{name} will change -the format (\meta{kind} is |chapter|, |section|, |subsection|... and -\meta{name} can be for example \csa{contentsname}.) The initial set-up -is with |chapter| and |\contentsname|. - -The format of the actual heading of the TOC should also be set -appropriately (for example with \csa{etoctocstyle}), to use the -identical division unit as in the first argument to -\csa{etocmemoirtoctotocfmt}. - -A weird situation arises when one has two successive -\csa{localtableofcontents} (obviously this is not a truly real -life situation), just after a \csa{part} for example. The first -one creates (if the default has not been modified as indicated -above) a Chapter heading which is -written to the |.toc|. Then the second one thinks to be local -to this chapter . . . and as a result it displays nothing. The -fix is to define the second one to be a clone of the first -one. - -Independently of the situation with the |memoir| class there is -generally speaking a hook macro called -\csb{etocaftertitlehook} which is inhibited by using the -starred variants of the displaying commands. Except for the -|memoir| class, this hook is initially defined to do nothing. - -There are also (independently of the document class) +The \toc, \localtoc, \csa{etocmulticol}, and all their cousins have starred +variants (the star must be before the other arguments). The non-starred +variants execute the \csb{etocaftertitlehook}, whose default definition is to +do nothing. The starred variants do not execute this hook. + +For example, imagine you are using |book| class and want \localtoc to use a +section-like title, but unnumbered. Assuming the main \toc comes first in the +document, you can insert this after it: +\begin{verbatim} + \etocarticlestyle + \renewcommand{\etocaftertitlehook}{\addcontentsline{toc}{section}{\contentsname}} +\end{verbatim} +This configures the way \localtoc will behave (or \toc) from now on in the +document. + +The first line tells essentially to use |\section*{\contentsname}|, and the +second line says to insert the title in the |.toc| file itself (thus to be +displayed by the main table of contents). Notice that |hyperref| package will +then automatically create suitable anchor and one should \emph{not} use +explicitly \cs{phantomsection} here (it would let the anchor be located below +not above the title). + +With this set-up issuing \localtoc|*| will ignore the \csa{etocaftertitlehook} +hence not send the local toc title to the |.toc| file. This mimicks the +|memoir| class behavior, and can also be used with it. For more on |memoir| +class with \etoc, see \autoref{ssec:memoir}. + +There are further hook macros: \csb{etocaftercontentshook}, \csb{etocbeforetitlehook} and \csb{etocaftertochook} which are initially defined to do nothing and can be -used for some special effects. +used for some special effects. They are executed whether or not the table of +contents command was starred.% +% +\footnote{Hackers can test within these hooks if the context is starred or not + via an \cs{ifx}\cs{Etoc@aftertitlehook}\cs{@empty} conditional. Perhaps a + future release will provide \cs{etociftocisstarred} wrapper.} \clearpage @@ -5827,6 +5756,9 @@ example) throughout the document the macros \csa{l@section}, table of contents typeset by \etoc in compatibility mode. \subsection{Compatibility with the \texttt{memoir} class} +\label{ssec:memoir} +\label{etocmemoirtoctotocfmt} +\label{etocmemoirstyle} Release |1.07l| has also improved the compatibility with the |memoir| class: its |appendix| level has been made known to \etoc. It is at the same level as @@ -5835,6 +5767,62 @@ defined boolean whose activation may be added to the |.toc| file at the suitable location via |\addtocontents{toc}{..}|, if one needs to distinguish the two kinds of divisions. +The |memoir| mechanism relative to \toc versus \toc|*| is obeyed +automatically, and applies with \localtoc too. + +A weird situation arises under when one has two successive +\csa{localtableofcontents} (obviously this is not a truly real life +situation), just after a \csa{part} for example. The first one creates (if the +default has not been modified) a chapter heading which is written to the +|.toc| (because \etoc by default obeys |memoir| class behaviour). Then the +second one thinks to be local to this chapter . . . and as a result it +displays nothing. The fix is to define the second one to be a clone of the +first one. + +Actually, that \localtoc by default uses like \toc a chapter style is often +inconvenient. One can use the |memoir| macros to modify this: according to +|memoir| documentation, |\tocheadstart| and |\printtoctitle| seem to be the +most relevant. If you do that you will probably want the added line in |.toc| +file to use |{section}| not |{chapter}|. \etoc provides to this effect +\csb{etocmemoirtoctotocfmt}\marg{kind}\marg{name} whose first argument +\meta{kind} is |chapter|, |section|, |subsection|, etc... and the second +argument stands for the title and thus \csa{contentsname} is appropriate. Hence +\begin{verbatim} + \etocmemoirtoctotocfmt{section}{\contentsname} +\end{verbatim} +seems the natural choice in this context as an addition to the customizing the +|memoir| toc related macros to achieve a section like rendering (for more +details on the latter, please refer to |memoir| manual). + +A completely different approach, arguably simpler, is to overrule the \etoc +default under |memoir| (after the main document \toc which should still use a +chapter styling) via these simple +commands: +\begin{verbatim} + \etocarticlestyle % means to use \section*{\contentsname} (and marks) + \renewcommand{\etocaftertitlehook}{\addcontentsline{toc}{section}{\contentsname}} +\end{verbatim} +exactly as one would do with |book| class for example. Don't use any +|\phantomsection| in there, |hyperref| hyperlinks will work just fine (and the +anchor will be slightly above toc title, not below). + +Notice that prior to \etoc |1.09b|, the \csb{etocaftertitlehook} macro was +used by \etoc itself under the |memoir| class. Hence \localtoc obeyed the +|memoir| mechanism relative to starred or not starred, even after issuing +\csa{etocarticlestyle}, as long as the user did not redefine +\csb{etocaftertitlehook}. Starting with |1.09b| (which syncs with a |memoir| +change at |v3.7i|) it is needed in a case like here where the user issues +\csa{etocarticlestyle} to also configure explicitly the +\csa{etocaftertitlehook} to achieve the ``insert title in |.toc|'' effect (if +so wished), because \etoc uses another mechanism and does not pre-empt usage +of this user macro anymore. + +To recover the \etoc default under |memoir| class one can issue +\csa{etocmemoirstyle} and then +\csa{etocmemoirtoctotocfmt}|{chapter}{\contentsname}| (but attention that a +custom \csb{etocaftertitlehook} will still be obeyed; for info: it will get +executed before the \cs{cfttocbeforelisthook}). + \subsection{Compatibility with package \texttt{tocvsec2}} \etoc used to be incompatible with package @@ -5889,6 +5877,7 @@ line containing an \etoc inner command and an identification number is added to the |.toc| file. The correct local table of contents will be displayed only on the next |latex| run. + \section{Errors and catastrophes} After using \csa{etocsetstyle} for one level, the remaining @@ -9423,53 +9412,54 @@ nichts im Token"=Stream hinterlassen. Mit \csb{etocdisplay} werden (nochmal) von dem |\tableofcontents|"=Befehl und seinen Varianten zuerst ein |\par| erstellt. -\section{Gesternde Varianten des \csbhyp{tableofcontents} etc. Befehls} +\begin{otherlanguage}{english} + +\section{Starred variants and hooks} \label{tableofcontents*} \label{localtableofcontents*} \label{etocbeforetitlehook} \label{etocaftertitlehook} \label{etocaftercontentshook} \label{etocaftertochook} -\label{etocmemoirtoctotocfmt} - -Die Befehle \toc, \localtoc, \csa{etocmulticol} und all ihre Cousins und -Varianten haben Stern"=Varianten (der Stern muss vor den anderen Argumenten -kommen). Für alle Klassen außer |memoir| verhalten diese sich wie die Originale. -Für |memoir| jedoch, schreibt das Original einen Eintrag in die |.toc|-Datei, -genau so wie die Verwendung des echten \toc Befehls in dieser Klasse, während -aber die Stern"=Variante genau das nicht tut, wie es in |memoir| die Regel ist. - -Sobald man damit beginnt, lokale Inhaltsverzeichnisse zu benutzen merkt man, -dass der |memoir|-Standard, welcher dazu gedacht ist, einen |chapter|-Eintrag -für jedes Inhaltsverzeichnis zu erzeugen, nicht praktisch ist. Der Befehl -\csb{etocmemoirtoctotocfmt}\marg{Typ}\allowbreak\marg{name} ändert das Format -(\meta{Typ} ist wieder |chapter|, |section|, |subsection| etc. und \meta{name} -kann bspw. \csa{contentsname} sein.) Die Standardwerte für diese Größen sind -|chapter| und |\contentsname|. - -Das Format der tatsächlichen Überschrift des Inhaltsverzeichnisses sollte -ebenfalls ordnungsgemäß gesetzt werden (z.\,B. mit \csa{etoctocstyle}), um -einfach die selbe Einheitsgröße zu nutzen wie im ersten Argument von -\csa{etocmemoirtoctotocfmt}. - -Eine ungewöhnliche Situation tritt auf, wenn man zwei aufeinanderfolgende -\csa{localtableofcontents} hat (offensichtlich ist das eine nicht sehr -wahrscheinliche Situation), direkt nach einem \csa{part} zum Beispiel. Der erste -würde dann eine Kapitelüberschrift erzeugen (wenn der Standard nicht geändert -wurde, wie oben angedeutet), welche in die |.toc|-Datei geschrieben werden -würde. Das zweite Inhaltsverzeichnis denkt dann, es ist ein lokales zu diesem -Kapitel gehörig und würde aus diesem Grund nichts darstellen. Die Lösung für -dieses Problem ist es, das zweite als Klon des ersten zu definieren. -Unabhängig von der Situation hat man bei der |memoir|-Klasse immer ein -Hook"=Makro namens \csb{etocaftertitlehook}, welches man unterdrückt, indem man -die Stern"=Varianten der Darstellungsbefehle nutzt. Außer für die |memoir|-Klasse -ist dieser Hook dazu gedacht, überhaupt nichts zu tun. +The \toc, \localtoc, \csa{etocmulticol}, and all their cousins have starred +variants (the star must be before the other arguments). The non-starred +variants execute the \csb{etocaftertitlehook}, whose default definition is to +do nothing. The starred variants do not execute this hook. -Außerdem gibt es auch \csb{etocaftercontentshook}, \csb{etocbeforetitlehook} -und \csb{etocaftertochook} all drei ähnlich definiert um nichts zu tun und die -für einige spezielle Effekte genutzt werden können. +For example, imagine you are using |book| class and want \localtoc to use a +section-like title, but unnumbered. Assuming the main \toc comes first in the +document, you can insert this after it: +\begin{verbatim} + \etocarticlestyle + \renewcommand{\etocaftertitlehook}{\addcontentsline{toc}{section}{\contentsname}} +\end{verbatim} +This configures the way \localtoc will behave (or \toc) from now on in the +document. + +The first line tells essentially to use |\section*{\contentsname}|, and the +second line says to insert the title in the |.toc| file itself (thus to be +displayed by the main table of contents). Notice that |hyperref| package will +then automatically create suitable anchor and one should \emph{not} use +explicitly \cs{phantomsection} here (it would let the anchor be located below +not above the title). + +With this set-up issuing \localtoc|*| will ignore the \csa{etocaftertitlehook} +hence not send the local toc title to the |.toc| file. This mimicks the +|memoir| class behavior, and can also be used with it. For more on |memoir| +class with \etoc, see \autoref{ssec:memoir}. + +There are further hook macros: +\csb{etocaftercontentshook}, \csb{etocbeforetitlehook} and +\csb{etocaftertochook} which are initially defined to do nothing and can be +used for some special effects. They are executed whether or not the table of +contents command was starred.% +% +\footnote{Hackers can test within these hooks if the context is starred or not + via an \cs{ifx}\cs{Etoc@aftertitlehook}\cs{@empty} conditional. Perhaps a + future release will provide \cs{etociftocisstarred} wrapper.} +\end{otherlanguage} \clearpage @@ -10483,6 +10473,9 @@ benutzen und der Effekt wird im nächsten Inhaltsverzeichnis durch den Kompatibilitätsmodus von \etoc sichtbar werden. \subsection{Kompatibilität mit der \texttt{memoir}-Klasse} +\label{ssec:memoir} +\label{etocmemoirtoctotocfmt} +\label{etocmemoirstyle} Die Release |1.07l| hat ebenfalls die Kompatibilität mit der |memoir|-Klasse verbessert: Seine |appendix|-Ebene kann mit \etoc gemacht werden. Es ist die @@ -10491,6 +10484,71 @@ Test für einige boolesche"=Ausdrücke sein, die aktiviert sein können via eine Instruktion an die |.toc|-Datei aufgenommen werden, wenn man zwei Arten von Unterteilungen unterscheidet. +\begin{otherlanguage}{english} + +The |memoir| mechanism relative to \toc versus \toc|*| is obeyed +automatically, and applies with \localtoc too. + +\end{otherlanguage} + +Eine ungewöhnliche Situation tritt auf, wenn man zwei aufeinanderfolgende +\csa{localtableofcontents} hat (offensichtlich ist das eine nicht sehr +wahrscheinliche Situation), direkt nach einem \csa{part} zum Beispiel. Der erste +würde dann eine Kapitelüberschrift erzeugen, welche in die |.toc|-Datei geschrieben werden +würde. Das zweite Inhaltsverzeichnis denkt dann, es ist ein lokales zu diesem +Kapitel gehörig und würde aus diesem Grund nichts darstellen. Die Lösung für +dieses Problem ist es, das zweite als Klon des ersten zu definieren. + +\begin{otherlanguage}{english} + +Actually, that \localtoc by default uses like \toc a chapter style is often +inconvenient. One can use the |memoir| macros to modify this: according to +|memoir| documentation, |\tocheadstart| and |\printtoctitle| seem to be the +most relevant. If you do that you will probably want the added line in |.toc| +file to use |{section}| not |{chapter}|. \etoc provides to this effect +\csb{etocmemoirtoctotocfmt}\marg{kind}\marg{name} whose first argument +\meta{kind} is |chapter|, |section|, |subsection|, etc... and the second +argument stands for the title and thus \csa{contentsname} is appropriate. Hence +\begin{verbatim} + \etocmemoirtoctotocfmt{section}{\contentsname} +\end{verbatim} +seems the natural choice in this context as an addition to the customizing the +|memoir| toc related macros to achieve a section like rendering (for more +details on the latter, please refer to |memoir| manual). + +A completely different approach, arguably simpler, is to overrule the \etoc +default under |memoir| (after the main document \toc which should still use a +chapter styling) via these simple +commands: +\begin{verbatim} + \etocarticlestyle % means to use \section*{\contentsname} (and marks) + \renewcommand{\etocaftertitlehook}{\addcontentsline{toc}{section}{\contentsname}} +\end{verbatim} +exactly as one would do with |book| class for example. Don't use any +|\phantomsection| in there, |hyperref| hyperlinks will work just fine (and the +anchor will be slightly above toc title, not below). + +Notice that prior to \etoc |1.09b|, the \csb{etocaftertitlehook} macro was +used by \etoc itself under the |memoir| class. Hence \localtoc obeyed the +|memoir| mechanism relative to starred or not starred, even after issuing +\csa{etocarticlestyle}, as long as the user did not redefine +\csb{etocaftertitlehook}. Starting with |1.09b| (which syncs with a |memoir| +change at |v3.7i|) it is needed in a case like here where the user issues +\csa{etocarticlestyle} to also configure explicitly the +\csa{etocaftertitlehook} to achieve the ``insert title in |.toc|'' effect (if +so wished), because \etoc uses another mechanism and does not pre-empt usage +of this user macro anymore. + +To recover the \etoc default under |memoir| class one can issue +\csa{etocmemoirstyle} and then +\csa{etocmemoirtoctotocfmt}|{chapter}{\contentsname}| (but attention that a +custom \csb{etocaftertitlehook} will still be obeyed; for info: it will get +executed before the \cs{cfttocbeforelisthook}). + +\end{otherlanguage} + + + \subsection{Kompatibilität mit \texttt{tocvsec2}} % la traduction allemande était déficiente semble-t-il, j'améliore un peu @@ -10661,7 +10719,15 @@ Dokumentation erzeugt von der Quelldatei mit dem Stempel \begin{multicols}{2} \begin{jfverbatim} -v1.09 [2019/03/09]^ +v1.09a, v1.09b [2019/11/17]^ + + Sync with memoir v3.7i which has a better location of the TOC + hyperref anchor. The \etocaftertitlehook can now freely be + used also with memoir class (formerly its usage in case of + memoir class was preempted by etoc itself). For more details + refer to the section "Compatibility with the memoir class". + +~v1.09 [2019/03/09]^ New features: \etoclocaltop, \localtableofcontentswithrelativedepth. Thanks to Tony Roberts for feature request. @@ -11110,11 +11176,11 @@ v1.09 [2019/03/09]^ \texttt{\parindent 0pt\rightskip 1cm minus 1cm This documentation has been compiled without inclusion of the source code. To produce the English documentation with source code included:\endgraf - \ \ \ \ run etex on etoc.dtx or etoc.ins to produce etoc.tex,\endgraf + \ \ \ \ run etex on etoc.dtx to produce etoc.tex,\endgraf \ \ \ \ then thrice pdflatex on etoc.tex.\endgraf \medskip To produce the German documentation with source code included, run etex on - etoc.dtx or etoc.ins to produce etoc-DE.tex, then edit etoc-DE.tex + etoc.dtx to produce etoc-DE.tex, then edit etoc-DE.tex to set \string\NoSourceCode\space to 0, and run pdflatex thrice on etoc-DE.tex.\endgraf }% \fi @@ -11126,12 +11192,12 @@ v1.09 [2019/03/09]^ % Um % die englische Dokumentation mit dem Quellcode zu produzieren, ist % einzubeziehen: \endgraf - % \ \ \ \ kompilieren etex mit etoc.dtx oder etoc.ins, um etoc.tex zu + % \ \ \ \ kompilieren etex mit etoc.dtx, um etoc.tex zu % produzieren, \endgraf % \ \ \ \ dann dreimal pdflatex mit etoc.tex.\endgraf \endgraf Um die deutsche Dokumentation mit Einbeziehung des Quellcodes zu erstellen, - ist zu kompilieren etex mit etoc.dtx oder etoc.ins, um etoc-DE.tex zu + ist zu kompilieren etex mit etoc.dtx, um etoc-DE.tex zu erzeugen, dann ist \string\NoSourceCode\space in etoc-DE.tex auf 0 zu setzen, dann ist pdflatex dreimal mit etoc-DE.tex laufen zu lassen.\endgraf % \medskip @@ -12628,10 +12694,14 @@ v1.09 [2019/03/09]^ % \end{macrocode} % |1.08i| removes definition of |\etoc@startlocaltoc| from here. It is done % in |\Etoc@localtableofcontents| or uses its default of |\@gobble|. +% +% |1.09b| uses a |\def| in non-starred variant for allowing tricks to +% recognize later on if we are in a starred or non-starred case, whatever the +% user definition of \cs{etocaftertitlehook} may be. % \begin{macrocode} \@ifstar - {\def\Etoc@aftertitlehook{}\Etoc@table@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@table@fcontents}% + {\let\Etoc@aftertitlehook\@empty\Etoc@table@fcontents} + {\def\Etoc@aftertitlehook{\etocaftertitlehook}\Etoc@table@fcontents}% }% \etoctableofcontents \let\tableofcontents\etoctableofcontents \newcommand*\localtableofcontents{% @@ -12641,8 +12711,8 @@ v1.09 [2019/03/09]^ \let\tof@begingroup\@empty \let\tof@endgroup \@empty \@ifstar - {\def\Etoc@aftertitlehook{}\Etoc@localtable@fcontents} - {\let\Etoc@aftertitlehook\etocaftertitlehook\Etoc@localtable@fcontents}% + {\let\Etoc@aftertitlehook\@empty\Etoc@localtable@fcontents} + {\def\Etoc@aftertitlehook{\etocaftertitlehook}\Etoc@localtable@fcontents}% }% \localtableofcontents % \end{macrocode} % |1.09| adds \localtocwrdp. The motivation is that it is impossible to set @@ -13272,19 +13342,44 @@ v1.09 [2019/03/09]^ {\if@restonecol \twocolumn \fi}} \let\etocreportstyle\etocbookstyle \let\etocreportstylenomarks\etocbookstylenomarks +% \end{macrocode} +% |v3.7i| of memoir has moved the \cs{phantomsection} to a better location, +% before typesetting the title and we follow suit at |1.09a|, and less rashly +% at |1.09b|. Formerly \etoc used \cs{etocaftertitlehook} to mimick the +% memoir code but as its name indicate, it is supposedly executed after the +% title... and this also had the defect of making \cs{etocaftertitlehook} not +% anymore a user command. Thus we here use some refactoring of the +% \cs{Etoc@aftertitlehook} internal mechanism to help recognize if we are +% in the starred case or not. +% +% \cs{phantomsection} is always defined by memoir, empty if hyperref absent. +% \begin{macrocode} \def\etocmemoirtoctotocfmt #1#2{% \def\Etoc@addsuitablecontentsline{\addcontentsline {toc}{#1}{#2}}% - \renewcommand*\etocaftertitlehook{% - \ifmem@em@starred@listof - \else - \phantomsection - \aftergroup\Etoc@addsuitablecontentsline - \fi}% } \def\etocmemoirstyle{% \etocsettocstyle - {\ensureonecol \par \begingroup \@nameuse {@tocmaketitle} - \Etoc@aftertitlehook\let\Etoc@aftertitlehook\relax + {\ensureonecol \par \begingroup \phantomsection + \ifx\Etoc@aftertitlehook\@empty + \else + % non-starred variant + \ifmem@em@starred@listof + \else + \Etoc@addsuitablecontentsline + \fi + \fi + \@nameuse {@tocmaketitle} %<< space token here from memoir code + \ifx\Etoc@aftertitlehook\@empty + \else +% \end{macrocode} +% Execute etoc hook before the \cs{cfttocbeforelisthook} and keep distinction +% between starred and non-starred contexts for other hooks. Notice that the +% memoir class way of implementing \cs{tableofcontents} leaves no way for code +% executed by the TOC code to know if it is executed in starred or non-starred +% context. +% \begin{macrocode} + \Etoc@aftertitlehook \let \Etoc@aftertitlehook \relax + \fi \parskip \cftparskip \@nameuse {cfttocbeforelisthook}} {\@nameuse {cfttocafterlisthook}\endgroup\restorefromonecol}} % \end{macrocode} @@ -13677,7 +13772,7 @@ v1.09 [2019/03/09]^ Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{3497}% +\CheckSum{3506}% \csname check@checksum\endcsname \Finale diff --git a/macros/latex/contrib/etoc/etoc.pdf b/macros/latex/contrib/etoc/etoc.pdf Binary files differindex 1b43c65c89..111b8b2b7e 100644 --- a/macros/latex/contrib/etoc/etoc.pdf +++ b/macros/latex/contrib/etoc/etoc.pdf diff --git a/macros/latex/contrib/pkuthss/README b/macros/latex/contrib/pkuthss/README.txt index 4f7e832a45..424793e9b8 100644 --- a/macros/latex/contrib/pkuthss/README +++ b/macros/latex/contrib/pkuthss/README.txt @@ -13,6 +13,6 @@ Licence: This package provides a simple, clear and flexible LaTeX template for dissertations in Peking University. -This file (README) is *NOT* intended as the documentation for this +This file (`README.txt') is *NOT* intended as the documentation for this package; please see the file `pkuthss.pdf' instead. diff --git a/macros/latex/contrib/pkuthss/doc/example.pdf b/macros/latex/contrib/pkuthss/doc/example.pdf Binary files differindex f4e66e5d31..b996c5d1b9 100644 --- a/macros/latex/contrib/pkuthss/doc/example.pdf +++ b/macros/latex/contrib/pkuthss/doc/example.pdf diff --git a/macros/latex/contrib/pkuthss/doc/pkuthss.pdf b/macros/latex/contrib/pkuthss/doc/pkuthss.pdf Binary files differindex e862048119..97a7442140 100644 --- a/macros/latex/contrib/pkuthss/doc/pkuthss.pdf +++ b/macros/latex/contrib/pkuthss/doc/pkuthss.pdf diff --git a/macros/latex/contrib/pkuthss/doc/readme/ChangeLog.txt b/macros/latex/contrib/pkuthss/doc/readme/ChangeLog.txt index 57eac504ca..820daecd54 100644 --- a/macros/latex/contrib/pkuthss/doc/readme/ChangeLog.txt +++ b/macros/latex/contrib/pkuthss/doc/readme/ChangeLog.txt @@ -1,3 +1,10 @@ +2019-11-17, v1.8.2 + + * Misc: + - CTAN now also wants README in the TDS archive. + - `README' -> `README.txt' do avoid collision with the `readme' directory. + - Fix ignored `\docversion' update. + 2019-11-15, v1.8.1 * Changes to example template: diff --git a/macros/latex/contrib/pkuthss/doc/readme/pkuthss.tex b/macros/latex/contrib/pkuthss/doc/readme/pkuthss.tex index 70989bac57..2e8b081f48 100644 --- a/macros/latex/contrib/pkuthss/doc/readme/pkuthss.tex +++ b/macros/latex/contrib/pkuthss/doc/readme/pkuthss.tex @@ -49,7 +49,7 @@ tabsize = 4, formatcom = {\ifXeTeX\xeCJKVerbAddon\fi} } -\newcommand*{\docversion}{v1.8.0} +\newcommand*{\docversion}{v1.8.2} \pkuthssinfo{ cthesisname = {本科生毕业论文}, ethesisname = {Undergraduate Thesis}, ctitle = {北京大学学位论文模版\\pkuthss \docversion}, diff --git a/macros/latex/contrib/pkuthss/tex/pkulogo.pdf b/macros/latex/contrib/pkuthss/tex/pkulogo.pdf Binary files differindex 629fab21e0..0d70935c6a 100644 --- a/macros/latex/contrib/pkuthss/tex/pkulogo.pdf +++ b/macros/latex/contrib/pkuthss/tex/pkulogo.pdf diff --git a/macros/latex/contrib/pkuthss/tex/pkuthss-gbk.def b/macros/latex/contrib/pkuthss/tex/pkuthss-gbk.def index 8ebb0f6ea2..02e885da95 100644 --- a/macros/latex/contrib/pkuthss/tex/pkuthss-gbk.def +++ b/macros/latex/contrib/pkuthss/tex/pkuthss-gbk.def @@ -22,7 +22,7 @@ % pkuword.eps \ProvidesFile{pkuthss-gbk.def} - [2019/11/15 v1.8.1 Labels and captions in GBK encoding + [2019/11/17 v1.8.2 Labels and captions in GBK encoding for the pkuthss document class] \def\label@ctitle{Ŀ} diff --git a/macros/latex/contrib/pkuthss/tex/pkuthss-utf8.def b/macros/latex/contrib/pkuthss/tex/pkuthss-utf8.def index 64cbcf129b..9bc6000ac1 100644 --- a/macros/latex/contrib/pkuthss/tex/pkuthss-utf8.def +++ b/macros/latex/contrib/pkuthss/tex/pkuthss-utf8.def @@ -22,7 +22,7 @@ % pkuword.eps \ProvidesFile{pkuthss-utf8.def} - [2019/11/15 v1.8.1 Labels and captions in UTF-8 encoding + [2019/11/17 v1.8.2 Labels and captions in UTF-8 encoding for the pkuthss document class] \def\label@ctitle{题目:} diff --git a/macros/latex/contrib/pkuthss/tex/pkuthss.cls b/macros/latex/contrib/pkuthss/tex/pkuthss.cls index 0e0c766eec..7f75114da4 100644 --- a/macros/latex/contrib/pkuthss/tex/pkuthss.cls +++ b/macros/latex/contrib/pkuthss/tex/pkuthss.cls @@ -23,7 +23,7 @@ \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesClass{pkuthss} - [2019/11/15 v1.8.1 Peking University dissertation document class] + [2019/11/17 v1.8.2 Peking University dissertation document class] % eg. `\thss@int@boolopt{spacing}{true}' will expand to: % \newif\ifthss@opt@spacing \thss@opt@spacingtrue diff --git a/macros/latex/contrib/pkuthss/tex/pkuword.pdf b/macros/latex/contrib/pkuthss/tex/pkuword.pdf Binary files differindex e38fdcef3e..762067f759 100644 --- a/macros/latex/contrib/pkuthss/tex/pkuword.pdf +++ b/macros/latex/contrib/pkuthss/tex/pkuword.pdf diff --git a/macros/latex/contrib/scontents/README.md b/macros/latex/contrib/scontents/README.md index bd42d3ab4f..9cb1056924 100644 --- a/macros/latex/contrib/scontents/README.md +++ b/macros/latex/contrib/scontents/README.md @@ -1,13 +1,13 @@ ## scontents — Stores LaTeX contents in memory or files -- Version: 1.7 -- Date: 2019-10-29 +- Version: 1.8 +- Date: 2019-11-18 - Author: Pablo González ## Description -The `scontents` package stores valid `LaTeX` code in memory (sequences) using the -`l3seq` module of `expl3`. The stored content, including `verbatim` material, can be -used as many times as desired in the document, additionally can be written -to external files. +This package allows to store `LaTeX` code, including _"verbatim"_, in <code><sequences></code> +using the `l3seq` module of `expl3`. The <code><stored content></code> can be used +as many times as desired in the document, additionally you can write to <code><external files></code> +or show it in <code><verbatim style></code>. ## Requirements The package loads and depends on updated versions of: @@ -35,8 +35,13 @@ the files to appropriate locations: then run `mktexlsr`. ## Examples -The file `scontents.pdf` contains attached examples, which can be extracted -from the PDF viewer or using `pdfdetach -saveall scontents.pdf` from command line. +The file <code><scontents.pdf></code> contains attached examples, which can be extracted +from the PDF viewer or from the command line by running: + +``` +$ pdfdetach -saveall scontents.pdf +``` +and then you can use the excellent `arara` tool to compile them. ## License The scontents package may be modified and distributed under the terms and diff --git a/macros/latex/contrib/scontents/scontents.dtx b/macros/latex/contrib/scontents/scontents.dtx index c2316fb999..3f362eea95 100644 --- a/macros/latex/contrib/scontents/scontents.dtx +++ b/macros/latex/contrib/scontents/scontents.dtx @@ -31,10 +31,10 @@ % and later we will copy the write stream opened by imakeidx into \@indexfile % so that entries written to both streams end up in the same file. \usepackage[english]{babel} -\usepackage[top=0.5in,bottom=0.5in,left=2in,right=0.7in,footskip=0.2in,headsep=10pt]{geometry} +\usepackage[top=0.5in,bottom=0.3in,left=2in,right=0.7in,footskip=0.2in,headheight=1cm,headsep=0.27cm]{geometry} \usepackage[osf,mono=false,scale=0.95,llscaled=0.95]{libertine} \setmonofont[ - Ligatures = TeX, + %Ligatures = TeX, Numbers = OldStyle, Scale = 0.80, UprightFont = *-Regular, @@ -42,11 +42,15 @@ BoldFont = *-Semibold, BoldItalicFont = *-SemiboldIt, RawFeature = {+zero,+ss06}, - FontFace = {m}{sc}{*-ExtraLight}, + FontFace = {m}{sc}{LinBiolinum_R.otf}, Extension = .otf]{SourceCodePro} -\newfontfamily\sourcecodeprolight{SourceCodePro-Regular.otf}[Scale = 0.80,FakeStretch =0.75] +\newfontfamily\sourcecodeprolight{SourceCodePro-Regular.otf}[ + Scale = 0.80,FakeStretch =0.75, + FontFace = {m}{it}{Font =SourceCodePro-RegularIt.otf,Color=FF0000}] \RenewDocumentCommand{\MacroLongFont}{} - { \sourcecodeprolight\small } + { + \sourcecodeprolight\small + } % The character of visible space is now taken from Latin Modern Mono % to prevent fonts in T1. The original definition for xetex/luatex is % \def\verbvisiblespace{\usefont{OT1}{cmtt}{m}{n}\asciispace} @@ -64,11 +68,6 @@ \setmathfont[Scale = 0.95]{latinmodern-math.otf} \usepackage{fontawesome5} -\newfontfamily\lmmitalic{lmmono10-italic.otf}[ - Scale = 0.95,% - Extension = .otf,% - ItalicFont = lmmono10-italic,% - ] \newfontfamily\fetamontotf{ffmw10.otf}[ Scale = 0.95,% RawFeature = {+latn,+rand,+kern,+size},% @@ -76,10 +75,11 @@ ] \usepackage[svgnames]{xcolor} \usepackage[sf,bf,compact,medium,pagestyles]{titlesec} -\usepackage{hyperxmp,lastpage,imakeidx,microtype,attachfile2} +\usepackage{lastpage,imakeidx,microtype,attachfile2} \usepackage{adjustbox,multicol,listings,accsupp,titletoc} \usepackage{scontents} % main \usepackage[contents]{colordoc} +% \show\docCodelineNo \def\textnew#1{\color{color-def}#1\/} \def\AltMacroFont{\fontencoding\encodingdefault \fontfamily\ttdefault @@ -104,6 +104,15 @@ |catcode`| 12|gdef|sxmacro@code#1% \end{macrocode*}[|liii@xmacro@code[#1]|end[macrocode*]] |endgroup +% Other patch for colordoc.sty to work xelatex +\makeatletter +\def\@moddecr#1{% + \global\advance#1\m@ne + \reset@color + \ifnum#1>\z@\else + \global#1\@colorlevels\fi} +\makeatother + \EnableCrossrefs % \PageIndex % \CodelineIndex undoes what \PageIndex does % \CodelineIndex tries to open another write stream for the index file. We don't @@ -117,9 +126,19 @@ \expandafter\DoNotIndex\expandafter{\string\}} \expandafter\DoNotIndex\expandafter{\string\begin} \newcommand{\HP}[1]{\emph{\hyperpage{#1}}\normalsize} -\def\MYSortIndex#1#2{\index[userdoc]{#1\actualchar#2|HP}} +\ExplSyntaxOn +\cs_new_protected:Npn \StartImplementation + { \bool_set_true:N \l__codedoc_in_implementation_bool } +\bool_set_false:N \l__codedoc_in_implementation_bool +\cs_new_protected:Npn \MYSortIndex #1 #2 + { + \bool_if:NTF \l__codedoc_in_implementation_bool + { \index{#1\actualchar#2|HP} } + { \index[userdoc]{#1\actualchar#2|HP} } + } +\ExplSyntaxOff -\indexsetup{level=\section,firstpagestyle=myheader} +\indexsetup{level=\section,firstpagestyle=myheader,othercode=\pagestyle{myheader}} \makeindex[name=userdoc,options=-s gind.ist,columnsep=15pt,title={Index of Documentation}] \makeindex[options=-s gind.ist,columnsep=15pt,title={Index of Implementation}] % Now, after imakeidx opens the write stream for the index file, we copy @@ -130,104 +149,108 @@ \setlength{\parindent}{0pt} -%%-------------------- ONLY FOR DOCUMENTATION ------------------------%% -% Colors for options +% Colors \definecolor{optcolor}{rgb}{0.281,0.275,0.485} -\definecolor{mypkgcolor}{RGB}{0,128,128}% +\definecolor{pkgcolor}{rgb}{0,0.5,0.5} +\definecolor{araracolor}{rgb}{0, 0.72, 0.28} +\definecolor{linkcolor}{rgb}{0.04,0.38,0.04} +\definecolor{rulecolor}{rgb}{0.96,0.96,0.96} -% Logo with fetamont font for title -\makeatletter -\newsavebox{\logobox} -\savebox{\logobox}{% - \normalsize\fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}} -\newcommand{\mylogo}{% - \settoheight{\@tempdima}{L}% - \resizebox{!}{\@tempdima}{\usebox{\logobox}}% - } -\makeatother +% Only for arara... I like arara :) +\usepackage[scale=0.85]{comfortaa} +\newcommand{\araratext}[1]{{\small\normalfont\comfortaa\color{araracolor}\bfseries#1}} +\newcommand*\arara{\araratext{ar\kern-.03emar\kern-.03ema}} -% Custom \meta[...]{...}, \marg[...]{...} and \oarg[...]{...} with color -\ExplSyntaxOn % User level commands +\ExplSyntaxOn +% Logo with fetamont font +\NewDocumentCommand{\pkglogo}{} + { + \group_begin: + \fetamontotf{\textcolor{pkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{pkgcolor}{s}} + \group_end: + } + +% Custom \meta[...]{...}, \marg[...]{...} and \oarg[...]{...} with color \NewDocumentCommand{\mymeta}{O{}m} { - \userdoc_meta_generic:Nnn \userdoc_meta:n { #1 } { #2 } + \userdoc_meta_generic:Nnn \userdoc_meta:n { #1 } { #2 } } \NewDocumentCommand{\mymarg}{O{}m} { - \userdoc_meta_generic:Nnn \userdoc_marg:n { #1 } { #2 } + \userdoc_meta_generic:Nnn \userdoc_marg:n { #1 } { #2 } } \NewDocumentCommand{\myoarg}{O{}m} { - \userdoc_meta_generic:Nnn \userdoc_oarg:n { #1 } { #2 } + \userdoc_meta_generic:Nnn \userdoc_oarg:n { #1 } { #2 } } % Variables and keys \tl_new:N \l_userdoc_meta_font_tl \keys_define:nn { userdoc / mymeta } { - type .choice:, - type / tt .code:n = \tl_set:Nn \l_userdoc_meta_font_tl { \ttfamily }, - type / rm .code:n = \tl_set:Nn \l_userdoc_meta_font_tl { \rmfamily }, - type .initial:n = rm, - cf .tl_set:N = \l_userdoc_meta_color_tl, - cf .initial:n = optcolor, - ac .tl_set:N = \l_userdoc_meta_anglecolor_tl, - ac .initial:n = lightgray, - sbc .tl_set:N = \l_userdoc_meta_brackcolor_tl, - sbc .initial:n = gray, - cbc .tl_set:N = \l_userdoc_meta_bracecolor_tl, - cbc .initial:n = gray, + type .choice:, + type / tt .code:n = \tl_set:Nn \l_userdoc_meta_font_tl { \ttfamily }, + type / rm .code:n = \tl_set:Nn \l_userdoc_meta_font_tl { \rmfamily }, + type .initial:n = rm, + cf .tl_set:N = \l_userdoc_meta_color_tl, + cf .initial:n = optcolor, + ac .tl_set:N = \l_userdoc_meta_anglecolor_tl, + ac .initial:n = lightgray, + sbc .tl_set:N = \l_userdoc_meta_brackcolor_tl, + sbc .initial:n = gray, + cbc .tl_set:N = \l_userdoc_meta_bracecolor_tl, + cbc .initial:n = gray, } % Internal commands \cs_new_protected:Npn \userdoc_meta_generic:Nnn #1 #2 #3 { - \group_begin: - \keys_set:nn { userdoc / mymeta } { #2 } - \color{ \l_userdoc_meta_color_tl } - \l_userdoc_meta_font_tl - #1 { #3 } % #1 is \userdoc_meta:n, \userdoc_marg:n or \userdoc_oarg:n - \group_end: + \group_begin: + \keys_set:nn { userdoc / mymeta } { #2 } + \color{ \l_userdoc_meta_color_tl } + \l_userdoc_meta_font_tl + #1 { #3 } % #1 is \userdoc_meta:n, \userdoc_marg:n or \userdoc_oarg:n + \group_end: } \cs_new_protected:Npn \userdoc_meta:n #1 { - \userdoc_meta_angle:n { \textlangle } - \userdoc_meta_meta:n { #1 } - \userdoc_meta_angle:n { \textrangle } + \userdoc_meta_angle:n { \textlangle } + \userdoc_meta_meta:n { #1 } + \userdoc_meta_angle:n { \textrangle } } \cs_new_protected:Npn \userdoc_marg:n #1 { - \userdoc_meta_brace:n { \textbraceleft } - \userdoc_meta:n { #1 } - \userdoc_meta_brace:n { \textbraceright } + \userdoc_meta_brace:n { \textbraceleft } + \userdoc_meta:n { #1 } + \userdoc_meta_brace:n { \textbraceright } } \cs_new_protected:Npn \userdoc_oarg:n #1 { - \userdoc_meta_brack:n { [ } - \userdoc_meta:n { #1 } - \userdoc_meta_brack:n { ] } + \userdoc_meta_brack:n { [ } + \userdoc_meta:n { #1 } + \userdoc_meta_brack:n { ] } } \cs_new_protected:Npn \userdoc_meta_meta:n #1 { - \textnormal{\textit{#1}} + \textnormal{\textit{#1}} } \cs_new_protected:Npn \userdoc_meta_angle:n #1 { - \group_begin: - \fontfamily{lmr}\selectfont - \textcolor{\l_userdoc_meta_anglecolor_tl}{#1} - \group_end: + \group_begin: + \fontfamily{lmr}\selectfont + \textcolor{\l_userdoc_meta_anglecolor_tl}{#1} + \group_end: } \cs_new_protected:Npn \userdoc_meta_brace:n #1 { - \group_begin: - \color{\l_userdoc_meta_bracecolor_tl} + \group_begin: + \color{\l_userdoc_meta_bracecolor_tl} #1 - \group_end: + \group_end: } \cs_new_protected:Npn \userdoc_meta_brack:n #1 { - \textcolor{\l_userdoc_meta_brackcolor_tl}{#1} + \textcolor{\l_userdoc_meta_brackcolor_tl}{#1} } % \envexamp{m} \newsavebox{\boxexaenv} @@ -236,10 +259,10 @@ \begin{lrbox}{\boxexaenv}% \begin{minipage}[t]{\marginparwidth}% \raggedright\ttfamily\small - \textcolor{gray}{\textbackslash begin\{\textcolor{mypkgcolor}{{#1}}\}\myoarg + \textcolor{gray}{\textbackslash begin\{\textcolor{pkgcolor}{{#1}}\}\myoarg [type=tt,sbc=gray,ac=lightgray,cf=optcolor]{keyval ~ list}}\par% \hspace{0.5cm}\mymeta[type=tt,ac=lightgray,cf=gray]{env ~ contents}\par% - \textcolor{gray}{\textbackslash end\{{\textcolor{mypkgcolor}{{#1}}}\}}\par + \textcolor{gray}{\textbackslash end\{{\textcolor{pkgcolor}{{#1}}}\}}\par \end{minipage}% \end{lrbox}% \usebox{\boxexaenv} @@ -249,10 +272,10 @@ \begin{lrbox}{\boxexaenv}% \begin{minipage}[t]{\marginparwidth}% \raggedright\ttfamily\small - \textcolor{mypkgcolor}{{\textbackslash#1#2}}\myoarg + \textcolor{pkgcolor}{{\textbackslash#1#2}}\myoarg [type=tt,sbc=gray,ac=lightgray,cf=optcolor]{keyval ~ list}\par% \hspace{0.5cm}\mymeta[type=tt,ac=lightgray,cf=gray]{env ~ contents}\par% - \textcolor{mypkgcolor}{{\textbackslash #3#2}}\par + \textcolor{pkgcolor}{{\textbackslash #3#2}}\par \end{minipage}% \end{lrbox}% \usebox{\boxexaenv} @@ -261,22 +284,20 @@ % \cmdexamp{s m o m o} \DeclareDocumentCommand{\cmdexamp}{o m o m o} { - \group_begin: - \small\ttfamily - \textcolor{mypkgcolor}{\textbackslash#2} - \IfValueT{#1}{ \textcolor{MediumOrchid}{#1} } - \IfValueT{#3}{ \myoarg[type=tt,sbc=gray,ac=lightgray,cf=optcolor]{#3} } - \IfValueTF{#5} - { - \mymeta[ac=gray,type=tt,cf=MediumOrchid]{#5}% - \mymeta[type=tt,ac=gray,cf=optcolor]{#4} - \mymeta[ac=gray,type=tt,cf=MediumOrchid]{#5}% - } - { \mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{#4} } - \par - \group_end: - \MYSortIndex{Commands}{Commands ~ provide ~ by ~ - {\fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}}:}% + \group_begin: + \small\ttfamily + \textcolor{pkgcolor}{\textbackslash#2} + \IfValueT{#1}{ \textcolor{MediumOrchid}{#1} } + \IfValueT{#3}{ \myoarg[type=tt,sbc=gray,ac=lightgray,cf=optcolor]{#3} } + \IfValueTF{#5} + { + \mymeta[ac=gray,type=tt,cf=MediumOrchid]{#5}% + \mymeta[type=tt,ac=gray,cf=optcolor]{#4} + \mymeta[ac=gray,type=tt,cf=MediumOrchid]{#5}% + } + { \mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{#4} } + \par + \group_end: } % \keyexamp{mmm} @@ -286,19 +307,25 @@ \adjustbox{outer=-\marginparsep}{\textcolor{black}{\small\ttfamily{#1}}} \textcolor{gray}{\,\bfseries\texttt{=}}\,{} \mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{\small{#2}} - \hfill\textcolor{gray}{ \small (\textsf{default}:~\emph{#3})} + \hfill\textcolor{gray}{\small\textsf{default}:~\emph{#3}} \par \MYSortIndex{Keys}{Keys>\texttt{#1}}% } +% \mykey{m} +\DeclareDocumentCommand{\mykey}{ m } + { + \textcolor{optcolor}{\texttt{#1}} + \MYSortIndex{Keys}{Keys>\texttt{#1}}% + } + % \mypkg{sm} \NewDocumentCommand{\mypkg}{sm} { \group_begin: \IfBooleanTF{#1} { - %\textsf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}} - \fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}} + \pkglogo \MYSortIndex{packages}{Packages>\texttt{#2}} } { @@ -313,13 +340,12 @@ { \IfBooleanTF{#1} { - \textcolor{mypkgcolor}{\ttfamily{#2}}% - \MYSortIndex{environment}{ Environment ~ provide ~ by ~ - {\fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}}:>\texttt{#2}} + \textcolor{pkgcolor}{\ttfamily{#2}}% + \MYSortIndex{environment}{ Environment ~ provide ~ by ~\pkglogo :>\texttt{#2}} } { - \textcolor{darkgray}{\ttfamily{#2}}% - \MYSortIndex{environment}{Environments>\texttt{#2}} + \textcolor{darkgray}{\ttfamily{#2}}% + \MYSortIndex{environment}{Environments>\texttt{#2}} } } @@ -330,12 +356,8 @@ { \tl_set:Nn \l_tmpa_tl { #2 } \regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl - \textcolor{mypkgcolor}{\ttfamily\textbackslash{\tl_use:N \l_tmpa_tl}} - \MYSortIndex{Commands}{ Commands ~ provide ~ by ~ - { - \fetamontotf{ - \textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}} - }:>\texttt{\textbackslash#2}} + \textcolor{pkgcolor}{\ttfamily\textbackslash{\tl_use:N \l_tmpa_tl}} + \MYSortIndex{Commands}{ Commands ~ provide ~ by ~ \pkglogo :>\texttt{\textbackslash#2}} } { \textcolor{darkgray}{\ttfamily\textbackslash{#2}} @@ -363,10 +385,9 @@ \lstnewenvironment{verbatimsc} { \lstset{ - language=,% - basicstyle= \ttfamily, - columns = fullflexible, - gobble = 2,% + language =,% + basicstyle = \ttfamily\small, + gobble = 2,% } }{} \makeatother @@ -376,100 +397,100 @@ % Create a language for documentation \lstdefinelanguage{scontents-doc}{ - texcsstyle=*,% - escapechar=`,% - extendedchars=true,% - breakatwhitespace=true,% - breaklines=true,% - keepspaces=true,% - columns=fullflexible,% - stringstyle= {\color{red}},% - basicstyle=\ttfamily\small,% - alsoletter={-,@,.},% + texcsstyle = *,% + escapechar = Ç,% + extendedchars = true,% + keepspaces = true,% + stringstyle = {\color{red}},% + basicstyle = \ttfamily\small,% + alsoletter = {-,@,.},% % comments - morecomment=[l]{\%},% - commentstyle=\lmmitalic\small\itshape\color{lightgray},% + morecomment = [l]{\%},% + commentstyle = \ttfamily\small\color{lightgray},% % Important words 1 - keywordstyle=[1]{\color{gray}},% - keywords=[1]{begin,end,Verbatim},% + keywordstyle = [1]{\color{gray}},% + keywords = [1]{begin,end,Verbatim,env,myseq,false},% % Other words 2 - keywordstyle=[2]{\color{blue!75}},% - keywords=[2]{usepackage,section,documentclass,input,usemodule, - subsection,ExplSyntaxOff,ExplSyntaxOn,RequirePackage, - ProvidesExplPackage},% + keywordstyle = [2]{\color{blue!75}},% + keywords = [2]{usepackage,section,documentclass,input,usemodule, + subsection,ExplSyntaxOff,ExplSyntaxOn,RequirePackage, + ProvidesExplPackage},% % Other words 3 - keywordstyle=[3]{\color{optcolor!85}},% - keywords=[3]{document,article,setlength,pagestyle,definecolor},% + keywordstyle = [3]{\color{optcolor!85}},% + keywords = [3]{document,article,setlength,pagestyle,definecolor},% % Reserved words 4 (scontents pkg) - keywordstyle=[4]{\color{mypkgcolor}},% - keywords=[4]{scontents,Scontents,getstored,typestored,verbatimsc,% - endverbatimsc,countsc,meaningsc,foreachsc,macros - endscontents,startscontents,stopscontents,scontents.tex},% -% Reserved in red - keywordstyle=[5]{\color{red}},% - keywords=[5]{makeatletter,makeatother,let,verb,@undefined,makebox,def,% - par,item,parindent,lstinline,@ifpackagelater,ver@xparse.sty,% - dospecials,do@noligs,char,outer},% -% Reserved in orange - keywordstyle=[6]{\color{optcolor}},% - keywords=[6]{store-cmd,store-env,print-env,print-cmd,write-env,% - start,stopt,wrapper,sep,step,before,after,write-out,% - width-tab,force-eol,inner,outer,I,J,M,L,Ascheol},% -% Reserved in orange - keywordstyle=[7]{\color{OrangeRed}},% - keywords=[7]{DefineVerbatimEnvironment,lstnewenvironment,newminted,% - newtheorem,newenvironment,VerbatimEnvironment},% + keywordstyle = [4]{\color{pkgcolor}},% + keywords = [4]{scontents,Scontents,getstored,typestored,verbatimsc,% + endverbatimsc,countsc,meaningsc,foreachsc,macros,newenvsc, + endscontents,startscontents,stopscontents,scontents.tex},% +% Reserved words 5 (in red) + keywordstyle = [5]{\color{red}},% + keywords = [5]{makeatletter,makeatother,let,verb,@undefined,makebox,def,% + par,item,parindent,lstinline,@ifpackagelater,ver@xparse.sty,% + ver@scontents.sty,dospecials,do@noligs,char,outer,jobname,inner},% +% Reserved words 6 (optcolor) + keywordstyle = [6]{\color{optcolor}},% + keywords = [6]{store-cmd,store-env,print-env,print-cmd,write-env,% + start,stopt,wrapper,sep,step,before,after,write-out,% + overwrite,width-tab,force-eol,inner,outer,I,J,M,L,Ascheol},% +% Reserved words 7 (OrangeRed) + keywordstyle = [7]{\color{OrangeRed}},% + keywords = [7]{DefineVerbatimEnvironment,lstnewenvironment,newminted,% + newtheorem,newenvironment,VerbatimEnvironment,myenvstore},% % literate - literate=*{\{}{{{\color{gray}{\char`\{}}}}{1} - {\}}{{{\color{gray}{\char`\}}}}}{1} - {\|}{{{\color{gray}{\char`\|}}}}{1} - {\$}{{{\color{gray}{\char`\$}}}}{1} - {\#}{{{\color{optcolor}{\char`\#}}}}{1} - {[}{{\textcolor{gray}{[}}}{1} - {]}{{\textcolor{gray}{]}}}{1} - {,}{{\textcolor{gray}{,}}}{1} - {;}{{\textcolor{gray}{;}}}{1} - {\&}{{\textcolor{gray}{\&}}}{1} - {>}{{\textcolor{OrangeRed}{\guillemotright}}}{1} - {*}{{\textcolor{MediumOrchid}{*}}}{1} - %{@}{{\textcolor{red}{@}}}{1} - {\^}{{\textcolor{optcolor}{\textasciicircum}}}{1} - {0}{{\textcolor{MediumOrchid}{0}}}{1} - {1}{{\textcolor{MediumOrchid}{1}}}{1} - {2}{{\textcolor{MediumOrchid}{2}}}{1} - %{3}{{\textcolor{MediumOrchid}{3}}}{1}% expl3 - {4}{{\textcolor{MediumOrchid}{4}}}{1} - {5}{{\textcolor{MediumOrchid}{5}}}{1} - {6}{{\textcolor{MediumOrchid}{6}}}{1} - {7}{{\textcolor{MediumOrchid}{7}}}{1} - {8}{{\textcolor{MediumOrchid}{8}}}{1} - {9}{{\textcolor{MediumOrchid}{9}}}{1} - {.0}{{\textcolor{MediumOrchid}{.0}}}{2}% Following is to ensure that only periods - {.1}{{\textcolor{MediumOrchid}{.1}}}{2}% followed by a digit are changed. - {.2}{{\textcolor{MediumOrchid}{.2}}}{2} - {.3}{{\textcolor{MediumOrchid}{.3}}}{2} - {.4}{{\textcolor{MediumOrchid}{.4}}}{2} - {.5}{{\textcolor{MediumOrchid}{.5}}}{2} - {.6}{{\textcolor{MediumOrchid}{.6}}}{2} - {.7}{{\textcolor{MediumOrchid}{.7}}}{2} - {.8}{{\textcolor{MediumOrchid}{.8}}}{2} - {.9}{{\textcolor{MediumOrchid}{.9}}}{2} - {=}{{\textcolor{gray}{=}}}{1},% + literate =*{\{}{{{\color{gray}{\char`\{}}}}{1} + {\}}{{{\color{gray}{\char`\}}}}}{1} + {\|}{{{\color{gray}{\char`\|}}}}{1} + {\$}{{{\color{gray}{\char`\$}}}}{1} + {\#}{{{\color{optcolor}{\char`\#}}}}{1} + {[}{{\textcolor{gray}{[}}}{1} + {]}{{\textcolor{gray}{]}}}{1} + {,}{{\textcolor{gray}{,}}}{1} + {;}{{\textcolor{gray}{;}}}{1} + {`}{{\textcolor{gray}{\textasciigrave}}}{1} + {\&}{{\textcolor{gray}{\&}}}{1} + {>}{{\textcolor{OrangeRed}{\guillemotright}}}{1} + {<}{{\textcolor{OrangeRed}{\guillemotleft}}}{1} + {*}{{\textcolor{MediumOrchid}{*}}}{1} + {\^}{{\textcolor{optcolor}{\textasciicircum}}}{1} + {0}{{\textcolor{MediumOrchid}{0}}}{1} + {1}{{\textcolor{MediumOrchid}{1}}}{1} + {2}{{\textcolor{MediumOrchid}{2}}}{1} + {3}{{\textcolor{MediumOrchid}{3}}}{1} + {4}{{\textcolor{MediumOrchid}{4}}}{1} + {5}{{\textcolor{MediumOrchid}{5}}}{1} + {6}{{\textcolor{MediumOrchid}{6}}}{1} + {7}{{\textcolor{MediumOrchid}{7}}}{1} + {8}{{\textcolor{MediumOrchid}{8}}}{1} + {9}{{\textcolor{MediumOrchid}{9}}}{1} + {.0}{{\textcolor{MediumOrchid}{.0}}}{2}% Following is to ensure that only periods + {.1}{{\textcolor{MediumOrchid}{.1}}}{2}% followed by a digit are changed. + {.2}{{\textcolor{MediumOrchid}{.2}}}{2} + {.3}{{\textcolor{MediumOrchid}{.3}}}{2} + {.4}{{\textcolor{MediumOrchid}{.4}}}{2} + {.5}{{\textcolor{MediumOrchid}{.5}}}{2} + {.6}{{\textcolor{MediumOrchid}{.6}}}{2} + {.7}{{\textcolor{MediumOrchid}{.7}}}{2} + {.8}{{\textcolor{MediumOrchid}{.8}}}{2} + {.9}{{\textcolor{MediumOrchid}{.9}}}{2} + {=}{{\textcolor{gray}{=}}}{1},% }[keywords,tex,comments,strings]% end languaje % \begin{examplecode}[key=val]...\end{examplecode} \lstnewenvironment{examplecode}[1][]{% \lstset{ - language=scontents-doc,% - stringstyle= {\color{red}},% - basicstyle=\ttfamily\small,% - numbersep=1em,% - numberstyle=\tiny\color{lightgray}\noaccsupp,% - rulecolor=\color{gray!50},% - framesep=\fboxsep,% - framerule=\fboxrule,% - xleftmargin=\dimexpr\fboxsep+\fboxrule\relax,% - xrightmargin=\dimexpr\fboxsep+\fboxrule\relax,% + language = scontents-doc,% + stringstyle = {\color{red}},% + basicstyle = \ttfamily\small,% + columns = fullflexible,% + fontadjust = true,% + aboveskip = 8pt,% + belowskip = 5pt,% + rulecolor = \color{gray!50},% + framesep = \fboxsep,% + framerule = \fboxrule,% + xleftmargin = \dimexpr\fboxsep+\fboxrule\relax,% + xrightmargin= \dimexpr\fboxsep+\fboxrule\relax,% #1,% }% close lstset }{}% close examplecode @@ -477,56 +498,55 @@ % \lstinline[style=inline]|...| \lstdefinestyle{inline} { - language=scontents-doc,% - escapechar=`,% - upquote=true,% - numbersep=1em,% - columns=fullflexible,% - numberstyle=\tiny\color{lightgray}\noaccsupp,% - literate=*{\%}{{\bfseries\textcolor{gray}{\%}}}{1} + language = scontents-doc,% + upquote = true,% + numbersep = 1em,% + numberstyle = \tiny\color{lightgray}\noaccsupp,% + literate =*{\%}{{\textcolor{gray}{\%}}}{1} } % Set default \lstinline style \lstset{style=inline} + +% Set short §...§ \lstMakeShortInline[language=scontents-doc,basicstyle=\ttfamily]§ % Get file info \GetFileInfo{\jobname.sty} % Config hyperref -\definecolor{linkcolour}{cmyk}{0.64,0,0.95,0.40}% <-Olive Green \hypersetup{ - linkcolor = linkcolour,% - citecolor = linkcolour,% - urlcolor = linkcolour,% + allcolors = linkcolor, colorlinks = true,% linktoc = all,% pdftitle = {.:: The scontents package --- \fileinfo{} ::.},% pdfauthor = {Pablo González L}, pdfsubject = {Documentation for \fileversion{} [\filedate] },% - pdfcopyright = {\textcopyright 2019 by Pablo González}, - pdfcontacturl = {https://github.com/pablgonz/scontents}, pdfkeywords = {sequences, contents, external files, expl3, xparse, l3seq, store contents}, - pdfstartview = {FitH},% bookmarksopenlevel = 1,% } % Configuration titleps and titlesec \settitlemarks{section} -\renewpagestyle{plain}[\color{gray}\small\sffamily]{ -\setfoot{}{}{\thepage/\pageref{LastPage}}} - -\newpagestyle{myheader}[\color{gray}\small\sffamily]{ -\renewcommand\makeheadrule{\color{gray}\rule[0.45\baselineskip]{\linewidth}{0.4pt}} -\setfoot{\scalebox{0.8}{\mylogo}\space\textcopyright\space 2019 by Pablo González} - {} - {\thepage/\pageref{LastPage}} -\sethead{\raisebox{0.75\baselineskip}{Documentation for \fileversion\space[\filedate]}} - {} - {\raisebox{0.75\baselineskip}{\scshape\small\S.\thesection\space\sectiontitle}} +\renewpagestyle{plain}[\color{optcolor}\small\sffamily]{% +\setfoot{\rlap{\hskip\dimexpr-\oddsidemargin-1in\relax% + \parbox{1.93\paperwidth\relax}{\hfil\thepage\,/\,\pageref{LastPage}}}}% + {}% + {}% +} +\newpagestyle{myheader}[\color{optcolor}\small\sffamily]{% +\renewcommand\makeheadrule{% +\rlap{\hskip\dimexpr-\oddsidemargin-1in\relax + \color{rulecolor}\rule[0.3cm]{\paperwidth}{0.7cm}}\hss +} +\setfoot{\rlap{\hskip\dimexpr-\oddsidemargin-1in\relax% + \parbox{1.93\paperwidth\relax}{\hfil\thepage\,/\,\pageref{LastPage}}}}% + {\parbox{\textwidth}{\raggedright \textcolor{gray}{\raisebox{-1pt}{\textcopyright}{}2019 by Pablo González}}}% + {}% +\sethead{\llap{\raisebox{0.55cm}{\parbox{\dimexpr\oddsidemargin+1in\relax}{\makebox[0pt][l]{\hspace{15pt}\pkglogo\space\fileversion}}}}} + {\raisebox{0.55cm}{\parbox{\textwidth}{\hspace*{-\oddsidemargin}\centering\small\S.\thesection\space\sectiontitle}}}% + {}% } - -\setlength{\headheight}{21pt}% \titlecontents{section}[0mm]{}% {\bfseries\contentspush{\makebox[5mm][l]{\thecontentslabel\hfill}}}% @@ -541,7 +561,7 @@ \makeatletter \renewcommand\tableofcontents{% \begingroup% -\section*{\contentsname\quad{\color{optcolor}\leaders\hrule height 5pt depth -4.4pt\hfill}% +\section*{\contentsname\quad{\color{gray}\leaders\hrule height 5pt depth -4.4pt\hfill}% \@mkboth{% \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% \vspace*{-14pt} @@ -549,11 +569,18 @@ \begin{multicols}{2}% \@starttoc{toc}% \end{multicols}% -\vspace*{-3pt}{\color{optcolor}\hrule height 0.6pt}% +\vspace*{-3pt}{\color{gray}\hrule height 0.6pt}% \vspace*{5pt} \endgroup } \makeatother +% thanks +\makeatletter +\renewcommand*{\@fnsymbol}[1]{\ensuremath{\ifcase#1\or \textcolor{pkgcolor}{*} +\or \textcolor{pkgcolor}{\dagger} \or \ddagger\or \mathsection +\or \mathparagraph\or \|\or **\or \dagger\dagger +\or \ddagger\ddagger \else\@ctrerr\fi}} +\makeatother \begin{document} \DocInput{\jobname.dtx} \end{document} @@ -561,7 +588,7 @@ % \fi % % \title{ -% \scalebox{1.025}{\mylogo}\\[2pt] +% \scalebox{1.57}{\pkglogo}\\[2pt] % \Large % \textsf{Stores \hologo{LaTeX}}{ \fetamontotf{contents} }\\[3pt] % \fileversion{} --- \filedate\thanks{ @@ -569,24 +596,24 @@ % \filedate.}\\[25pt] % \author{ % \large -% \raisebox{-1pt}{\textcopyright}{}2019 by Pablo González -% \thanks{E-mail: \textsf{\guillemotleft}\email{pablgonz@educarchile.cl}\textsf{\guillemotright}}% +% \raisebox{-1pt}{\textcopyright}{}2019 by Pablo González\thanks{ +% E-mail: \textcolor{OrangeRed}{\textsf{\guillemotleft}}\email{pablgonz@educarchile.cl}\textcolor{OrangeRed}{\textsf{\guillemotright}}. +% }% % } % \small -% \textsc{ctan}: \url{http://www.ctan.org/pkg/scontents}\\ -% \textsc{git}: \url{https://github.com/pablgonz/scontents} +% \textsc{ctan}: \url{https://www.ctan.org/pkg/scontents}\\ +% \textcolor{gray}{\scriptsize\faIcon[regular]{github}}\,\,\,\url{https://github.com/pablgonz/scontents} % \vspace*{-2cm} % } % \date{} % \maketitle % -% \begin{scontents}[store-env=abstract,print-env=true] +% \begin{scontents}[store-env=abstract, print-env=true] % \begin{abstract} -% The \mypkg*{scontents} package stores valid \hologo{LaTeX} code in -% \mymeta{sequences} using the \mypkg{l3seq} module of \mypkg{expl3}. -% The \mymeta{stored content}, including \emph{verbatim}, can be used -% as many times as desired in the document, additionally can be written -% to \mymeta{external files}. +% This package allows to store \hologo{LaTeX} code, including \enquote{\emph{verbatim}}, +% in \mymeta{sequences} using the \mypkg{l3seq} module of \mypkg{expl3}. The \mymeta{stored +% content} can be used as many times as desired in the document, additionally you can write +% to \mymeta{external files} or show it in \mymeta{verbatim style}. % \end{abstract} % \end{scontents} % @@ -597,10 +624,10 @@ % \section{Motivation and Acknowledgments} % % In \hologo{LaTeX} there is no direct way to record content for later use, although -% you can do this using §\macros§, recording \mymeta{verbatim content} is a +% you can do this using §\macros§, recording \mymeta[type=rm]{verbatim content} is a % problem, usually you can avoid this by creating external files or boxes. The % general idea of this package is to try to imitate this implementation -% \emph{buffers} that has \hologo{ConTeXt} which allows you to save content in +% \enquote{\emph{buffers}} that has \hologo{ConTeXt} which allows you to save content in % memory, including \emph{verbatim}, to be used later. The package % \mypkg{filecontentsdef} solves this problem and since \mypkg{expl3} has an % excellent way to manage data, ideas were combined giving rise to this package. @@ -613,7 +640,7 @@ % of the \href{https://tex.stackexchange.com}{TeX-SX} community who have provided % great answers and ideas. Here a note of the main ones: % -% \begin{enumerate}[nosep] +% \begin{enumerate}[left=0pt, labelsep=5pt, noitemsep, nosep, label=\small\arabic*.] % \item \href{https://tex.stackexchange.com/q/45946/7832}{Stack datastructure using LaTeX} % % \item \href{https://tex.stackexchange.com/q/5338/7832}{LaTeX equivalent of ConTeXt buffers} @@ -651,12 +678,11 @@ % \subsection{Description of the package and load} % % \begin{scontents}[store-env=description, print-env=true] -% The \mypkg*{scontents} package allows to \mymeta{store contents} in -% \mymeta{sequences} or \mymeta{external files}. In some ways it is -% similar to the \mypkg{filecontentsdef} package, with the difference -% in which the \mymeta{content} is stored. The idea behind this package -% is to get an approach to \hologo{ConTeXt} \enquote{\emph{buffers}} -% by making use \mymeta{sequences}. +% The \mypkg*{scontents} package allows to \mymeta{store contents} in \mymeta{sequences} +% or \mymeta{external files}. In some ways it is similar to the \mypkg{filecontentsdef} +% package, with the difference in which the \mymeta{content} is stored. The idea behind +% this package is to get an approach to \hologo{ConTeXt} \enquote{\emph{buffers}} by +% making use \mymeta{sequences}. % \end{scontents} % % The package is loaded in the usual way: @@ -671,13 +697,14 @@ % \iffalse %</example> % \fi -% \vspace*{-5pt} +% % or +% % \iffalse %<*example> % \fi \begin{examplecode}[frame=single] -\usepackage`\small\myoarg[type=tt]{key \textnormal{\textcolor{gray}{=}} val}`{scontents} +\usepackageÇ\small\myoarg[type=tt]{key \textnormal{\textcolor{gray}{=}} val}Ç{scontents} \end{examplecode} % \iffalse %</example> @@ -715,8 +742,8 @@ % % Some users use horizontal "TAB"s \enquote{\LKeyTab} from keyboard to indented the source % code of the document and depending on the text editor used, some will use real "TAB"s -% (\enquote{hard tabs}), others with \enquote{soft tabs}(\verbvisiblespace\verbvisiblespace{} -% or \verbvisiblespace\verbvisiblespace\verbvisiblespace\verbvisiblespace) or both. +% (\enquote{hard tabs}), others with \enquote{soft tabs}(\verb*| | or \verb*| |) +% or both. % % At first glance it may seem the same, but the way in which "TAB"s (\enquote{hard tabs}) % are processed according to the context in which they are found within @@ -745,7 +772,7 @@ % % Most of the options can be passed directly to the package or using the % command \ics*{setupsc}. All boolean keys can be passed using the -% equal sign \enquote{\textnormal{\textcolor{optcolor}{=}}} or just the +% equal sign \enquote{\textnormal{\textcolor{gray}{=}}} or just the % name of the key, all unknown keys will return an error. In this section % are described some of the options, a summary of all options is shown in % section \ref{sec:optover}. @@ -764,32 +791,37 @@ % % \keyexamp{verb-font}{font family}{\textnormal{\ttfamily\textbackslash{}ttfamily}} % Sets the \mymeta{font family} used to display the \mymeta{stored content} for the -% commands \ics*{typestored} and \ics*{meaningsc}. This key is only available +% \ics*{typestored} and \ics*{meaningsc} commands. This key is only available % as a package option or using \ics*{setupsc}. % % \medskip % % \keyexamp{store-all}{seq name}{not used} -% It is a \mymeta{meta-key} that sets the §store-env§ key of the \myenv*{scontents} -% environment and the §store-cmd§ key of the \ics*{Scontents} command. This key is +% It is a \mymeta{meta-key} that sets the \mykey{store-env} key of the \myenv*{scontents} +% environment and the \mykey{store-cmd} key of the \ics*{Scontents} command. This key is % only available as a package option or using \ics*{setupsc}. % % \medskip % +% \keyexamp{overwrite}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} +% Sets whether the \mymeta{files} generated by \mykey{write-out} and \mykey{write-env} +% from the \myenv*{scontents} environment will be rewritten. This key is +% available as a package option or using \ics*{setupsc} or \myenv*{scontents} +% environment. +% \medskip +% % \keyexamp{print-all}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} -% It is a \mymeta{meta-key} that sets the §print-env§ key of the \myenv*{scontents} -% environment and the §print-cmd§ key of the \ics*{Scontents} command. This key is +% It is a \mymeta{meta-key} that sets the \mykey{print-env} key of the \myenv*{scontents} +% environment and the \mykey{print-cmd} key of the \ics*{Scontents} command. This key is % only available as a package option or using \ics*{setupsc}. % -% \medskip -% % \keyexamp{force-eol}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false} % Sets if the end of line for the \mymeta{stored content} is hidden or not. % This key is necessary only if the last line is the closing of some % environment defined by the \mypkg{fancyvrb} package as §\end{Verbatim}§ -% or another environment that does not support a comments \enquote{\textcolor{gray}{\%}} -% after closing §\end{§\textcolor{gray}{...}§}%§. This key is available for the \myenv*{scontents} -% environment and the \ics*{Scontents} command. +% or another environment that does not support a comments \enquote{\ttfamily\textcolor{gray}{\%}} +% after closing §\end{<env>}%§. This key is available +% for the \myenv*{scontents} environment and the \ics*{Scontents} command. % % \keyexamp{width-tab}{integer}{1} % Sets the equivalence in \mymeta{spaces} for the character "TAB" @@ -800,29 +832,30 @@ % \subsection{Options Overview} % \label{sec:optover} % -% \newcommand*{\xmark}{\textcolor{red}{✘}}% -% \newcommand*{\cmark}{\textcolor{green}{✔}}% +% \newcommand*{\xmark}{\textcolor{OrangeRed}{✘}}% +% \newcommand*{\cmark}{\textcolor{linkcolor}{✔}}% % -% Summary of available options. +% Summary of available options: % % \setlength{\tabcolsep}{0.25em} % \begin{center} % \small % \begin{tabular}{cccccccc} % \toprule -% \texttt{key} &package &\ics{setupsc} &\myenv*{scontents} &\ics*{Scontents} &\ics*{Scontents*} &\ics*{typestored} &\ics*{meaningsc}\\ +% \texttt{key} &package &\ics*{setupsc} &\myenv*{scontents} &\ics*{Scontents} &\ics*{Scontents*} &\ics*{typestored} &\ics*{meaningsc}\\ % \midrule -% \texttt{store-env} & \cmark & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ -% \texttt{store-cmd} & \cmark & \cmark & \xmark & \cmark & \cmark & \xmark & \xmark \\ -% \texttt{print-env} & \cmark & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ -% \texttt{print-cmd} & \cmark & \cmark & \xmark & \cmark & \cmark & \xmark & \xmark \\ -% \texttt{print-all} & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\ -% \texttt{store-all} & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\ -% \texttt{write-env} & \xmark & \xmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ -% \texttt{write-out} & \xmark & \xmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ -% \texttt{width-tab} & \cmark & \cmark & \xmark & \xmark & \xmark & \cmark & \cmark \\ -% \texttt{force-eol} & \cmark & \cmark & \cmark & \xmark & \cmark & \xmark & \xmark \\ -% \texttt{verb-font} & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{store-env} & \cmark & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{store-cmd} & \cmark & \cmark & \xmark & \cmark & \cmark & \xmark & \xmark \\ +% \mykey{print-env} & \cmark & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{print-cmd} & \cmark & \cmark & \xmark & \cmark & \cmark & \xmark & \xmark \\ +% \mykey{print-all} & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{store-all} & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{write-env} & \xmark & \xmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{write-out} & \xmark & \xmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{overwrite} & \cmark & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark \\ +% \mykey{width-tab} & \cmark & \cmark & \xmark & \xmark & \xmark & \cmark & \cmark \\ +% \mykey{force-eol} & \cmark & \cmark & \cmark & \xmark & \cmark & \xmark & \xmark \\ +% \mykey{verb-font} & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\ % \bottomrule % \end{tabular} % \end{center} @@ -870,14 +903,11 @@ % \fi \begin{examplecode}[frame=single] \begin{scontents}[store-env=outer] -This text is in the outer environment -(before nested). +This text is in the outer environment (before nested). \begin{scontents}[store-env=inner] -This text is found in the inner environment -(inside of nested). +This text is found in the inner environment (inside of nested). \end{scontents} -This text is in the outer environment -(after nested). +This text is in the outer environment (after nested). \end{scontents} \end{examplecode} % \iffalse @@ -886,13 +916,11 @@ This text is in the outer environment % % Of course, content stored in the \mymeta{inner} sequence is only available % after content stored in the \mymeta{outer} sequence one has been retrieved, -% either by using the key §print-env§ or §\getstored§ command. +% either by using the key \mykey{print-env} or \ics*{getstored} command. % % It is advisable to store content within sequences with different names, % so as not to get lost in the order in which content is stored. % -% \newpage -% % \subsection*{Notes for \hologo{plainTeX} and \hologo{ConTeXt} users} % % In \hologo{plainTeX} there is not environments as in \hologo{LaTeX}. @@ -918,7 +946,7 @@ This text is in the outer environment % The environment options can be configured globally using option % in package or the \ics*{setupsc} command and locally using % \myoarg{key \textnormal{\textcolor{gray}{=}} val} in the environment. -% The key §force-eol§ is available for this environment. +% The key \mykey{force-eol} is available for this environment. % % \keyexamp{store-env}{seq name}{contents} % Sets the name of the \mymeta{sequence} in which the contents will be @@ -957,6 +985,43 @@ This text is in the outer environment % must add \texttt{\textcolor{optcolor}{-8bit}} at the command line, % otherwise you will get \hologo{TeX}-"TAB" (§^^I§) in \mymeta{file.ext}. % +% +% \subsection{The command \cs{newenvsc}} +% \label{sec:newenvsc} +% +% \newsavebox{\exaboxtmp} +% \begin{lrbox}{\exaboxtmp} +% \small\ttfamily +% \textcolor{pkgcolor}{\textbackslash newenvsc}\mymarg[type=tt]{env name}\myoarg[type=tt]{initial keys} +% \end{lrbox} +% +% \vspace*{-10pt} +% +% \begin{function}{\newenvsc} +% \begin{syntax} +% \usebox{\exaboxtmp} +% \end{syntax} +% \end{function} +% +% The command \ics*{newenvsc} allows you to create \mymeta{new environments} +% based on the same characteristics of the \myenv*{scontents} environment. +% The values entered in \myoarg{initial keys} will be considered as the +% default values for this new environment and the valid \mymeta{keys} are the +% same as those of the \myenv*{scontents} environment. For example: +% +% \iffalse +%<*example> +% \fi +\begin{examplecode}[frame=single] +\newenvsc{myenvstore}[store-env=myseq,print-env=false] +\end{examplecode} +% \iffalse +%</example> +% \fi +% +% created the §myenvstore§ environment that stored the content in the §myseq§ +% sequence and will not display the content when it is executed. +% % \subsection{The command \cs{Scontents}} % \label{sec:Scontents} % @@ -987,6 +1052,8 @@ This text is in the outer environment % \enquote{\texttt{\textcolor{gray}{\textbackslash\}}}} must also be % balanced if the argument is used with braces and "TAB"s characters typed % from the keyboard are converted into spaces. +% The starred argument (§*§) and \myoarg{key \textnormal{\textcolor{gray}{=}} val} +% must not be separated by horizontal spaces between them and the command. % % Both versions can be used anywhere in the document and cannot be used % as an \mymeta{argument} for other command. @@ -996,7 +1063,7 @@ This text is in the outer environment % % The command options can be configured globally using option in package % or the \ics*{setupsc} command and locally using \myoarg{key \textnormal{\textcolor{gray}{=}} val}. -% The key §force-eol§ is available for this command. +% The key \mykey{force-eol} is available for this command. % % \keyexamp{store-cmd}{seq name}{contents} % Sets the name of the \mymeta{sequence} in which the contents will be stored. @@ -1022,9 +1089,9 @@ This text is in the outer environment % % The command \ics*{getstored} gets the content stored in \mymarg{seq name} % according to the \mymeta{index} in which it was stored. The command is -% robust and can be used as an \mymeta{argument} for another command. If the -% optional argument is not passed it defaults to the first element stored -% in the \mymarg{seq name}. +% robust and can be used as an \mymeta{argument} for another command. If +% the optional argument is not passed, the default value is the \enquote{last +% element} stored in \mymarg{seq name}. % % \subsection{The command \cs{foreachsc}} % \label{sec:foreachsc} @@ -1072,8 +1139,13 @@ This text is in the outer environment % Sets the \mymarg{code} that will be executed \mymeta{after} each content stored % in \mymarg{seq name}. The \mymarg{code} must be passed between braces. % -% \keyexamp{wrapper}{code \textnormal{\textcolor{gray}{\{\#1\}}} more code}{empty} -% Wraps the content stored in \mymarg{seq name} referenced by \mymarg{\#1}. +% \newsavebox{\hashbox} +% \begin{lrbox}{\hashbox} +% \lstinline[language=scontents-doc,basicstyle=\ttfamily]+{#1}+ +% \end{lrbox} +% +% \keyexamp{wrapper}{code{} \space\usebox{\hashbox} more code}{empty} +% Wraps the content stored in \mymarg{seq name} referenced by §{#1}§. % The \mymarg{code} must be passed between braces. For example % §\foreachsc[wrapper={\makebox[1em][l]{#1}}]{contents}§. % @@ -1093,9 +1165,10 @@ This text is in the outer environment % \end{function} % % If the optional argument is not passed it defaults to the first element -% stored in the \mymarg{seq name}. The key §width-tab§ is available for +% stored in the \mymarg{seq name}. The key \mykey{width-tab} is available for % this command. % +% % \subsection{The environment \env{verbatimsc}} % \label{sec:verbatimsc} % @@ -1111,9 +1184,9 @@ This text is in the outer environment % a real \emph{verbatim} environment. The \mypkg{verbatim} package is not % compatible with the implementation of the \myenv*{verbatimsc} environment. % -% The \myenv*{verbatimsc} environment can be customized in the following ways: +%^^A \newpage % -% \newpage +% The \myenv*{verbatimsc} environment can be customized in the following ways: % % Using the package \mypkg{fancyvrb}: % \iffalse @@ -1188,7 +1261,7 @@ This text is in the outer environment % \end{function} % % If the optional argument is not passed it defaults to the first element -% stored in the \mymarg{seq name}. The key §width-tab§ is available for +% stored in the \mymarg{seq name}. The key \mykey{width-tab} is available for % this command. % % \subsection{The command \cs{countsc}} @@ -1243,11 +1316,10 @@ This text is in the outer environment \begin{examplecode}[numbers=left] \begin{scontents}[store-env=abstract,print-env=true] \begin{abstract} -The \mypkg*{scontents} package stores valid \hologo{(La)TeX} code in -\mymeta{sequences} using the \mypkg{l3seq} module of \mypkg{expl3}. -The \mymeta{stored content}, including \emph{verbatim}, can be used -as many times as desired in the document, additionally can be written -to \mymeta{external files}. +This package allows to store \hologo{LaTeX} code, including \enquote{\emph{verbatim}}, +in \mymeta{sequences} using the \mypkg{l3seq} module of \mypkg{expl3}. The \mymeta{stored +content} can be used as many times as desired in the document, additionally you can write +to \mymeta{external files} or show it in \mymeta{verbatim style}. \end{abstract} \end{scontents} \end{examplecode} @@ -1262,12 +1334,11 @@ to \mymeta{external files}. % \fi \begin{examplecode}[numbers=left] \begin{scontents}[store-env=description, print-env=true] -The \mypkg*{scontents} package allows to \mymeta{store contents} in -\mymeta{sequences} or \mymeta{external files}. In some ways it is -similar to the \mypkg{filecontentsdef} package, with the difference -in which the \mymeta{content} is stored. The idea behind this package -is to get an approach to \hologo{ConTeXt} \enquote{\emph{buffers}} -by making use \mymeta{sequences}. +The \mypkg*{scontents} package allows to \mymeta{store contents} in \mymeta{sequences} +or \mymeta{external files}. In some ways it is similar to the \mypkg{filecontentsdef} +package, with the difference in which the \mymeta{content} is stored. The idea behind +this package is to get an approach to \hologo{ConTeXt} \enquote{\emph{buffers}} by +making use \mymeta{sequences}. \end{scontents} \end{examplecode} % \iffalse @@ -1280,7 +1351,19 @@ by making use \mymeta{sequences}. % \section{Examples} % % These are some adapted examples that have served as inspiration for -% the creation of this package. +% the creation of this package. The examples are attached to this documentation +% and can be extracted from your PDF viewer or from the command line by running: +% \iffalse +%<*example> +% \fi +\begin{examplecode}[frame=single] +$ pdfdetach -saveall scontents.pdf +\end{examplecode} +% \iffalse +%</example> +% \fi +% and then you can use the excellent \arara\footnote{The cool \TeX\ automation tool: +% \url{https://www.ctan.org/pkg/arara}} tool to compile them. % % \subsection{From \texttt{answers} package} % @@ -1290,6 +1373,8 @@ by making use \mymeta{sequences}. %<*example> % \fi \begin{scontents}[write-out=scexamp1.ltx] +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } \documentclass{article} \usepackage[store-cmd=solutions]{scontents} \newtheorem{ex}{Exercise} @@ -1314,7 +1399,7 @@ Second exercise % \fi % % Adaptation of example 1 of the package \mypkg{answers} -% \textattachfile[color=0 0 1]{scexamp1.ltx}{\faFile*[regular]}. +% \textattachfile[color=linkcolor,print=false]{scexamp1.ltx}{\faFile*[regular]}. % \lstinputlisting[language=scontents-doc,numbers=left]{scexamp1.ltx} % % \subsection{From \texttt{filecontentsdef} package} @@ -1325,6 +1410,8 @@ Second exercise %<*example> % \fi \begin{scontents}[write-out=scexamp2.ltx] +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } \documentclass{article} \usepackage[store-env=defexercise,store-cmd=defexercise]{scontents} \pagestyle{empty} @@ -1356,7 +1443,7 @@ seventies that the \NSA\ has known that for 40 years.\par % \fi % % Adaptation of example from package \mypkg{filecontentsdef} -% \textattachfile[color=0 0 1]{scexamp2.ltx}{\faFile*[regular]}. +% \textattachfile[color=linkcolor,print=false]{scexamp2.ltx}{\faFile*[regular]}. % \lstinputlisting[language=scontents-doc,numbers=left]{scexamp2.ltx} % % \subsection{From TeX-SX} @@ -1367,6 +1454,8 @@ seventies that the \NSA\ has known that for 40 years.\par %<*example> % \fi \begin{scontents}[write-out=scexamp3.ltx] +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } \documentclass{article} \usepackage[store-cmd=tikz]{scontents} \usepackage{tikz} @@ -1418,7 +1507,7 @@ This is a \verb*|fake poor man's buffer :)|. % \fi % % Adapted from \href{https://tex.stackexchange.com/q/5338/7832}{LaTeX equivalent of ConTeXt buffers} -% \textattachfile[color=0 0 1]{scexamp3.ltx}{\faFile*[regular]}. +% \textattachfile[color=linkcolor,print=false]{scexamp3.ltx}{\faFile*[regular]}. % \lstinputlisting[language=scontents-doc,numbers=left]{scexamp3.ltx} % % \subsubsection*{Example 4} @@ -1427,6 +1516,8 @@ This is a \verb*|fake poor man's buffer :)|. %<*example> % \fi \begin{scontents}[write-out=scexamp4.ltx] +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } \documentclass{article} \usepackage{scontents} \pagestyle{empty} @@ -1458,7 +1549,7 @@ This is stored in other: \getstored[1]{other} % \fi % % Adapted from \href{https://tex.stackexchange.com/q/184503/7832}{Collecting contents of environment and store them for later retrieval} -% \textattachfile[color=0 0 1]{scexamp4.ltx}{\faFile*[regular]}. +% \textattachfile[color=linkcolor,print=false]{scexamp4.ltx}{\faFile*[regular]}. % \lstinputlisting[language=scontents-doc,numbers=left]{scexamp4.ltx} % % \subsubsection*{Example 5} @@ -1467,6 +1558,8 @@ This is stored in other: \getstored[1]{other} %<*example> % \fi \begin{scontents}[write-out=scexamp5.ltx] +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } \documentclass{article} \usepackage{scontents} \pagestyle{empty} @@ -1494,10 +1587,9 @@ This is from the verbatim environment: % \fi % % Adapted from \href{https://tex.stackexchange.com/q/373647/7832}{Collect contents of an environment (that contains verbatim content)} -% \textattachfile[color=0 0 1]{scexamp5.ltx}{\faFile*[regular]}. +% \textattachfile[color=linkcolor,print=false]{scexamp5.ltx}{\faFile*[regular]}. % \lstinputlisting[language=scontents-doc,numbers=left]{scexamp5.ltx} % -% \subsection{Customization of \texttt{verbatimsc}} % % \subsubsection*{Example 6} % @@ -1505,7 +1597,40 @@ This is from the verbatim environment: %<*example> % \fi \begin{scontents}[write-out=scexamp6.ltx] +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } +\documentclass[10pt]{article} +\usepackage{scontents} +\newenvsc{forshort}[store-env=forshort,print-env=false] +\begin{document} + +Something in the whole course. + +\begin{forshort} + Just a summary... +\end{forshort} + +\end{document} +\end{scontents} +% \iffalse +%</example> +% \fi +% +% Adapted from \href{https://tex.stackexchange.com/q/509595/7832}{Environment hiding its content} +% \textattachfile[color=linkcolor,print=false]{scexamp6.ltx}{\faFile*[regular]}. +% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp6.ltx} +% +% \subsection{Customization of \texttt{verbatimsc}} +% +% \subsubsection*{Example 7} +% +% \iffalse +%<*example> +% \fi +\begin{scontents}[write-out=scexamp7.ltx] \documentclass{article} +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } \usepackage{scontents} \makeatletter \let\verbatimsc\@undefined @@ -1560,15 +1685,17 @@ Prove new \Verb*{ fancyvrb whit braces } and environment \verb+Verbatim*+ % % Customization of \myenv*{verbatimsc} using the \mypkg{fancyvrb} and % \mypkg{tcolorbox} package -% \textattachfile[color=0 0 1]{scexamp6.ltx}{\faFile*[regular]}. -% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp6.ltx} +% \textattachfile[color=linkcolor,print=false]{scexamp7.ltx}{\faFile*[regular]}. +% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp7.ltx} % -% \subsubsection*{Example 7} +% \subsubsection*{Example 8} % % \iffalse %<*example> % \fi -\begin{scontents}[write-out=scexamp7.ltx] +\begin{scontents}[write-out=scexamp8.ltx] +% arara: pdflatex +% arara: clean: { extensions: [ aux, log] } \documentclass{article} \usepackage{scontents} \makeatletter @@ -1624,16 +1751,17 @@ and more.+ % \fi % % Customization of \myenv*{verbatimsc} using the \mypkg{listings} package -% \textattachfile[color=0 0 1]{scexamp7.ltx}{\faFile*[regular]}. -% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp7.ltx} +% \textattachfile[color=linkcolor,print=false]{scexamp8.ltx}{\faFile*[regular]}. +% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp8.ltx} % -% \subsubsection*{Example 8} +% \subsubsection*{Example 9} % % \iffalse %<*example> % \fi -\begin{scontents}[write-out=scexamp8.ltx] -% need -shell-escape +\begin{scontents}[write-out=scexamp9.ltx] +% arara: xelatex : {shell: true, options: [-8bit]} +% arara: clean: { extensions: [ aux, log] } \documentclass{article} \usepackage{scontents} \makeatletter @@ -1648,19 +1776,22 @@ and more.+ \section{Test \texttt{\textbackslash begin\{scontents\}} whit \texttt{minted}} Test \verb+{scontents}+ \par -\begin{scontents}[write-env=usingtab.tex,force-eol=true] +\begin{scontents}[overwrite,write-env=\jobname.tsc,force-eol=true] Using \verb+scontents+ env no \verb+[key=val]+, save in seq \verb+contents+ with index 1.\par Prove new \Verb*{ new fvextra whit braces } and environment \verb+Verbatim*+ -% Real TABs here :) -\begin{Verbatim}[obeytabs, showtabs, tab=\rightarrowfill, tabcolor=red,showspaces, spacecolor=blue] +\begin{Verbatim}[obeytabs, showtabs, tab=\rightarrowfill, tabcolor=red] No tab One real tab Two real Tab plus one tab \end{Verbatim} \end{scontents} +\section{See \Verb{\jobname.tsc}} +Read \Verb{\jobname.tsc} (shows TABs as red arrows): +\VerbatimInput[obeytabs, showtabs, tab=\rightarrowfill, tabcolor=red]{\jobname.tsc} + \section{Test \texttt{\textbackslash Scontents} whit \texttt{minted}} \Scontents{ We have coded \par this in \LaTeX: $E=mc^2$.} @@ -1679,8 +1810,10 @@ No tab % \fi % % Customization of \myenv*{verbatimsc} using the \mypkg{minted} package -% \textattachfile[color=0 0 1]{scexamp8.ltx}{\faFile*[regular]}. -% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp8.ltx} +% \textattachfile[color=linkcolor,print=false]{scexamp9.ltx}{\faFile*[regular]}. +% \lstinputlisting[language=scontents-doc,numbers=left]{scexamp9.ltx} +% +% \newpage % % \section{Change history} % \label{sec:changes} @@ -1689,6 +1822,8 @@ No tab % development, from the first public implementation using the \mypkg{filecontentsdef} % package to the current version with only \mypkg{expl3}. % +% \medskip +% % \setlist[itemize,1]{label=\textendash,wide=0.5em,nosep,noitemsep,leftmargin=10pt} % \newlength\descrwidth % \settowidth{\descrwidth}{\textsf{v1.0, (ctan), 2019-07-30} } @@ -1696,6 +1831,14 @@ No tab % \begin{description}[font=\small\sffamily,wide=0pt,style=multiline,leftmargin=\descrwidth,nosep,noitemsep] % \item [\fileversion{} (ctan), \filedate] % \begin{itemize} +% \item Add |\newenvsc| command. +% \item Fix nested environment in \hologo{plainTeX} and \hologo{ConTeXt}. +% \item Modified default value in |\getstored|. +% \item Add |overwrite| key to reduce |I/O| operations. +% \item Deleted an unnecessary group in the code. +% \end{itemize} +% \item [v1.7 (ctan), 2019-10-29] +% \begin{itemize} % \item The |verbatimsc| environment was rewritten. % \item Minor adjustments in documentation. % \end{itemize} @@ -1744,18 +1887,24 @@ No tab % \end{itemize} % \item [v1.0 (ctan), 2019-07-30] % \begin{itemize} -% \item First public release, +% \item First public release. % \end{itemize} % \end{description} % % \newpage % +% \indexprologue{ +% The italic numbers denote the pages where the corresponding entry is +% described.} +% % \printindex[userdoc] % % \newpage % +% \StartImplementation +% % \StopEventually{^^A -% \newgeometry{top=0.5in,bottom=0.5in,left=1.0in,right=0.5in,footskip=0.2in,headsep=10pt} +% \newgeometry{top=0.5in,bottom=0.3in,left=1.0in,right=0.5in,footskip=0.2in,headheight=1cm,headsep=0.27cm} % \addtocontents{toc}{\protect\setcounter{tocdepth}{2}} % \cleardoublepage % \phantomsection @@ -1767,10 +1916,18 @@ No tab % \printindex % } % +% % \section{Implementation} % \label{sec:Implementation} % \addtocontents{toc}{\protect\setcounter{tocdepth}{0}} % +% The most recent publicly released version of \mypkg*{scontents} is available at +% \textsc{ctan}: \url{https://www.ctan.org/pkg/scontents}. Historical and +% developmental versions are available at \textcolor{gray}{\scriptsize\faIcon[regular]{github}} +% \url{https://github.com/pablgonz/scontents}. While general feedback via email is +% welcomed, specific bugs or feature requests should be reported through the issue +% tracker: \url{https://github.com/pablgonz/scontents/issues}. +% % \subsection{Declaration of the package} % % First we set up the module name for \pkg{l3doc}: @@ -1780,10 +1937,10 @@ No tab % % Now we define some common macros to hold the package date and version: % \begin{macrocode} -%<loader>\def\ScontentsFileDate{2019-10-29}% -%<core>\def\ScontentsCoreFileDate{2019-10-29}% +%<loader>\def\ScontentsFileDate{2019-11-18}% +%<core>\def\ScontentsCoreFileDate{2019-11-18}% %<*loader> -\def\ScontentsFileVersion{1.7}% +\def\ScontentsFileVersion{1.8}% \def\ScontentsFileDescription{Stores LaTeX contents in memory or files}% % \end{macrocode} % @@ -1799,13 +1956,13 @@ No tab {scontents} {\ScontentsFileDate} {\ScontentsFileVersion} {\ScontentsFileDescription} \@ifpackageloaded { verbatim } { - \iow_term:n + \msg_set:nnn { scontents } { unsupported-verbatim } { - The~implementation~of~the~'verbatimsc'~environment~\\ - used~by~\tl_to_str:n{\typestored}~is~not~compatible~with~package\\ - 'verbatim'.~Review~the~documentation~and~redefine~\\ - the~'verbatimsc'~environment. + The~implementation~of~the~'verbatimsc'~environment~used~by~ + \iow_char:N \\typestored~is~not~compatible~with~package~'verbatim'.~ + Review~the~documentation~and~redefine~the~'verbatimsc'~environment. } + \msg_warning:nn { scontents } { unsupported-verbatim } } { } %</latex> % \end{macrocode} @@ -1829,7 +1986,7 @@ No tab % \begin{macrocode} %<*plain> \msg_gset:nnn { scontents } { already-loaded } - { The~`scontents'~package~is~already~loaded.~Aborting~input~\msg_line_context:. } + { The~'scontents'~package~is~already~loaded.~Aborting~input~\msg_line_context:. } \cs_if_exist:NT \@@_rescan_tokens:n { \msg_warning:nn { scontents } { already-loaded } @@ -1863,7 +2020,7 @@ No tab %<latex|plain> end %<context> stop %<latex> \c_left_brace_str - scontents + \exp_not:N \l_@@_env_name_tl %<latex> \c_right_brace_str } % \end{macrocode} @@ -1954,6 +2111,9 @@ No tab force-eol .bool_set:N = \l_@@_forced_eol_bool, force-eol .initial:n = false, force-eol .default:n = true, + overwrite .bool_set:N = \l_@@_overwrite_bool, + overwrite .initial:n = false, + overwrite .default:n = true, width-tab .int_set:N = \l_@@_tab_width_int, width-tab .initial:n = 1, width-tab .value_required:n = true, @@ -2036,7 +2196,7 @@ No tab % \end{macro} % % -% \begin{macro}{\l_@@_foreach_before_bool,\l_@@_foreach_after_bool +% \begin{macro}{\l_@@_foreach_before_bool,\l_@@_foreach_after_bool, % \l_@@_foreach_stop_bool,\l_@@_foreach_wrapper_bool} % Boolean variables used by the §\foreachsc§ loop. % @@ -2152,6 +2312,8 @@ No tab store-env .meta:nn = { scontents } { store-env = #1 }, force-eol .meta:nn = { scontents } { force-eol = #1 }, force-eol .default:n = true, + overwrite .meta:nn = { scontents } { overwrite = #1 }, + overwrite .default:n = true, unknown .code:n = { \@@_parse_environment_keys:n {#1} } } % \end{macrocode} @@ -2203,7 +2365,8 @@ No tab step .initial:n = 1, wrapper .code:n = { \bool_set_true:N \l_@@_foreach_wrapper_bool - \cs_set_protected:Npn \@@_foreach_wrapper:n ##1 {#1} + \cs_set_protected:Npn + \@@_foreach_wrapper:n ##1 {#1} }, wrapper .value_required:n = true, sep .tl_set:N = \l_@@_foreach_sep_tl, @@ -2343,7 +2506,7 @@ No tab % in \pkg{miniltx}) so that \pkg{xparse} is loadable in any format. % % The bunch of macros below is adapted from the \LaTeX{} kernel (greatly simplified). -% \begin{macrocode} +% \begin{macrocode} %</core> %<*loader&!latex> \seq_new:N \l_@@_compat_seq @@ -2383,9 +2546,12 @@ No tab \clist_map_function:NN \l_@@_temp_tl \@@_require_auxiii:n } \cs_new_protected:Npn \@@_require_auxiii:n #1 - { \str_if_eq:eeF {expl3} {#1} { \msg_error:nnn { scontents } { invalid-package } {#1} } } + { + \str_if_eq:eeF {expl3} {#1} + { \msg_error:nnn { scontents } { invalid-package } {#1} } + } \msg_new:nnn { scontents } { invalid-package } - { Package~`#1'~invalid~in~scontents.~This~is~an~error~in~scontents. } + { Package~'#1'~invalid~in~scontents.~This~is~an~error~in~scontents. } \@@_compat_redefine:cpn { @ifpackagelater } #1 { \exp_args:Nc \@@_package_later_aux:Nn { ver@#1.sty } } \cs_new_protected:Npn \@@_package_later_aux:Nn #1 #2 @@ -2400,7 +2566,7 @@ No tab \cs_new:Npn \@@_parse_version_auxii:w #1-#2-#3#4#5 \q_mark { \tl_if_blank:nF {#2} {#1} #2 #3 #4 } \@@_compat_redefine:Npn \ProvidesExplPackage #1 #2 #3 #4 - { \@@_provides_aux:nn {#1} { #2 \ifx\relax#3\relax\else v#3\space\fi #4 } } + { \@@_provides_aux:nn {#1} { #2 \tl_if_empty:nF {#3} {#3~} #4 } } \cs_new_protected:Npn \@@_provides_aux:nn #1 #2 { \tl_gset:cx { ver@#1.sty } {#2} @@ -2521,43 +2687,77 @@ No tab % % \subsection{Construction of environment \env{scontents}} % -% We define the environment \env{scontents}, next to the system -% \myoarg{key \textnormal{\textcolor{gray}{=}} val}. The environment -% is divided into two parts. +% In order to be able to define environments that behave similarly to +% \myenv{scontents}, we define a generic environment and make all other +% environment as wappers around that one. % -% \begin{macro}{ -% scontents, -% \scontents, -% \startscontents, -% \endscontents, -% \stopscontents, -% \@@_scontents_env_begin:, -% \@@_scontents_env_end:, -% } -% This is the main environment used in the document. +% \subsubsection{The command \cs{newenvsc}} % +% \begin{macro}{\newenvsc,\l_@@_env_name_tl,\@@_scontents_setenv:nn} +% The \cs{newenvsc} command defines two functions \cs[no-index]{@@_\#1_env_begin:} +% and \cs[no-index]{@@_\#1_env_end:}, which set the current environment's +% default properties and then call the generic \cs{@@_env_generic_begin:} and +% \cs{@@_env_generic_end:}. % \begin{macrocode} +\tl_new:N \l_@@_env_name_tl +\cs_new_protected:Npn \@@_scontents_setenv:nn #1 #2 + { + \cs_new_protected:cpn { @@_#1_env_begin: } + { + \tl_set:Nn \l_@@_env_name_tl {#1} + \keys_set:nn { scontents } {#2} + \@@_setup_verb_processor: + \@@_env_generic_begin: + } + \cs_new_protected:cpn { @@_#1_env_end: } + { \@@_env_generic_end: } + \exp_args:Nooo % http://nooooooooooooooo.com :) jeje + \@@_env_define:nnn { \tl_to_str:n {#1} } + { \cs:w @@_#1_env_begin: \cs_end: } + { \cs:w @@_#1_env_end: \cs_end: } + } %</core> %<*loader> -%<!context>\NewDocumentEnvironment { scontents } { } -%<context>\cs_new_protected:Npn \startscontents +\NewDocumentCommand { \newenvsc } { m O{} } { -%<plain|context> \group_begin: - \@@_scontents_env_begin: +%<latex|plain> \cs_if_exist:cTF { #1 } +%<context> \cs_if_exist:cTF { start #1 } + { \msg_error:nnn { scontents } { env-already-defined } {#1} } + { \@@_scontents_setenv:nn {#1} {#2} } } -%<context>\cs_new_protected:Npn \stopscontents +\cs_new_protected:Npn \@@_env_define:nnn #1 #2 #3 { - \@@_scontents_env_end: -%<plain|context> \group_end: +%<latex|plain> \NewDocumentEnvironment {#1} { } +%<context> \cs_new_protected:cpn { start #1 } + { +%<!latex> \group_begin: + #2 + } +%<context> \cs_new_protected:cpn { stop #1 } + { + #3 +%<!latex> \group_end: + } } %</loader> %<*core> -\cs_new_protected:Npn \@@_scontents_env_begin: +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Generic definition of the environment} +% +% \begin{macro}{ +% \@@_env_generic_begin:, +% \@@_env_generic_begin:, +% } +% Now we define the generic environment \cs{@@_env_generic_begin:} +% \begin{macrocode} +\cs_new_protected:Npn \@@_env_generic_begin: { \char_set_catcode_active:N \^^M \@@_start_environment:w } -\cs_new_protected:Npn \@@_scontents_env_end: +\cs_new_protected:Npn \@@_env_generic_end: { \@@_stop_environment: \@@_atend_environment: @@ -2565,6 +2765,23 @@ No tab % \end{macrocode} % \end{macro} % +% \subsubsection{Definition of the environment \env{scontents}} +% +% \begin{macro}{ +% scontents, +% \scontents, +% \endscontents, +% \startscontents, +% \stopscontents, +% } +% Now defining the \myenv{scontents} environment should be easy: +% \begin{macrocode} +%</core> +%<loader>\newenvsc{scontents} +%<*core> +% \end{macrocode} +% \end{macro} +% % \subsubsection{key val for environment} % % Define a \myoarg{key \textnormal{\textcolor{gray}{=}} val} for @@ -2603,7 +2820,7 @@ No tab % \subsubsection{The environment itself} % % \begin{macro}{\@@_start_environment:w,\@@_start_after_option:w, -% \@@_check_line_and_process:xn,\@@_stop_environment:} +% \@@_check_line_process:xn,\@@_stop_environment:} % Here we make §^^I§, §^^L§ and §^^M§ active characters so that the end of % line can be \enquote{seen} to be used as a delimiter, and \hologo{TeX} doesn't try to % eliminate space-like characters. @@ -2616,22 +2833,17 @@ No tab % \cs{@@_start_after_option:w} also checks for trailing tokens after % the optional argument and issues an error if any. % -% In all cases \cs{@@_check_line_and_process:xn} is called to check that -% the rest of the §\begin{scontents}§ is empty and then process -% the environment. \cs{@@_check_line_and_process:xn} calls the +% In all cases, \cs{@@_check_line_process:xn} ckecks that +% everything past §\begin{scontents}§ is empty and then process +% the environment. \cs{@@_check_line_process:xn} calls the % \cs{@@_file_tl_write_start:V} function, which will then read the contents % of the environment and optionally store them in a token list or write to % an external file. % -% When that's done, \cs{@@_file_write_stop:N} does the cleanup and the -% read token list is smuggled out of the verbatim group. This part of +% When that's done, \cs{@@_file_write_stop:N} does the cleanup. This part of % the code is inspired and adapted from the code of the package \pkg{xsimverb} % by Clemens Niederberger. % -%^^A Hm... Apparently this is not the verbatim group, but one level above. Is -%^^A this group really necessary? -%^^A Reply : I've checked it several times, it seems to be correct. -% % \begin{macrocode} \group_begin: \char_set_catcode_active:N \^^I @@ -2645,31 +2857,32 @@ No tab { \str_if_eq:eeTF { \tl_head:n {#1} } { [ } { \@@_grab_optional:w #1 ^^M } - { \@@_check_line_and_process:xn { } {#1} } + { \@@_check_line_process:xn { } {#1} } } - { \@@_check_line_and_process:xn { } {#1} } + { \@@_check_line_process:xn { } {#1} } } \cs_new_protected:Npn \@@_start_after_option:w #1 ^^M - { \@@_check_line_and_process:xn { [...] } {#1} } - \cs_new_protected:Npn \@@_check_line_and_process:xn #1 #2 + { \@@_check_line_process:xn { [...] } {#1} } + \cs_new_protected:Npn \@@_check_line_process:xn #1 #2 { \tl_if_blank:nF {#2} { \msg_error:nnxn { scontents } { junk-after-begin } - { after~\c_backslash_str begin{scontents} #1 } {#2} + { after~\c_backslash_str begin { \l_@@_env_name_tl } #1 } {#2} } \@@_make_control_chars_active: - \group_begin: - \@@_file_tl_write_start:V \l_@@_fname_out_tl + \@@_file_tl_write_start:V \l_@@_fname_out_tl } \cs_new_protected:Npn \@@_stop_environment: { - \@@_file_write_stop:N \l_@@_macro_tmp_tl - \exp_args:NNNV - \group_end: - \tl_set:Nn \l_@@_macro_tmp_tl \l_@@_macro_tmp_tl - \tl_if_empty:NT \l_@@_macro_tmp_tl - { \msg_warning:nnn { scontents } { empty-environment } } + \@@_file_write_stop:N \l_@@_macro_tmp_tl + \bool_lazy_and:nnT + { \l_@@_storing_bool } + { \tl_if_empty_p:N \l_@@_macro_tmp_tl } + { + \msg_warning:nnx { scontents } { empty-environment } + { \l_@@_env_name_tl } + } } % \end{macrocode} % \end{macro} @@ -2678,6 +2891,8 @@ No tab % \@@_file_tl_write_start:n, % \@@_file_tl_write_start:V, % \@@_verb_processor_iterate:w, +% \@@_verb_processor_iterate:nnn, +% \@@_setup_verb_processor:, % \@@_file_write_stop:N, % \@@_remove_leading_nl:n, % \@@_remove_leading_nl:w, @@ -2698,16 +2913,22 @@ No tab \cs_new_protected:Npn \@@_file_tl_write_start:n #1 { \group_begin: - \bool_if:NT \l_@@_writing_bool + \bool_if:nT { \l_@@_writing_bool && \l_@@_overwrite_bool } { - \file_if_exist:nTF {#1} - { \msg_warning:nnx { scontents } { rewriting-file } {#1} } - { \msg_warning:nnx { scontents } { writing-file } {#1} } - \iow_open:Nn \l_@@_file_iow {#1} + \file_if_exist:nTF {#1} + { \msg_warning:nnx { scontents } { overwrite-file } {#1} } + { \msg_warning:nnx { scontents } { writing-file } {#1} } + \iow_open:Nn \l_@@_file_iow {#1} + } + \bool_if:nT { \l_@@_writing_bool && !\l_@@_overwrite_bool } + { + \file_if_exist:nF {#1} + { \msg_warning:nnx { scontents } { writing-file } {#1} } + \iow_open:Nn \l_@@_file_iow {#1} } \tl_clear:N \l_@@_file_tl \seq_map_function:NN \l_char_special_seq \char_set_catcode_other:N - \int_step_function:nnN { 128 } { 255 } \char_set_catcode_letter:n + \int_step_function:nnnN { 128 } { 1 } { 255 } \char_set_catcode_letter:n \cs_set_protected:Npx \@@_ret:w ##1 ^^M { \exp_not:N \@@_verb_processor_iterate:w @@ -2718,48 +2939,65 @@ No tab \@@_make_control_chars_active: \@@_ret:w } - \use:x + \cs_new:Npn \@@_setup_verb_processor: { - \cs_new:Npn \exp_not:N \@@_verb_processor_iterate:w - ##1 \c_@@_end_env_tl - ##2 \c_@@_end_env_tl - ##3 \exp_not:N \q_@@_stop - } { - \tl_if_blank:nTF {#3} - { - \@@_analyse_nesting:n {#1} - \@@_verb_processor_output:n {#1} - } - { - \@@_if_nested:TF - { - \@@_nesting_decr: - \@@_verb_processor_output:x - { \exp_not:n {#1} \c_@@_end_env_tl \exp_not:n {#2} } - } - { - \tl_if_blank:nF {#1} - { \@@_verb_processor_output:n {#1} } - \cs_set_protected:Npx \@@_ret:w - { - \@@_format_case:nnn - { \exp_not:N \end{scontents} } % LaTeX - { \endscontents } % Plain/Generic - { \stopscontents } % ConTeXt - \bool_lazy_or:nnF - { \tl_if_blank_p:n {#2} } - { \str_if_eq_p:ee {#2} { \c_percent_str } } - { - \str_if_eq:VnF \c_@@_hidden_space_str {#2} - { \msg_warning:nnn { scontents } { rescanning-text } {#2} } - \@@_rescan_tokens:n {#2} - } - } - \char_set_active_eq:NN ^^M \@@_ret:w - } - } - ^^M - } + \use:x + { + \cs_set:Npn \exp_not:N \@@_verb_processor_iterate:w + ####1 \c_@@_end_env_tl + ####2 \c_@@_end_env_tl + ####3 \exp_not:N \q_@@_stop + } { \@@_verb_processor_iterate:nnn {##1} {##2} {##3} } + } + \cs_new:Npn \@@_verb_processor_iterate:nnn #1 #2 #3 + { + \tl_if_blank:nTF {#3} + { + \@@_analyse_nesting:n {#1} + \@@_verb_processor_output:n {#1} + } + { + \@@_if_nested:TF + { + \@@_nesting_decr: + \@@_verb_processor_output:x + { \exp_not:n {#1} \c_@@_end_env_tl \exp_not:n {#2} } + } + { + \tl_if_blank:nF {#1} + { \@@_verb_processor_output:n {#1} } + \cs_set_protected:Npx \@@_ret:w + { + \@@_env_end_function: + \bool_lazy_or:nnF + { \tl_if_blank_p:n {#2} } + { \str_if_eq_p:ee {#2} { \c_percent_str } } + { + \str_if_eq:VnF \c_@@_hidden_space_str {#2} + { + \msg_warning:nnnn { scontents } { rescanning-text } + {#2} { \tl_use:N \l_@@_env_name_tl } + } + \@@_rescan_tokens:n {#2} + } + } + \char_set_active_eq:NN ^^M \@@_ret:w + } + } + ^^M + } + \cs_new:Npn \@@_env_end_function: + { + \@@_format_case:nnn + { \exp_not:N \end { \if_false: } \fi: } + { \exp_after:wN \exp_not:N \cs:w end } + { \exp_after:wN \exp_not:N \cs:w stop } + \tl_use:N \l_@@_env_name_tl + \@@_format_case:nnn + { \if_false: { \fi: } } + { \cs_end: } + { \cs_end: } + } \cs_new_protected:Npn \@@_file_write_stop:N #1 { \bool_if:NT \l_@@_writing_bool @@ -2797,23 +3035,10 @@ No tab % \begin{macro}{ % \@@_verb_processor_output:n, % \@@_verb_processor_output:x, -% \@@_analyse_nesting:n, -% \@@_analyse_nesting:w, -% \@@_nesting_decr:, -% \@@_use_none_delimit_by_q_stop:w, % } -% \begin{macro}[TF]{\@@_if_nested:} % \cs{@@_verb_processor_output:n} does the output of each line read, % to a token list and to a file, depending on the booleans % \cs{l_@@_writing_bool} and \cs{l_@@_storing_bool}. -% -% \cs{@@_analyse_nesting:n} looks for nested §\begin{scontents}§ -% and adds to a \cs{l_@@_env_nesting_int} counter. The \cs{@@_if_nested:} -% conditional tests if we're in a nested environment, and -% \cs{@@_nesting_decr:} reduces the nesting level, if an §\end{scontents}§ -% is found. -% -% Multiple §\end{scontents}§ in the same line are not supported... % \begin{macrocode} \cs_new_protected:Npn \@@_verb_processor_output:n #1 { @@ -2822,51 +3047,120 @@ No tab \bool_if:NT \l_@@_storing_bool { \tl_put_right:Nn \l_@@_file_tl { ^^J #1 } } } - \cs_generate_variant:Nn \@@_verb_processor_output:n { x } - \cs_new_protected:Npx \@@_analyse_nesting:n #1 - { - \int_zero:N \l_@@_tmpa_int - \exp_not:N \@@_analyse_nesting:w #1 - \c_backslash_str begin - \c_left_brace_str \exp_not:N \q_@@_mark \c_right_brace_str - \exp_not:N \q_@@_stop - \int_compare:nNnT { \l_@@_tmpa_int } > { 1 } - { \msg_warning:nn { scontents } { multiple-begin } } - } - \use:x - { - \cs_new_protected:Npn \exp_not:N \@@_analyse_nesting:w ##1 - \c_backslash_str begin \c_left_brace_str ##2 \c_right_brace_str - } { - \if_meaning:w \q_@@_mark #2 - \exp_after:wN \use_i:nn - \else: - \exp_after:wN \use_ii:nn - \fi: - { \@@_use_none_delimit_by_q_stop:w } - { - \str_if_eq:eeT {#2} {scontents} - { - \int_incr:N \l_@@_env_nesting_int - \int_incr:N \l_@@_tmpa_int - \@@_analyse_nesting:w - } - \@@_analyse_nesting:w - } - } - \cs_new_protected:Npn \@@_nesting_decr: - { \int_decr:N \l_@@_env_nesting_int } - \prg_new_protected_conditional:Npnn \@@_if_nested: { TF } - { - \int_compare:nNnTF { \l_@@_env_nesting_int } > { \c_zero_int } - { \prg_return_true: } - { \prg_return_false: } - } - \cs_new:Npn \@@_use_none_delimit_by_q_stop:w #1 \q_@@_stop { } \group_end: +\cs_generate_variant:Nn \@@_verb_processor_output:n { x } \cs_generate_variant:Nn \@@_file_tl_write_start:n { V } % \end{macrocode} % \end{macro} +% +% \begin{macro}{ +% \@@_analyse_nesting:n, +% \@@_analyse_nesting:w, +% \@@_nesting_decr:, +% \@@_use_none_delimit_by_q_stop:w, +% } +% \begin{macro}[TF]{\@@_if_nested:} +% \cs{@@_analyse_nesting:n} scans nested §\begin{scontents}§ +% and steps a \cs{l_@@_env_nesting_int} counter. The \cs{@@_if_nested:} +% conditional tests if we're in a nested environment, and +% \cs{@@_nesting_decr:} reduces the nesting level, if an §\end{scontents}§ +% is found. +% +% Multiple §\end{scontents}§ in the same line are not supported\dots +% \begin{macrocode} +\cs_new_protected:Npn \@@_analyse_nesting:n #1 + { + \int_zero:N \l_@@_tmpa_int + \@@_analyse_nesting_format:n {#1} + \int_compare:nNnT { \l_@@_tmpa_int } > { 1 } + { \msg_warning:nn { scontents } { multiple-begin } } + } +\cs_new_protected:Npn \@@_nesting_incr: + { + \int_incr:N \l_@@_env_nesting_int + \int_incr:N \l_@@_tmpa_int + } +\cs_new_protected:Npn \@@_nesting_decr: + { \int_decr:N \l_@@_env_nesting_int } +\prg_new_protected_conditional:Npnn \@@_if_nested: { TF } + { + \int_compare:nNnTF { \l_@@_env_nesting_int } > { \c_zero_int } + { \prg_return_true: } + { \prg_return_false: } + } +\cs_new:Npn \@@_use_none_delimit_by_q_stop:w #1 \q_@@_stop { } +% \end{macrocode} +% In \LaTeX{}, environments start with §\begin{<env>}§, so checking if a +% string contains §\begin{scontents}§ is straightforward. Since no §}§ can +% appear inside §<env>§, then just a macro delimited by §}§ is enough. +% \begin{macrocode} +\use:x + { + \cs_new_protected:Npn \exp_not:N \@@_analyse_nesting_latex:w ##1 + \c_backslash_str begin \c_left_brace_str ##2 \c_right_brace_str + } { + \@@_tl_if_head_is_q_mark:nTF {#2} + { \@@_use_none_delimit_by_q_stop:w } + { + \str_if_eq:VnT \l_@@_env_name_tl {#2} + { \@@_nesting_incr: } + \@@_analyse_nesting_latex:w + } + } +\cs_new_protected:Npx \@@_analyse_nesting_latex:n #1 + { + \@@_analyse_nesting_latex:w #1 + \c_backslash_str begin + \c_left_brace_str \exp_not:N \q_@@_mark \c_right_brace_str + \exp_not:N \q_@@_stop + } +% \end{macrocode} +% In other formats, however, we don't have an \enquote{end anchor} to delimit the +% environment name, so a delimited macro won't help. We have to search for +% the entire environment command (usually §\scontents§ and §\startscontents§). +% \begin{macrocode} +\cs_new_protected:Npn \@@_analyse_nesting_generic_process:nn #1 #2 + { + \tl_if_head_is_N_type:nTF {#2} + { + \@@_tl_if_head_is_q_mark:nF {#2} + { + \@@_nesting_incr: + \@@_analyse_nesting_generic:w #2 \q_@@_stop + } + } + { \@@_analyse_nesting_generic:w #2 \q_@@_stop } + } +\cs_new_protected:Npn \@@_analyse_nesting_generic:nn #1 #2 + { + \@@_define_generic_nesting_function:n {#1} + \use:x + { + \exp_not:N \@@_analyse_nesting_generic:w #2 + \c_backslash_str #1 \tl_use:N \l_@@_env_name_tl + \exp_not:N \q_@@_mark \exp_not:N \q_@@_stop + } + } +\cs_new_protected:Npn \@@_define_generic_nesting_function:n #1 + { + \use:x + { + \cs_set_protected:Npn \exp_not:N \@@_analyse_nesting_generic:w ####1 + \c_backslash_str #1 \tl_use:N \l_@@_env_name_tl + ####2 \exp_not:N \q_@@_stop + } { \@@_analyse_nesting_generic_process:nn {##1} {##2} } + } +%</core> +%<*loader> +%<latex>\cs_new_eq:NN \@@_analyse_nesting_format:n +%<latex> \@@_analyse_nesting_latex:n +%<!latex>\cs_new_protected:Npn \@@_analyse_nesting_format:n +%<plain> { \@@_analyse_nesting_generic:nn { } } +%<context> { \@@_analyse_nesting_generic:nn { start } } +%</loader> +%<*core> +% \end{macrocode} +% \end{macro} % \end{macro} % % \subsubsection{Recording of the content in the sequence} @@ -2881,8 +3175,12 @@ No tab \bool_if:NT \l_@@_storing_bool { \bool_if:NF \l_@@_forced_eol_bool - { \tl_put_right:Nx \l_@@_macro_tmp_tl { \c_@@_hidden_space_str } } - \@@_store_to_seq:NN \l_@@_macro_tmp_tl \l_@@_name_seq_env_tl + { + \tl_put_right:Nx \l_@@_macro_tmp_tl + { \c_@@_hidden_space_str } + } + \@@_store_to_seq:NN \l_@@_macro_tmp_tl + \l_@@_name_seq_env_tl \bool_if:NT \l_@@_print_env_bool { \@@_lastfrom_seq:n \l_@@_name_seq_env_tl } } @@ -2899,7 +3197,8 @@ No tab \cs_new_protected:Npn \verbatimsc { \group_begin: - \@@_verbatimsc_aux: \frenchspacing \@@_vobeyspaces: \@@_xverb: + \@@_verbatimsc_aux: \frenchspacing \@@_vobeyspaces: + \@@_xverb: } \cs_new_protected:Npn \endverbatimsc { \group_end: } @@ -3036,7 +3335,7 @@ No tab % \begin{macrocode} %</core> %<*loader> -\NewDocumentCommand { \getstored } { O{1} m } +\NewDocumentCommand { \getstored } { O{-1} m } { \@@_getstored_internal:nn {#1} {#2} } %</loader> %<*core> @@ -3082,7 +3381,10 @@ No tab { \l_@@_foreach_stop_int } \@@_foreach_add_body:n \tl_gset:Nx \g_@@_temp_tl - { \seq_use:Nn \l_@@_foreach_print_seq { \tl_use:N \l_@@_foreach_sep_tl } } + { + \seq_use:Nn \l_@@_foreach_print_seq + { \tl_use:N \l_@@_foreach_sep_tl } + } \group_end: \exp_after:wN \tl_gclear:N \exp_after:wN \g_@@_temp_tl @@ -3235,6 +3537,21 @@ No tab % \end{macrocode} % \end{macro} % +% \begin{macro}[TF]{\@@_tl_if_head_is_q_mark:n} +% Tests if the head of the token list is \cs{q_@@_mark}. +% \begin{macrocode} +\prg_new_protected_conditional:Npnn \@@_tl_if_head_is_q_mark:n #1 + { T, F, TF } + { + \if_meaning:w \q_@@_mark #1 \scan_stop: + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{ % \@@_set_active_eq:NN, % \@@_make_control_chars_active:, @@ -3335,7 +3652,6 @@ No tab % % \subsection{The command \cs{countsc}} % -% % \begin{macro}{\countsc} % User command §\countsc§ to count number of contents stored in |seq|. % @@ -3376,18 +3692,25 @@ No tab \\ \\ #2 } +\msg_new:nnnn { scontents } { env-already-defined } + { Environment~'#1'~already~defined! } + { + You~have~used~\newenvsc + with~an~environment~that~already~has~a~definition. \\ \\ + The~existing~definition~of~'#1'~will~not~be~altered. + } \msg_new:nnn { scontents } { empty-stored-content } { Empty~value~for~key~'getstored'~\msg_line_context:. } \msg_new:nnn { scontents } { empty-variable } { Variable~'#1'~empty~\msg_line_context:. } -\msg_new:nnn { scontents } { rewriting-file } - { Overwriting ~ file ~ '#1' } +\msg_new:nnn { scontents } { overwrite-file } + { Overwriting~file~'#1'. } \msg_new:nnn { scontents } { writing-file } - { Writing ~ file ~ '#1' } + { Writing~file~'#1'. } \msg_new:nnn { scontents } { rescanning-text } - { Rescanning~text~'#1'~after~\c_backslash_str end{scontents}~\msg_line_context:.} + { Rescanning~text~'#1'~after~\c_backslash_str end{#2}~\msg_line_context:.} \msg_new:nnn { scontents } { multiple-begin } - { Multiple~\c_backslash_str begin{scontents}~\msg_line_context:.} + { Multiple~\c_backslash_str begin{ \l_@@_env_name_tl }~\msg_line_context:.} \msg_new:nnn { scontents } { undefined-storage } { Storage~named~'#1'~is~not~defined. } \msg_new:nnn { scontents } { index-out-of-range } @@ -3401,15 +3724,21 @@ No tab } } \msg_new:nnnn { scontents } { env-key-unknown } - { The~key~'#1'~is~unknown~by~environment~'scontents'~and~is~being~ignored.} { - The~environment~'scontents'~does~not~have~a~key~called~'#1'.\\ + The~key~'#1'~is~unknown~by~environment~ + '\l_@@_env_name_tl'~and~is~being~ignored. + } + { + The~environment~'\l_@@_env_name_tl'~does~not~have~a~key~called~'#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } \msg_new:nnnn { scontents } { env-key-value-unknown } - { The~key~'#1=#2'~is~unknown~by~environment~'scontents'~and~is~being~ignored. } { - The~environment~'scontents'~does~not~have~a~key~called~'#1'.\\ + The~key~'#1=#2'~is~unknown~by~environment~ + '\l_@@_env_name_tl'~and~is~being~ignored. + } + { + The~environment~'\l_@@_env_name_tl'~does~not~have~a~key~called~'#1'.\\ Check~that~you~have~spelled~the~key~name~correctly. } \msg_new:nnnn { scontents } { cmd-key-unknown } @@ -3449,7 +3778,7 @@ No tab This~command~only~accepts~the~key~'width-tab'. } \msg_new:nnn { scontents } { empty-environment } - { scontents~environment~empty~\msg_line_context:. } + { environment~'#1'~empty~\msg_line_context:. } \msg_new:nnnn { scontents } { verbatim-newline } { Verbatim~argument~of~#1~ended~by~end~of~line. } { @@ -3479,4 +3808,5 @@ No tab %</core> %<plain|context>\ExplSyntaxOff % \end{macrocode} +% % \Finale diff --git a/macros/latex/contrib/scontents/scontents.ins b/macros/latex/contrib/scontents/scontents.ins index 6c761fe6b0..953dc79bb6 100644 --- a/macros/latex/contrib/scontents/scontents.ins +++ b/macros/latex/contrib/scontents/scontents.ins @@ -33,11 +33,11 @@ and the derived files scontents.sty, \declarepreamble\context \string\module [ file=t-scontents, - version=1.7, + version=1.8, title=\string\CONTEXT\ User Module, subtitle=Storing Contents, author=Pablo González, - date=2019-10-29, + date=2019-11-18, copyright=Pablo González, email=pablgonz@educarchile.cl, license=LPPL] diff --git a/macros/latex/contrib/scontents/scontents.pdf b/macros/latex/contrib/scontents/scontents.pdf Binary files differindex 958da1dcc6..eea74b0101 100644 --- a/macros/latex/contrib/scontents/scontents.pdf +++ b/macros/latex/contrib/scontents/scontents.pdf diff --git a/macros/latex/required/amsmath/README.md b/macros/latex/required/amsmath/README.md index 868efe52c2..c08ef1b2ab 100644 --- a/macros/latex/required/amsmath/README.md +++ b/macros/latex/required/amsmath/README.md @@ -1,7 +1,7 @@ The amsmath bundle for LaTeX ============================ -Release 2019-10-01 patch level 1 +Release 2019-11-17 Overview -------- diff --git a/macros/latex/required/amsmath/amsbsy.pdf b/macros/latex/required/amsmath/amsbsy.pdf Binary files differindex b436223e2f..3260fb10a7 100644 --- a/macros/latex/required/amsmath/amsbsy.pdf +++ b/macros/latex/required/amsmath/amsbsy.pdf diff --git a/macros/latex/required/amsmath/amscd.pdf b/macros/latex/required/amsmath/amscd.pdf Binary files differindex 69e05ee5c7..6094e56e41 100644 --- a/macros/latex/required/amsmath/amscd.pdf +++ b/macros/latex/required/amsmath/amscd.pdf diff --git a/macros/latex/required/amsmath/amsgen.pdf b/macros/latex/required/amsmath/amsgen.pdf Binary files differindex 12312f4193..d81a3e9c4c 100644 --- a/macros/latex/required/amsmath/amsgen.pdf +++ b/macros/latex/required/amsmath/amsgen.pdf diff --git a/macros/latex/required/amsmath/amsldoc.pdf b/macros/latex/required/amsmath/amsldoc.pdf Binary files differindex a221839b30..747bd6b264 100644 --- a/macros/latex/required/amsmath/amsldoc.pdf +++ b/macros/latex/required/amsmath/amsldoc.pdf diff --git a/macros/latex/required/amsmath/amsldoc.tex b/macros/latex/required/amsmath/amsldoc.tex index 9e08f029f5..8573682a66 100644 --- a/macros/latex/required/amsmath/amsldoc.tex +++ b/macros/latex/required/amsmath/amsldoc.tex @@ -64,7 +64,7 @@ Bug reports can be opened (category \texttt{#1}) at\\% \title{User's Guide for the \nipkg{amsmath} Package (Version~2.1)} \author{American Mathematical Society, \LaTeX3 Project} -\date{1999-12-13 (revised 2002-02-25, 2016-11-14, 2018-04-05)} +\date{1999-12-13\\(revised 2002-02-25, 2016-11-14, 2018-04-05, 2019-10-14)} \makeatletter \def\@thanks{\bigskip\MaintainedByLaTeXTeam{amslatex}} \makeatother @@ -1372,9 +1372,12 @@ superscript\index{subscripts and superscripts} above a binary relation. In the \nipkg{amsmath} package there are somewhat more general commands, \cn{overset} and \cn{underset}, that can be used to place one symbol above or below another symbol, whether it's a relation or something -else. The input |\overset{*}{X}| will place a superscript-size $*$ above -the $X$: $\overset{*}{X}$; \cn{underset} is the analog for adding a -symbol underneath. +else. The input |\overset{*}{X}| will place a superscript-size {\small$*$} above +the {\small$X$}: {\small$\smash{\overset{*}{X}}$}; +\cn{underset} is the analog for adding a +symbol underneath. The command \cn{overunderset} is a combination of +these, taking three arguments to place superscript sized expressions +above and below the same base. See also the description of \cn{sideset} in \secref{sideset}. diff --git a/macros/latex/required/amsmath/amsmath.dtx b/macros/latex/required/amsmath/amsmath.dtx index 8671694b70..11b7545c26 100644 --- a/macros/latex/required/amsmath/amsmath.dtx +++ b/macros/latex/required/amsmath/amsmath.dtx @@ -86,7 +86,7 @@ Bug reports can be opened (category \texttt{#1}) at\\% % \end{macrocode} % % \begin{macrocode} -\ProvidesPackage{amsmath}[2019/04/01 v2.17c AMS math features] +\ProvidesPackage{amsmath}[2019/11/16 v2.17d AMS math features] % \end{macrocode} % % \section{Catcode defenses} @@ -1641,10 +1641,19 @@ Foreign command \@backslashchar#1;\MessageBreak % By redefining \cs{set@mathaccent} we ensure that % \cn{DeclareMathAccent} will define accent commands to run our % \cs{mathaccentV} function instead of the primitive \cs{mathaccent}. +% \changes{v2.17d}{2019/11/16}{Added \cs{MakeRobust} to match kernel +% change (gh/216)} % \begin{macrocode} \def\set@mathaccent#1#2#3#4{% - \xdef#2{\@nx\protect\@nx\mathaccentV +% \end{macrocode} +% Now that the redefinitions done inside amsmath of the basic accents +% are all robust we can drop the \cs{protect} here. +% \begin{macrocode} + \xdef#2{% +% \@nx\protect + \@nx\mathaccentV {\@xp\@gobble\string#2}\hexnumber@#1#4}% + \MakeRobust#2% } % \end{macrocode} % @@ -1714,6 +1723,13 @@ Foreign command \@backslashchar#1;\MessageBreak Unable to redefine math accent \string#5}% \fi\fi} \def\@tempc#1"#2#3#4#5#6\@nil#7{% +% \end{macrocode} +% Drop the inner part of the robust accent so that it can be recreated +% without a warning. +% \changes{v2.17d}{2019/11/16}{Make temporarily fragile to match kernel +% change (gh/216)} +% \begin{macrocode} + \@xp\let\csname\@xp\@gobble\string#7\space\endcsname\@undefined \chardef\@tempd="#3\relax\set@mathaccent\@tempd{#7}{#2}{#4#5}} \def\@tempd#1\@nil#2{% \PackageWarningNoLine{amsmath}{% @@ -2091,7 +2107,7 @@ Foreign command \@backslashchar#1;\MessageBreak % \begin{macro}{\overunderset} % This is the combination of the previous two commands which is % something that is sometimes needed. -% \changes{v2.17c}{FMi}{New command \cs{overunderset}} +% \changes{v2.17c}{2019/04/01}{New command \cs{overunderset}} % \begin{macrocode} \newcommand{\overunderset}[3]{\binrel@{#3}% \binrel@@{\mathop{\kern\z@#3}\limits^{#1}_{#2}}} diff --git a/macros/latex/required/amsmath/amsmath.pdf b/macros/latex/required/amsmath/amsmath.pdf Binary files differindex 71b273d85c..df541ceec9 100644 --- a/macros/latex/required/amsmath/amsmath.pdf +++ b/macros/latex/required/amsmath/amsmath.pdf diff --git a/macros/latex/required/amsmath/amsopn.pdf b/macros/latex/required/amsmath/amsopn.pdf Binary files differindex 1543a5c08e..9e2fe3336d 100644 --- a/macros/latex/required/amsmath/amsopn.pdf +++ b/macros/latex/required/amsmath/amsopn.pdf diff --git a/macros/latex/required/amsmath/amstext.pdf b/macros/latex/required/amsmath/amstext.pdf Binary files differindex 73e4af364a..2a2001b640 100644 --- a/macros/latex/required/amsmath/amstext.pdf +++ b/macros/latex/required/amsmath/amstext.pdf diff --git a/macros/latex/required/amsmath/amsxtra.pdf b/macros/latex/required/amsmath/amsxtra.pdf Binary files differindex 77ac075445..651c9db0da 100644 --- a/macros/latex/required/amsmath/amsxtra.pdf +++ b/macros/latex/required/amsmath/amsxtra.pdf diff --git a/macros/latex/required/amsmath/changes.txt b/macros/latex/required/amsmath/changes.txt index 054633ff2d..e5e234cea2 100644 --- a/macros/latex/required/amsmath/changes.txt +++ b/macros/latex/required/amsmath/changes.txt @@ -1,4 +1,14 @@ ######################### +# 2019-11-17 Release +######################### + +2019-11-16 Frank Mittelbach <Frank.Mittelbach@latex-project.org> + + * amsmath.dtx (section{Math accents}): + Added \MakeRobust inside \DeclareMathAccent to match kernel + change (gh/216) + +######################### # 2019-10-01b Release ######################### diff --git a/macros/latex/required/amsmath/subeqn.pdf b/macros/latex/required/amsmath/subeqn.pdf Binary files differindex 9250612b54..9e6e072673 100644 --- a/macros/latex/required/amsmath/subeqn.pdf +++ b/macros/latex/required/amsmath/subeqn.pdf diff --git a/macros/latex/required/amsmath/technote.pdf b/macros/latex/required/amsmath/technote.pdf Binary files differindex 4db485d6c8..5457ffe15f 100644 --- a/macros/latex/required/amsmath/technote.pdf +++ b/macros/latex/required/amsmath/technote.pdf diff --git a/macros/latex/required/amsmath/testmath.pdf b/macros/latex/required/amsmath/testmath.pdf Binary files differindex f1af9357a3..91012a919d 100644 --- a/macros/latex/required/amsmath/testmath.pdf +++ b/macros/latex/required/amsmath/testmath.pdf |