summaryrefslogtreecommitdiff
path: root/macros/latex/contrib
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-10-03 03:00:57 +0000
committerNorbert Preining <norbert@preining.info>2019-10-03 03:00:57 +0000
commit93c3758895674cc9ea3e8aaeeb3cf5d1bdc0e3be (patch)
tree5150bfff26491c4e57ddff629e62b4066295a925 /macros/latex/contrib
parentd94b7a8c132734a1bc4046d54a75c7882c4c2619 (diff)
CTAN sync 201910030300
Diffstat (limited to 'macros/latex/contrib')
-rw-r--r--macros/latex/contrib/asmejour/README.md6
-rw-r--r--macros/latex/contrib/asmejour/asmejour-sample.bib12
-rw-r--r--macros/latex/contrib/asmejour/asmejour-template.pdfbin493846 -> 494919 bytes
-rw-r--r--macros/latex/contrib/asmejour/asmejour-template.tex64
-rw-r--r--macros/latex/contrib/asmejour/asmejour.cls128
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdfbin36386 -> 36321 bytes
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdfbin101813 -> 100167 bytes
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex8
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx4
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx4
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx4
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx4
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx4
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx10
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx6
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx4
-rw-r--r--macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx4
-rw-r--r--macros/latex/contrib/chemnum/README10
-rw-r--r--macros/latex/contrib/chemnum/chemnum.sty348
-rw-r--r--macros/latex/contrib/chemnum/chemnum_en.pdfbin550888 -> 588398 bytes
-rw-r--r--macros/latex/contrib/chemnum/chemnum_en.tex238
-rw-r--r--macros/latex/contrib/download/Makefile45
-rw-r--r--macros/latex/contrib/download/README12
-rw-r--r--macros/latex/contrib/download/download.pdfbin144709 -> 261753 bytes
-rw-r--r--macros/latex/contrib/download/download.tex59
-rw-r--r--macros/latex/contrib/l3build/CHANGELOG.md13
-rw-r--r--macros/latex/contrib/l3build/README.md2
-rw-r--r--macros/latex/contrib/l3build/l3build-check.lua30
-rw-r--r--macros/latex/contrib/l3build/l3build-typesetting.lua14
-rw-r--r--macros/latex/contrib/l3build/l3build.12
-rw-r--r--macros/latex/contrib/l3build/l3build.dtx7
-rwxr-xr-xmacros/latex/contrib/l3build/l3build.lua2
-rw-r--r--macros/latex/contrib/l3build/l3build.pdfbin705328 -> 705508 bytes
-rw-r--r--macros/latex/contrib/ocgx2/ChangeLog4
-rw-r--r--macros/latex/contrib/ocgx2/fixocgx.sty4
-rw-r--r--macros/latex/contrib/ocgx2/ocgx2.sty4
-rw-r--r--macros/latex/contrib/scontents/README.md9
-rw-r--r--macros/latex/contrib/scontents/scontents.dtx1149
-rw-r--r--macros/latex/contrib/scontents/scontents.pdfbin244760 -> 266405 bytes
39 files changed, 1368 insertions, 846 deletions
diff --git a/macros/latex/contrib/asmejour/README.md b/macros/latex/contrib/asmejour/README.md
index 2a040e7a36..8be9aa6158 100644
--- a/macros/latex/contrib/asmejour/README.md
+++ b/macros/latex/contrib/asmejour/README.md
@@ -1,7 +1,7 @@
#asmejour: A template for ASME journal papers#
- Version 1.05 dated 2019/08/17.
+ Version 1.06 dated 2019/10/01.
####Overview####
This class provides a template to format preprints submitted to ASME journals in the style that
@@ -56,7 +56,9 @@
---
####Change log####
-
+
+v1.06: allow standard \\date, \\maketitle, and \\title commands and abstract environment; make final column balancing a package option; remove \\normalfont from AMS equation tags to allow tags to match caption font; incorporate \\subfigure in example template; allow line numbers in AMS display math; provide comma between sequential footnote marks; adjust babel options; other minor edits; revise template text.
+
v1.05: automate list of figures/tables with option to omit; replace balance package with flushend package and automate; revise skips in nomenclature; address conflicts of lineno package with other elements; option to hyphenate typewriter font; new options for footer text; adjust \\emergencystretch and \\tolerance; additional documentation and references
v1.04: edit documentation; add language support via babel
diff --git a/macros/latex/contrib/asmejour/asmejour-sample.bib b/macros/latex/contrib/asmejour/asmejour-sample.bib
index 86a277c808..fcbcc7a840 100644
--- a/macros/latex/contrib/asmejour/asmejour-sample.bib
+++ b/macros/latex/contrib/asmejour/asmejour-sample.bib
@@ -1,4 +1,4 @@
-%% Revised 17 August 2019.
+%% Revised 1 October 2019.
@article{DKE1969,
author = {D. K. Edwards},
@@ -166,6 +166,16 @@
address = {Eugene, OR},
}
+@online{tolusis,
+ author = {Sigitas Tolu{\v{s}}is},
+ title = {The \textsf{flushend} package},
+ year = {2017},
+ organization = {Comprehensive \TeX\ Archive Network},
+ url = {https://www.ctan.org/pkg/flushend},
+ urldate = {October 1, 2019},
+ version = {3.3},
+}
+
@online{bottcher,
author = {Stephan I. B{\"o}ttcher and Uwe L{\"u}ck},
title = {\textsf{lineno.sty}: A {\LaTeX} package to attach line numbers to paragraphs},
diff --git a/macros/latex/contrib/asmejour/asmejour-template.pdf b/macros/latex/contrib/asmejour/asmejour-template.pdf
index 6c15c7effb..b69e52b5ac 100644
--- a/macros/latex/contrib/asmejour/asmejour-template.pdf
+++ b/macros/latex/contrib/asmejour/asmejour-template.pdf
Binary files differ
diff --git a/macros/latex/contrib/asmejour/asmejour-template.tex b/macros/latex/contrib/asmejour/asmejour-template.tex
index fb4dad7fba..93ce5d67ce 100644
--- a/macros/latex/contrib/asmejour/asmejour-template.tex
+++ b/macros/latex/contrib/asmejour/asmejour-template.tex
@@ -1,10 +1,9 @@
% !TEX encoding = UTF-8 Unicode
-
%%
%% This file is asmejour-template.tex, a template to format papers in the style of ASME journal papers
%% as they are being published in 2019.
%%
-%% This file is version 1.05 dated 2019/08/17
+%% This file is version 1.06 dated 2019/10/1
%%
%% Author: John H. Lienhard V
%% Department of Mechanical Engineering
@@ -16,22 +15,29 @@
%% * Option to color the vertical bar in the title block [barcolor = colorname]
%% * where colorname is any name def'd by xcolor package; omit barcolor option to get black
%%
-%% * Option to include line numbers [lineno]. The lineno package does not number equation
-%% * lines, captions, etc. You must run twice for proper placement of the line numbers.
-%% * This option will disable balancing column height on final page.
+%% * Option to omit the list of figures and list of tables [nolists]
%%
%% * Math options from M. Sharpe's newtxmath package: upright integrals [upint]; and
%% * varvw for a v and w that are better distinguished from greek nu; and also
%% * smallerops, varg, slantedGreek, frenchmath, varbb, cmbraces. Version 1.5 or higher
%% * is recommended.
%%
+%% * Option to include line numbers [lineno]. The lineno package does not number tables,
+%% * footnotes, captions, etc. You must run *twice* for proper placement of the numbers.
+%% * This option will disable balancing of the column heights on final page.
+%%
+%% * Option to balance column heights on final page [balance]. This option sometimes
+%% * misbehaves, so use it with an awareness that it can create unexpected problems.
+%% * This option is not compatible with line numbering.
+%%
%% * Many options for calligraphic, script, and fraktur fonts from the mathalfa package; the
%% * example value used is: mathalfa=cal=euler (use Euler font for \mathcal)
%% * some other options for cal are: dutchcal, zapfc, cm (default), boondox,...
%% * frak (fraktur), bb (blackboard bold), scr (script) may also be controlled.
%%
-%% * An option to omit all the ASME text fields from the footer: nofoot
-%% * An option to omit only the ASME copyright field from the footer: nocopyright
+%% * An option to omit all the ASME text fields from the footer [nofoot].
+%%
+%% * An option to omit only the ASME copyright field from the footer [nocopyright].
%%
%% * An option to use newtxtext's superiors font for footnotes [nodefaultsups] and an option
%% * for slightly larger small capitals, largesc
@@ -39,8 +45,6 @@
%% * Options to set (for the babel package) a primary language [lang= ], and secondary or tertiary
%% * languages, [lang-second] and [lang-third]. The primary language must be the last option given.
%%
-%% * Option to omit the list of figures and list of tables [nolists]
-%%
%% * Option to allow hyphenation of the typewriter font [hyphenate]
%% * Hyphenation is normally suppressed for typewriter mode because it is often used for code.
%%
@@ -76,7 +80,7 @@
%% Class options are described above.
-\documentclass[largesc,upint,varvw,barcolor=Red4,nocopyright,hyphenate,lang-second=french,lang=english]{asmejour}
+\documentclass[largesc,upint,varvw,barcolor=Red4,nocopyright,hyphenate,balance,lang-second=french,lang=english]{asmejour}
\pdfminorversion=7 % This selection is not required.
@@ -131,8 +135,8 @@ Cambridge, MA 02139 USA \\
email: lienhard@mit.edu
}
-%%% Change to your paper title. Can insert line breaks if you wish (otherwise selected automatically).
-\SetTitle{Preprint Template for ASME\\ Journal Papers: asmejour.cls}
+%%% Change to your paper title. Can insert line breaks if you wish (otherwise breaks are selected automatically).
+\title{Preprint Template for ASME\\ Journal Papers: asmejour.cls}
%%% Change these to your keywords. Keywords are automatically printed at the end of the abstract.
@@ -143,12 +147,17 @@ email: lienhard@mit.edu
%% Abstract should be no more than 250 words
-\SetAbstract{%
+\begin{abstract}
This paper is an example and template for the {\upshape\texttt{asmejour}} class. Papers typeset in this class will follow ASME journal style for margins, fonts, headings, captions, and reference formats. Standard \LaTeX\ commands are used. The class will lay out the author, title, and abstract in ASME style. The class will produce a pdf file that that includes hyperlinks, bookmarks, and pdf metadata. The class is intended to be used with the {\upshape\texttt{asmejour.bst}} \hologo{BibTeX} style for typesetting references, which is part of this distribution. This style supports hyperlinks and modern reference formats, following current ASME practice. The class may be invoked with several options, most of which address math fonts. The class calls a number of packages, all of which are in \TeX~Live and in CTAN (\href{http://ctan.org}{ctan.org}). The class is compatible with \hologo{pdfLaTeX} or \LuaLaTeX.
-}
+\end{abstract}
+
+\date{Version 1.06, \today} %% can modify this information as desired.
+ %% Putting \date{} will suppress any date.
+ %% If this command is omitted, date defaults to \today
+ %% This command must come somewhere before \maketitle
-\MakeTitlePage %% This command creates the author/title/abstract block. Essential!
+\maketitle %% This command creates the author/title/abstract block. Essential!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%% End of fields to be completed. Now write! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -167,9 +176,11 @@ To begin, fill in the fields to be completed at top of the \texttt{asmejour-temp
For each author, put author names and affiliation (with line breaks) into a separate \verb|\SetAuthorBlock{name}{affiliation}| command; follow the syntax illustrated \texttt{asmejour-template.tex} file. One author (or more) may be designated as the \verb|\CorrespondingAuthor| by placing the command at the end of the name.
-The title should be placed into \verb|\SetTitle{..}|, and line breaks may be included if desired. Keywords may optionally be including using the \verb|\keywords{..}| command; this command \textit{must} be issued before the abstract. The abstract text must be placed into \verb|\SetAbstract{..}|. The abstract will automatically be italicized.
+The title should be placed into \verb|\title{..}|, and line breaks may be specified if desired. Keywords may optionally be including using the \verb|\keywords{..}| command; this command \textit{must} be issued before the abstract. The abstract text must be placed into \verb|\begin{abstract}|\ldots\verb|\end{abstract}|. The abstract will automatically be italicized.
+
+The date is given as an unnumbered footnote, which deafults to \verb|\today|. Other text for \verb|\date{..}| may be specified. Putting \verb|\date{}| will suppress the footnote.
-After setting up the authors, title, and abstract, issue the \verb|\MakeTitlePage| command.
+After setting up the authors, title, and abstract, issue the \verb|\maketitle| command.
\subsection{Optional to the Color Title Bar}
The vertical bar in the title block is black in all ASME journals. Since the \texttt{asmejour} class is only for preprints, we include the [fun] option to have the bar in color. Any color \texttt{name} recognized by the \texttt{xcolor} package may be invoked by including the option \texttt{barcolor=name} in the \verb|\documentclass[..]{asmejour}| command. The color name is \texttt{Red4} by default. (To have a black bar, either omit the option entirely or use the name \texttt{black}.)
@@ -283,7 +294,7 @@ Text in the figures should be checked for legibility at either single-column wid
\centering{%
\begin{tabular}{l l r}
\hline\hline
-Experiment & $u$ [m/s] & $T$ [\textdegree C] \rule{0pt}{10pt} \\[2pt]
+Experiment & $u$ [m/s] & $T$ [\textdegree C]\rule{0pt}{10pt} \\[2pt]
\hline
Run 11 & 12.5 & 103.4 \rule{0pt}{10pt} \\
Run 12 & 24 & 68.3 \\[1pt]
@@ -325,7 +336,7 @@ The \verb|version={..}| field may be used with \verb|@book|, \verb|@online|, and
\centering{%
\begin{tabular}{!{\hspace*{0.5cm}} >{\raggedright\hangindent=1em} p{3cm} d{3} @{\hspace*{1cm}} d{3} !{\hspace*{0.5cm}}}
\hline\hline
-\rule{0pt}{10pt} Experiment & \multicolumn{1}{c@{\hspace*{1cm}}}{$u$ [m/s]} & \multicolumn{1}{c!{\hspace*{0.5cm}}}{$T$ [\textdegree C]} \\[1pt]
+\rule{0pt}{10pt}Experiment & \multicolumn{1}{c@{\hspace*{1cm}}}{$u$ [m/s]} & \multicolumn{1}{c!{\hspace*{0.5cm}}}{$T$ [\textdegree C]} \\[1pt]
\hline
The first experiment we ran this morning & 124.3 & 68.3 \rule{0pt}{10pt} \\
The second experiment we ran this morning & 82.50 & 103.46 \\
@@ -338,10 +349,11 @@ Our competitor's data & 72.321 & 141.384 \\[1pt]
%%%%%%%%%%%%%%%% end table %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
%%%%%%%%%%%%%%%%% begin two column figure %%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure*}[t]
-\begin{minipage}[t]{0.497\textwidth}
+\begin{subfigure}[t]{0.5\textwidth} % You will get same result using \begin{minipage}[t]{0.5\textwidth}
\vbox{
\vspace*{1.7em}
\centering{
@@ -350,24 +362,26 @@ Our competitor's data & 72.321 & 141.384 \\[1pt]
\vspace*{1.7em}
}
\subcaption{Interior region\label{fig:interior-region}}
-\end{minipage}
+\end{subfigure}%
%%%%%%%% don't leave a break here
-\begin{minipage}[t]{0.497\textwidth}
+\begin{subfigure}[t]{0.5\textwidth} % You will get same result using \begin{minipage}[t]{0.5\textwidth}
\centering{
\includegraphics{sample-figure-2b.pdf}
\subcaption{Exterior region\label{fig:exterior-region}}
-}\end{minipage}
+}\end{subfigure}%
\caption{A figure with two subfigures \cite{Lienhard2019b}\label{fig:2}}
\end{figure*}
%%%%%%%%%%%%%%%%%%% end two column figure %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Additional Options for \texttt{asmejour.cls}}
The class accepts a number of options in addition to those already described.
-\subsection{Line Numbers} The option \texttt{[lineno]} invokes the the \texttt{lineno} package~\cite{bottcher}. This will produce line numbers in the margins. You must run \LaTeX\ twice for proper placement. The \texttt{lineno} package is not compatible with the \texttt{flushend} package that makes final short columns the same height. Balancing is disabled when this option is called. See the documentation of the \texttt{lineno} package for further commands to control line numbering. See footnote~\ref{ftnt:3} with regard to footnotes in section headings while this option is in~effect.
+\subsection{Final Column Balancing} The option \texttt{[balance]} invokes the the \texttt{flushend} package~\cite{tolusis}.
+This package will attempt to give equal height to the two columns on the last page. The performance of this package is sometimes inconsistent (with odd page layout or, very rarely, errors), so use this option with caution.
+
+\subsection{Line Numbers} The option \texttt{[lineno]} invokes the the \texttt{lineno} package~\cite{bottcher}. This will produce line numbers in the margins. You must run \LaTeX\ twice for proper placement of the numbers. The \texttt{lineno} package is not compatible with the \texttt{flushend} package that makes final short columns the same height. Balancing is disabled when this option is called. See the documentation of the \texttt{lineno} package for further commands to control line numbering. See footnote~\ref{ftnt:3} with regard to footnotes in section headings while this option is in~effect. The abstract, tables, captions, and footnotes will not be numbered.
\subsection{Changing the Footer Text} The option \texttt{[nofoot]} will omit everything other than a page number from the page footer. The option \texttt{nocopyright} will omit the ASME copyright from the first page footer. The command \verb|\PreprintString{..}| replaces the words \textsf{PREPRINT FOR REVIEW}. The left and right preprint strings can be changed separately using an optional argument: \verb|\PreprintString{..}[L]| and \verb|\PreprintString{..}[R]|.
The final paper number may be added to the page number using \verb|\PaperNumber{..}|.
diff --git a/macros/latex/contrib/asmejour/asmejour.cls b/macros/latex/contrib/asmejour/asmejour.cls
index 72087ac48d..beb4364634 100644
--- a/macros/latex/contrib/asmejour/asmejour.cls
+++ b/macros/latex/contrib/asmejour/asmejour.cls
@@ -1,12 +1,12 @@
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
-%% This file provides the asmejour class for formatting =papers in a layout similar to
+%% This file provides the asmejour class for formatting papers in a layout similar to
%% ASME Journal papers.
%%
%% The asmejour.cls file should be used with the files asmejour.bst (for citations) and asmejour-template.tex.
%%
%%
-%% This file is version 1.05 dated 2019/08/17.
+%% This file is version 1.06 dated 2019/10/01.
%%
%% Author: John H. Lienhard V
%% Department of Mechanical Engineering
@@ -20,7 +20,7 @@
%% The Times/Helvetica style fonts are from Michael Sharpe's excellent newtxtext and newtxmath packages.
%% This class is not designed for unicode-math or fontspec.
%%
-%% Options for the class are described on lines 63-157.
+%% Options for the class are described on lines 63-173.
%%
%% The class defines an environment for nomenclature. LaTeX must be run twice to align those columns.
%%
@@ -52,7 +52,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{asmejour}[2019/08/17 asmejour paper format]
+\ProvidesClass{asmejour}[2019/10/01 asmejour paper format]
\LoadClass[twoside,9pt,twocolumn]{extarticle}
@@ -66,11 +66,14 @@
\newboolean{lineno}
\setboolean{lineno}{false}
+\newboolean{balance}
+\setboolean{balance}{false}
+
\newboolean{lists}
\setboolean{lists}{true}
\RequirePackage{kvoptions}
-\RequirePackage{kvsetkeys}
+%\RequirePackage{kvsetkeys} %<== this package is called by kvoptions
\SetupKeyvalOptions{
family=asmejour,
prefix=asmejour@,
@@ -98,7 +101,16 @@
\setboolean{lineno}{#1}
}
+%%% set key [balance] to activate final column balancing.
+\define@key{asmejour}{balance}[true]{%
+ \setboolean{balance}{#1}
+}
+
%%% set key [lang,lang-second,lang-third] to pass languages to babel.
+
+%% In case language options are dropped during editing, include this. Subsequent choice of lang= will override it.
+\PassOptionsToPackage{english}{babel}
+
\define@key{asmejour}{lang}[english]{%
\PassOptionsToPackage{#1}{babel}%
}
@@ -197,6 +209,9 @@
\RequirePackage[]{newtxtext}
\RequirePackage[varqu,varl]{inconsolata} % sans typewriter font
\RequirePackage[]{newtxmath}
+
+%% override \textsu if using default superiors
+\ifthenelse{\boolean{DefaultSups}}{\let\textsu\textsuperscript}{\relax}
\RequirePackage[]{mathalfa} % load optional fonts for Calligraphy, Script, etc.
@@ -249,30 +264,53 @@
\providecommand{\keywordname}{Keywords}
-%%%%%%%%%%%%%%%%% LINE AND EQUATION NUMBERING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%% EQUATION AND LINE NUMBERING %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% ASME puts equation tags in blue
+\RequirePackage{xpatch}
+\xpatchcmd{\tagform@}{(\ignorespaces#1\unskip\@@italiccorr)}{\color{blue}(\ignorespaces#1\unskip\@@italiccorr)}{}{}
+
+%% Ensure that the current font is used for equation tags, not \normalfont as set by amsmath
+\def\maketag@@@#1{\hbox{\m@th#1}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifthenelse{\boolean{lineno}}{%
- \RequirePackage[switch]{lineno}
+ \RequirePackage[switch,mathlines]{lineno}
\renewcommand{\linenumberfont}{\normalfont\footnotesize\color{red}}
\AtBeginDocument{\linenumbers}
\ClassWarningNoLine{asmejour}{Package lineno loaded, so final column balancing is disabled}
+%%% Allow line numbering in AMS math environments.
+%%% postdisplaypenalty adjusted to avoid extra line number at end, see discussion here: https://tex.stackexchange.com/a/461192/
+%%% multline has some problem that puts an extra line number above it.
+%%% Requires xparse and etoolbox
+\NewDocumentCommand{\losepostpenalty}{}{\patchcmd{\linenomathWithnumbers}{\advance\postdisplaypenalty\linenopenalty}{}{}{}}
+
+\NewDocumentCommand{\FixAMSMath}{m}{%
+ \AtBeginEnvironment{#1}{\losepostpenalty\linenomath}%
+ \AtEndEnvironment{#1}{\endlinenomath}%
+ \AtBeginEnvironment{#1*}{\losepostpenalty\linenomath}%
+ \AtEndEnvironment{#1*}{\endlinenomath}%
+}
+
+\NewDocumentCommand{\FixAll}{>{\SplitList{;}}m}{\ProcessList{#1}{\FixAMSMath}}
+\FixAll{align;alignat;gather;flalign;multline}
+
}{%
- \RequirePackage{flushend} % flushend package is NOT compatible with lineno
+ \ProvideDocumentEnvironment{linenomath}{}{}{}
+ \ifthenelse{\boolean{balance}}{% balancing through flushend can produce weird errors
+ \RequirePackage{flushend} % flushend package is NOT compatible with lineno
\AtEndDocument{\flushcolsend}
+ }{\relax}
}
\providecommand{\@LN@col}[1]{\relax}
\providecommand{\@LN}[2]{\relax}
%% ASME page proofs seem to align the number at top of the line, rather than bottom as done here.
-%% ASME puts equation tags in blue
-\RequirePackage{xpatch}
-\xpatchcmd{\tagform@}{(\ignorespaces#1\unskip\@@italiccorr)}{\color{blue}(\ignorespaces#1\unskip\@@italiccorr)}{}{}
-
-
%%%%%%%%%%%%%%%%% FOOTER SET UP %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%% footer text names %%%%%%%%%%
+%%%%%%%%%%% footer text names %%%%%%%%%%%%%%%
\newcommand{\JourName}[1]{\gdef\@JourName{#1}}
\providecommand\@JourName{\hbox{ }}
@@ -340,8 +378,27 @@
\renewcommand\@makefntext[1]{%
\noindent\makebox[4mm][r]{\@makefnmark}\hyphenpenalty=300\exhyphenpenalty=300 #1} %<== suppress hyphenation
-%% Produces an unmarked footnote about the submission date. Insert \reviewfootnote{..} on first page if desired.
-\def\reviewfootnote{\gdef\@thefnmark{}\@footnotetext}
+%% Produces an unmarked footnote about the revision date.
+%% This command is invoked by \date as part of \MakeTitlePage below.
+%% Text can be anything given as the argument to \date{..}.
+\NewDocumentCommand{\revfootnote}{m}{\begin{NoHyper}\gdef\@thefnmark{}\@footnotetext{#1}\end{NoHyper}}
+
+% Previous is modified to eliminate missing anchor warning from hyperref that following would cause
+%\def\revfootnote{\gdef\@thefnmark{}\@footnotetext}
+
+
+%% include a comma for sequential footnotes
+\newcommand\nextToken\relax
+
+\let\oldfootnote\footnote
+\renewcommand\footnote[1]{%
+ \oldfootnote{#1}\futurelet\nextToken\isOtherfnote}
+
+\newcommand\isOtherfnote{%
+ \ifx\footnote\nextToken\textsu{\mdseries,}%
+ \fi%
+}
+
%%%%%%%%% CAPTION RELATED %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -391,7 +448,7 @@
\RequirePackage{enumitem}
\setlist[enumerate,1]{label = (\arabic*), ref = (\arabic*),labelindent=3mm, leftmargin=*,noitemsep}
-%% have no examples of sublists...
+%% I have no examples of sublists...
%%%%%%%%%%%%%%%%% Hyperref %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -601,18 +658,17 @@
}
}
-
\DeclareDocumentCommand\SetAbstract{m}{%
\SetVerticalCoffin{\Abstract}{114mm}{%
\noindent\itshape%
#1
- \@keywords
+ \@keywords\par%
\vspace*{4mm}% <== at bottom of abstract to extend rule
}
}
\DeclareDocumentCommand{\ConstructAuthorBlock}{}{%
-\JoinCoffins\Title[hc,b]\Abstract[hc,t](0pt,-1.5\coffinsep)
+\JoinCoffins\Title[l,b]\Abstract[l,t](0pt,-1.5\coffinsep)
\setlength{\Titleheight}{\CoffinTotalHeight\Title}
\ifdim\Titleheight>\rulecofheight
\setlength{\rulecofheight}{\Titleheight}
@@ -627,10 +683,10 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Corresponding author gets footnote #1 and subsequent notes are 2, 3, ....
-%%% ASME apparently does not recognize joint first authors...so have not coded that functionality
+%%% ASME apparently does not recognize joint first authors...so I have not coded that functionality
-%%%% Flag for corresponding author (just one expected, although code supports more than one)
-%%%% for more than one, if including email in footnote, place in final command
+%%%% Flag for corresponding author (just one expected, although this code supports more than one)
+%%%% for more than one CA, if including email addresses in the footnote, place them in final the command
\newif\ifCA\CAfalse
\newcommand{\CAemail}[1]{\gdef\@CAemail{#1}}
@@ -666,9 +722,31 @@
\addtocounter{footnote}{1}
\footnotetext{Corresponding author\@CAsep \@CAemail}
\fi
+\ifDate\revfootnote{\@Date} \else\relax \fi
}
-%%%
+%%%%%%%%%%
+
+%% Provide compatibility with titling commands from standard LaTeX article class
+
+\RenewDocumentCommand{\maketitle}{}{\MakeTitlePage}
+\RenewDocumentCommand{\title}{}{\SetTitle}
+
+\RenewDocumentEnvironment{abstract}{+b}{\gdef\tmp{\SetAbstract{#1}}\aftergroup\tmp}{}
+%% Thanks to DPC for the suggestion of \gdef\tmp{...
+
+%% Put date as an unnumbered footnote at bottom of first column
+\newif\ifDate\Datetrue % If true, print a date.
+
+\ExplSyntaxOn
+\RenewDocumentCommand{\date}{m}
+ {%
+ \tl_if_empty:nTF {#1}{\global\Datefalse}{\gdef\@Date{#1}}%
+ }
+\providecommand\@Date{\today}
+\ExplSyntaxOff
+
+\RenewDocumentCommand{\thanks}{m}{\relax} %% disabling this standard command, as it is inconsistent with the format
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf
index 0009bfbfa7..cba147b5d2 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf
index 21d2a832b7..3b3b1d9d4d 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.pdf
Binary files differ
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex
index 8465958fec..19ec2e5d50 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/documentation/biblatex-manuscripts-philology.tex
@@ -21,8 +21,8 @@
subtitle={New data types},
email={maieul <at> maieul <dot> net},
author={Maïeul Rouquette},
- revision={2.1.0},
- date={30/09/2018},
+ revision={2.1.1},
+ date={02/10/2019},
url={https://github.com/maieul/biblatex-manuscripts-philology}}
@@ -415,6 +415,10 @@ The version 2.0.0 adds some modification which could require modifications in yo
\begin{changelog}
+\begin{release}{2.1.1}{2018-10-02}
+\item Fix warning with sorting schemes.
+\end{release}
+
\begin{release}{2.1.0}{2018-09-30}
\item Add \cs{detailcite} and \cs{detailscites} commands.
\item Add \opt{env}=\cnt{details-noshorthand} option to \cs{printbibliography}.
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx
index a5168299e6..14973b321e 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/english-manuscripts.lbx
@@ -9,10 +9,10 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{english-manuscripts.lbx}[2018/09/30 v2.1.0 manuscripts biblatex localisation]%
+\ProvidesFile{english-manuscripts.lbx}[2019/10/02 v2.1.1 manuscripts biblatex localisation]%
\InheritBibliographyStrings{english}
\InheritBibliographyExtras{english}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx
index 5349f218bf..b5a58ef732 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/french-manuscripts.lbx
@@ -9,10 +9,10 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{french-manuscripts.lbx}[2019/09/30 v2.1.0 manuscripts biblatex localisation]%
+\ProvidesFile{french-manuscripts.lbx}[2019/10/02 v2.1.1 manuscripts biblatex localisation]%
\InheritBibliographyStrings{french}
\InheritBibliographyExtras{french}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx
index e5c1fd4d34..333fcaccf4 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/italian-manuscripts.lbx
@@ -9,10 +9,10 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
-\ProvidesFile{italian-manuscripts.lbx}[2018/09/30 v2.1.0 manuscripts biblatex localisation]%
+\ProvidesFile{italian-manuscripts.lbx}[2019/10/02 v2.1.1 manuscripts biblatex localisation]%
\InheritBibliographyStrings{italian}
\InheritBibliographyExtras{italian}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx
index 7bca6ea878..dd1af1f7a2 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.bbx
@@ -9,11 +9,11 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
\ProvidesFile{manuscripts-noautoshorthand.bbx}
-[2018/09/30 v2.1.0 biblatex bibliography style (MR)]%
+[2019/10/02 v2.1.1 biblatex bibliography style (MR)]%
\RequireBibliographyStyle{manuscripts-shared}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx
index 62cc12a905..85531938ec 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-noautoshorthand.dbx
@@ -9,9 +9,9 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
\ProvidesFile{manuscripts-noautoshorthand.dbx}
-[2018/09/30 2.1.0 biblatex bibliography style (MR)]
+[2019/10/02 v2.1.1 biblatex bibliography style (MR)]
\blx@inputonce{manuscripts-shared.dbx}{}{}{}{}{}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx
index 51734923b6..9b2189ae5d 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.bbx
@@ -9,12 +9,12 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
\ProvidesFile{manuscripts-commons}
-[2018/09/30 2.1.0 biblatex bibliography style (MR)]%
+[2019/10/02 v2.1.1 biblatex bibliography style (MR)]%
\ifdef{\biblatexmultipledm@bibstyle}
{\RequireBibliographyStyle{\biblatexmultipledm@bibstyle}}
@@ -107,7 +107,7 @@
\setunit{\librarycollectionpunct}%
\usebibmacro{manuscript:collection+shelfmark}%
}
-
+
\newbibmacro{manuscript:pages}{%
\printfield{pagetotal}%
\iffieldundef{pages}%
@@ -120,7 +120,7 @@
\printfield{pages}%
\usebibmacro{manuscript:layer}%
}%
-}
+}
\newbibmacro{manuscript:columns+layer}{%
\ifboolexpr{test {\iffieldundef{columns}} or test{\iffieldundef{layer}}}{%
@@ -324,7 +324,7 @@
}
\sort{
\field{collection}
- \field{0000}
+ \literal{0000}
}
\sort{
\field[padside=left,padwidth=50,padchar=0]{sortshelfmark}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx
index 1dc2acd02f..33cf7345b7 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts-shared.dbx
@@ -9,11 +9,11 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts.dbx, manuscripts.bbx, french-manuscripts.lbx and english-manuscripts.lbx
\ProvidesFile{manuscripts-shared.dbx}%
-[2018/09/30 v2.1.0 biblatex bibliography style (MR)]%
+[2019/10/02 v2.1.1 biblatex bibliography style (MR)]%
\DeclareDatamodelEntrytypes{manuscript}
\DeclareDatamodelFields[type=field,datatype=literal]{%
catalog,
@@ -41,7 +41,7 @@
shortlibrary,
shortcollection,
columns,
- languages,
+ languages,
collection,
usualtitle,
shelfmark,
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx
index 79563a5e88..7f2daae1bf 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.bbx
@@ -9,11 +9,11 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
\ProvidesFile{manuscripts.bbx}%
-[2018/09/30 v2.1.0 biblatex bibliography style (MR)]%
+[2019/10/02 v2.1.1 biblatex bibliography style (MR)]%
\RequireBibliographyStyle{manuscripts-shared}
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx
index 18e1c0933b..48feec3c14 100644
--- a/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx
+++ b/macros/latex/contrib/biblatex-contrib/biblatex-manuscripts-philology/manuscripts.dbx
@@ -9,9 +9,9 @@
% version 2005/12/01 or later.
%
% This work has the LPPL maintenance status `maintained'.
-%
+%
% The Current Maintainer of this work is Maïeul Rouquette
% This work consists of the files manuscripts*.dbx, manuscripts*.bbx, manuscripts*.lbx
\ProvidesFile{manuscripts.dbx}
-[2018/09/30 v2.1.0 biblatex bibliography style (MR)]
+[2019/10/02 v2.1.1 biblatex bibliography style (MR)]
\blx@inputonce{manuscripts-shared.dbx}{}{}{}{}{}
diff --git a/macros/latex/contrib/chemnum/README b/macros/latex/contrib/chemnum/README
index ddfa8b2331..fd5fdfcd17 100644
--- a/macros/latex/contrib/chemnum/README
+++ b/macros/latex/contrib/chemnum/README
@@ -1,16 +1,14 @@
--------------------------------------------------------------------------
-chemnum v1.2 2016/04/14
+chemnum v1.2c 2019/10/02
a comprehensive approach for the numbering of chemical compounds
--------------------------------------------------------------------------
Clemens Niederberger
-Web:
- v0.* https://bitbucket.org/cgnieder/chemnum/
- v1.* https://github.com/cgnieder/chemnum
+Web: https://github.com/cgnieder/chemnum
E-Mail: contact@mychemistry.eu
--------------------------------------------------------------------------
-Copyright 2011-2016 Clemens Niederberger
+Copyright 2011--2019 Clemens Niederberger
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
@@ -32,5 +30,3 @@ This work consists of the files
- chemnum_en.tex, chemnum_en.pdf
- README
--------------------------------------------------------------------------
-Version 1 is a complete re-write from scratch of the `chemnum' package.
---------------------------------------------------------------------------
diff --git a/macros/latex/contrib/chemnum/chemnum.sty b/macros/latex/contrib/chemnum/chemnum.sty
index 659378bf72..b7d1277df4 100644
--- a/macros/latex/contrib/chemnum/chemnum.sty
+++ b/macros/latex/contrib/chemnum/chemnum.sty
@@ -12,7 +12,7 @@
% If you have any ideas, questions, suggestions or bugs to report, please
% feel free to contact me.
% --------------------------------------------------------------------------
-% Copyright 2011-2016 Clemens Niederberger
+% Copyright 2011--2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -26,32 +26,41 @@
%
% The Current Maintainer of this work is Clemens Niederberger.
% --------------------------------------------------------------------------
-\def\chemnumdate{2016/04/14}
-\def\chemnumversion{1.2}
-\def\chemnuminfo{a comprehensive approach for the numbering of chemical compounds}
+\RequirePackage{expl3,xparse,l3keys2e}
-\RequirePackage{expl3}[2016/03/28]
-\RequirePackage{xparse,l3keys2e}
+\ExplSyntaxOn
+\tl_const:Nn \c_chemnum_date_tl {2019/10/02}
+\tl_const:Nn \c_chemnum_version_number_tl {1.2}
+\tl_const:Nn \c_chemnum_version_suffix_tl {c}
+\tl_const:Nx \c_chemnum_version_tl
+ { \c_chemnum_version_number_tl \c_chemnum_version_suffix_tl }
+\tl_const:Nn \c_chemnum_info_tl
+ {a~ comprehensive~ approach~ for~ the~ numbering~ of~ chemical~ compounds}
% ----------------------------------------------------------------------------
% provide the package:
-\ProvidesExplPackage{chemnum}
- {\chemnumdate}
- {\chemnumversion}
- {\chemnuminfo\space (CN)}
+\ProvidesExplPackage
+ {chemnum}
+ {\c_chemnum_date_tl}
+ {\c_chemnum_version_tl}
+ {\c_chemnum_info_tl \c_space_tl (CN)}
% ----------------------------------------------------------------------------
% required packages:
% language support:
-\RequirePackage{translations}[2015/11/07]
+\RequirePackage{translations}
+
% greek alphabet for the labels matching to chemmacros' selection:
-\RequirePackage{chemgreek}[2016/02/10]
+\RequirePackage{chemgreek}
\RequirePackage{psfrag}
% ----------------------------------------------------------------------------
% messages:
\msg_new:nnn {chemnum} {missing-label}
- { The~ key~ `#1'~ has~ no~ label~ associated~ \msg_line_context: }
+ {
+ The~ key~ `#1' \tl_if_blank:nF {#2} {~ of~`#2'} ~ has~ no~ label~
+ associated~ \msg_line_context:
+ }
\msg_new:nnn {chemnum} {erroneous-argument-combination}
{
@@ -210,6 +219,8 @@
\int_new:N \l__chemnum_tmpb_int
\int_new:N \l__chemnum_tmpc_int
+\str_new:N \l__chemnum_tmpa_str
+
% ----------------------------------------------------------------------------
% variables:
\prop_new:N \l__chemnum_label_formats_prop
@@ -227,6 +238,7 @@
\seq_new:N \g__chemnum_defined_compounds_seq
\seq_new:N \g__chemnum_compound_defined_subcompounds_seq
+\tl_const:Nn \c_chemnum_nothing_here_tl {??}
\tl_new:N \l__chemnum_label_format_tl
\tl_set:Nn \l__chemnum_label_format_tl {\bfseries}
\tl_new:N \l__chemnum_local_label_format_tl
@@ -367,13 +379,13 @@
sub-counter-format .groups:n = {compound,general} ,
% label:
pre-label-code .tl_set:N = \l__chemnum_pre_label_default_tl ,
- pre-label-code .groups:n = {compound} ,
+ pre-label-code .groups:n = {compound,general} ,
post-label-code .tl_set:N = \l__chemnum_post_label_default_tl ,
- post-label-code .groups:n = {compound} ,
+ post-label-code .groups:n = {compound,general} ,
pre-main-label-code .tl_set:N = \l__chemnum_pre_main_label_default_tl ,
- pre-main-label-code .groups:n = {compound} ,
+ pre-main-label-code .groups:n = {compound,general} ,
post-main-label-code .tl_set:N = \l__chemnum_post_main_label_default_tl ,
- post-main-label-code .groups:n = {compound} ,
+ post-main-label-code .groups:n = {compound,general} ,
main-sub-sep .tl_set:N = \l__chemnum_compound_separator_tl ,
main-sub-sep .groups:n = {general,list} ,
list-label-sep .tl_set:N = \l__chemnum_main_separator_tl ,
@@ -512,14 +524,15 @@
% if the `chemnum' package is removed from the preamble
\AtBeginDocument
{
- \if@filesw
- \iow_now:Nn \@auxout
- {
- \providecommand\chemnum@cmpd[8]{} ^^J
- \providecommand\chemnum@subcmpd[4]{} ^^J
- \providecommand\chemnum@check{}
- }
- \fi
+ \legacy_if:nT {@filesw}
+ {
+ \iow_now:Nn \@auxout
+ {
+ \providecommand\chemnum@cmpd[8]{} ^^J
+ \providecommand\chemnum@subcmpd[4]{} ^^J
+ \providecommand\chemnum@check{}
+ }
+ }
}
% we use this one to trigger a LaTeX rerun warning -- to be precise the
@@ -528,7 +541,11 @@
{ \AtEndDocument { \def \chemnum@check { \@tempswatrue } } }
% add the rerun check at the end:
-\AtEndDocument { \if@filesw \iow_now:Nn \@auxout { \chemnum@check } \fi }
+\AtEndDocument
+ {
+ \legacy_if:nT {@filesw}
+ { \iow_now:Nn \@auxout { \chemnum@check } }
+ }
% ----------------------------------------------------------------------------
% initiating new compounds
@@ -624,8 +641,8 @@
\int_gincr:N \g__chemnum_main_int
\stepcounter{cmpdmain}
}
- \seq_if_exist:cF { g__chemnum_#1_initiated_subcompounds_seq }
- { \seq_new:c { g__chemnum_#1_initiated_subcompounds_seq } }
+ \seq_if_exist:cF {g__chemnum_#1_initiated_subcompounds_seq}
+ { \seq_new:c {g__chemnum_#1_initiated_subcompounds_seq} }
}
% #1: main ID
@@ -643,11 +660,11 @@
\chemnum_subcompound_set_property:nnnn {#1} {#2} {ID} {#2}
\chemnum_subcompound_set_property:nnnn {#1} {#2} {main-compound} {#1}
\chemnum_subcompound_set_property:nnnx {#1} {#2} {number}
- { \int_use:c { g__chemnum_compound_#1_subcompound_int } }
+ { \int_use:c {g__chemnum_compound_#1_subcompound_int} }
\chemnum_subcompound_set_property:nnnx {#1} {#2} {counter-representation}
{
\__chemnum_label_format:cV
- { g__chemnum_compound_#1_subcompound_int }
+ {g__chemnum_compound_#1_subcompound_int}
\l__chemnum_default_subcounter_representation_tl
}
}
@@ -661,26 +678,41 @@
\cs_new_protected:Npn \chemnum_initialize_subcompound:nn #1#2
{
- \int_if_exist:cF { g__chemnum_compound_#1_subcompound_int }
- { \int_new:c { g__chemnum_compound_#1_subcompound_int } }
- \int_gincr:c { g__chemnum_compound_#1_subcompound_int }
- \seq_if_exist:cF { g__chemnum_compound_#1_subcompounds_seq }
- { \seq_new:c { g__chemnum_compound_#1_subcompounds_seq } }
- \prop_if_exist:cF { g__chemnum_compound_#1_subcompounds_prop }
- { \prop_new:c { g__chemnum_compound_#1_subcompounds_prop } }
- \seq_if_in:cnF { g__chemnum_compound_#1_subcompounds_seq } {#2}
- { \seq_gput_right:cn { g__chemnum_compound_#1_subcompounds_seq } {#2} }
+ \int_if_exist:cF {g__chemnum_compound_#1_subcompound_int}
+ { \int_new:c {g__chemnum_compound_#1_subcompound_int} }
+ \int_gincr:c {g__chemnum_compound_#1_subcompound_int}
+ \seq_if_exist:cF {g__chemnum_compound_#1_subcompounds_seq}
+ { \seq_new:c {g__chemnum_compound_#1_subcompounds_seq} }
+ \prop_if_exist:cF {g__chemnum_compound_#1_subcompounds_prop}
+ { \prop_new:c {g__chemnum_compound_#1_subcompounds_prop} }
+ \seq_if_in:cnF {g__chemnum_compound_#1_subcompounds_seq} {#2}
+ { \seq_gput_right:cn {g__chemnum_compound_#1_subcompounds_seq} {#2} }
\seq_gput_right:Nn \g__chemnum_compound_defined_subcompounds_seq {#1#2}
- \prop_gput:cnx { g__chemnum_compound_#1_subcompounds_prop } {#2}
+ \prop_gput:cnx {g__chemnum_compound_#1_subcompounds_prop} {#2}
{
- \int_use:c { g__chemnum_compound_#1_subcompound_int } :
+ \int_use:c {g__chemnum_compound_#1_subcompound_int} :
\__chemnum_label_format:cV
- { g__chemnum_compound_#1_subcompound_int }
+ {g__chemnum_compound_#1_subcompound_int}
\l__chemnum_default_subcounter_representation_tl
}
}
% ----------------------------------------------------------------------------
+
+\cs_new:Npn \__chemnum_nothing_here:n #1
+ {
+ \c_chemnum_nothing_here_tl
+ \msg_warning:nnn {chemnum} {missing-label} {#1}
+ }
+
+\cs_new:Npn \__chemnum_nothing_here:nn #1#2
+ {
+ \c_chemnum_nothing_here_tl
+ \msg_warning:nnnn {chemnum} {missing-label} {#1} {#2}
+ }
+\cs_generate_variant:Nn \__chemnum_nothing_here:nn {x}
+
+% ----------------------------------------------------------------------------
\cs_new_protected:Npn \chemnum_log_main:n #1
{
\bool_if:NT \l__chemnum_log_bool
@@ -716,7 +748,7 @@
\prg_new_protected_conditional:Npnn \chemnum_subcompound_if_initiated:nn #1#2
{ T,F,TF }
{
- \seq_if_in:cnTF { g__chemnum_#1_initiated_subcompounds_seq } {#2}
+ \seq_if_in:cnTF {g__chemnum_#1_initiated_subcompounds_seq} {#2}
{ \prg_return_true: }
{ \prg_return_false: }
}
@@ -745,12 +777,12 @@
% #2: property to be defined
\cs_new_protected:Npn \chemnum_compound_declare_property:nn #1#2
{
- \seq_if_exist:cF { g__chemnum_compound_#1_properties_seq }
- { \seq_new:c { g__chemnum_compound_#1_properties_seq } }
- \prop_if_exist:cF { g__chemnum_compound_#1_prop }
- { \prop_new:c { g__chemnum_compound_#1_prop } }
- \seq_if_in:cnF { g__chemnum_compound_#1_properties_seq } {#2}
- { \seq_gput_right:cn { g__chemnum_compound_#1_properties_seq } {#2} }
+ \seq_if_exist:cF {g__chemnum_compound_#1_properties_seq }
+ { \seq_new:c {g__chemnum_compound_#1_properties_seq} }
+ \prop_if_exist:cF {g__chemnum_compound_#1_prop}
+ { \prop_new:c {g__chemnum_compound_#1_prop} }
+ \seq_if_in:cnF {g__chemnum_compound_#1_properties_seq} {#2}
+ { \seq_gput_right:cn {g__chemnum_compound_#1_properties_seq} {#2} }
}
% #1: ID
@@ -766,8 +798,8 @@
% #3: value of property
\cs_new_protected:Npn \chemnum_compound_set_property:nnn #1#2#3
{
- \seq_if_in:cnTF { g__chemnum_compound_#1_properties_seq } {#2}
- { \prop_gput:cnn { g__chemnum_compound_#1_prop } {#2} {#3} }
+ \seq_if_in:cnTF {g__chemnum_compound_#1_properties_seq} {#2}
+ { \prop_gput:cnn {g__chemnum_compound_#1_prop} {#2} {#3} }
{ \msg_error:nnn {chemnum} {property-undefined} {#1} {#2} }
}
\cs_generate_variant:Nn \chemnum_compound_set_property:nnn { nnV , nnx }
@@ -776,15 +808,15 @@
% #2: property to be updated
\cs_new_protected:Npn \chemnum_compound_update_property:nn #1#2
{
- \seq_if_in:cnTF { g__chemnum_compound_#1_properties_seq } {#2}
+ \seq_if_in:cnTF {g__chemnum_compound_#1_properties_seq} {#2}
{
- \prop_get:cnN { g__chemnum_compound_#1_prop } {previous-#2}
+ \prop_get:cnN {g__chemnum_compound_#1_prop} {previous-#2}
\l__chemnum_tmpa_tl
- \prop_get:cnN { g__chemnum_compound_#1_prop } {#2}
+ \prop_get:cnN {g__chemnum_compound_#1_prop} {#2}
\l__chemnum_tmpb_tl
\tl_if_eq:NNF \l__chemnum_tmpb_tl \l__chemnum_tmpa_tl
{
- \prop_gput:cnV { g__chemnum_compound_#1_prop }
+ \prop_gput:cnV {g__chemnum_compound_#1_prop}
{previous-#2}
\l__chemnum_tmpb_tl
}
@@ -795,7 +827,7 @@
% #1: ID
\cs_new_protected:Npn \chemnum_compound_update_properties:n #1
{
- \seq_map_inline:cn { g__chemnum_compound_#1_properties_seq }
+ \seq_map_inline:cn {g__chemnum_compound_#1_properties_seq}
{ \chemnum_compound_update_property:nn {#1} {##1} }
}
@@ -804,8 +836,8 @@
% #3: property to be defined
\cs_new_protected:Npn \chemnum_subcompound_declare_property:nnn #1#2#3
{
- \seq_if_in:cnF { g__chemnum_compound_#1_#2_properties_seq } {#3}
- { \seq_gput_right:cn { g__chemnum_compound_#1_#2_properties_seq } {#3} }
+ \seq_if_in:cnF {g__chemnum_compound_#1_#2_properties_seq} {#3}
+ { \seq_gput_right:cn {g__chemnum_compound_#1_#2_properties_seq} {#3} }
}
% #1: main ID
@@ -813,11 +845,11 @@
% #3: properties to be defined
\cs_new_protected:Npn \chemnum_subcompound_declare_properties:nnn #1#2#3
{
- \seq_if_exist:cF { g__chemnum_compound_#1_#2_properties_seq }
- { \seq_new:c { g__chemnum_compound_#1_#2_properties_seq } }
- \prop_if_exist:cF { g__chemnum_compound_#1_#2_properties_prop }
- { \prop_new:c { g__chemnum_compound_#1_#2_properties_prop } }
- \clist_map_inline:nn { #3 }
+ \seq_if_exist:cF {g__chemnum_compound_#1_#2_properties_seq}
+ { \seq_new:c {g__chemnum_compound_#1_#2_properties_seq} }
+ \prop_if_exist:cF {g__chemnum_compound_#1_#2_properties_prop}
+ { \prop_new:c {g__chemnum_compound_#1_#2_properties_prop} }
+ \clist_map_inline:nn {#3}
{ \chemnum_subcompound_declare_property:nnn {#1} {#2} {##1} }
}
@@ -827,8 +859,8 @@
% #4: value of property
\cs_new_protected:Npn \chemnum_subcompound_set_property:nnnn #1#2#3#4
{
- \seq_if_in:cnTF { g__chemnum_compound_#1_#2_properties_seq } {#3}
- { \prop_gput:cnn { g__chemnum_compound_#1_#2_properties_prop } {#3} {#4} }
+ \seq_if_in:cnTF {g__chemnum_compound_#1_#2_properties_seq} {#3}
+ { \prop_gput:cnn {g__chemnum_compound_#1_#2_properties_prop} {#3} {#4} }
{ \msg_error:nnn {chemnum} {property-undefined} {#1.#2} {#3} }
}
\cs_generate_variant:Nn \chemnum_subcompound_set_property:nnnn { nnnV , nnnx }
@@ -838,15 +870,15 @@
% #3: property to be updated
\cs_new_protected:Npn \chemnum_subcompound_update_property:nnn #1#2#3
{
- \seq_if_in:cnTF { g__chemnum_compound_#1_#2_properties_seq }
+ \seq_if_in:cnTF {g__chemnum_compound_#1_#2_properties_seq}
{
- \prop_get:cnN { g__chemnum_compound_#1_#2_properties_prop } {previous-#3}
+ \prop_get:cnN {g__chemnum_compound_#1_#2_properties_prop} {previous-#3}
\l__chemnum_tmpa_tl
- \prop_get:cnN { g__chemnum_compound_#1_#2_properties_prop } {#3}
+ \prop_get:cnN {g__chemnum_compound_#1_#2_properties_prop} {#3}
\l__chemnum_tmpb_tl
\tl_if_eq:NNF \l__chemnum_tmpb_tl \l__chemnum_tmpa_tl
{
- \prop_gput:cnV { g__chemnum_compound_#1_#2_properties_prop }
+ \prop_gput:cnV {g__chemnum_compound_#1_#2_properties_prop}
{previous-#3}
\l__chemnum_tmpb_tl
}
@@ -858,7 +890,7 @@
% #2: sub ID
\cs_new_protected:Npn \chemnum_subcompound_update_properties:nn #1#2
{
- \seq_map_inline:cn { g__chemnum_compound_#1_#2_properties_seq }
+ \seq_map_inline:cn {g__chemnum_compound_#1_#2_properties_seq}
{ \chemnum_subcompound_update_property:nnn {#1} {#2} {##1} }
}
@@ -869,14 +901,14 @@
\cs_new_protected:Npn \chemnum_get_compound_property_or:nnn #1#2#3
{
- \prop_get:cnNTF { g__chemnum_compound_#1_prop } {#2}
+ \prop_get:cnNTF {g__chemnum_compound_#1_prop} {#2}
\l__chemnum_tmpa_tl
{ \tl_use:N \l__chemnum_tmpa_tl }
{#3}
}
\cs_new:Npn \chemnum_expandable_get_compound_property:nn #1#2
- { \prop_item:cn { g__chemnum_compound_#1_prop } {#2} }
+ { \prop_item:cn {g__chemnum_compound_#1_prop} {#2} }
\cs_generate_variant:Nn \chemnum_expandable_get_compound_property:nn { V }
% #1: main ID
@@ -887,14 +919,14 @@
\cs_new_protected:Npn \chemnum_get_subcompound_property_or:nnnn #1#2#3#4
{
- \prop_get:cnNTF { g__chemnum_compound_#1_#2_properties_prop } {#3}
+ \prop_get:cnNTF {g__chemnum_compound_#1_#2_properties_prop} {#3}
\l__chemnum_tmpa_tl
{ \tl_use:N \l__chemnum_tmpa_tl }
{#4}
}
\cs_new:Npn \chemnum_expandable_get_subcompound_property:nnn #1#2#3
- { \prop_item:cn { g__chemnum_compound_#1_#2_properties_prop } {#3} }
+ { \prop_item:cn {g__chemnum_compound_#1_#2_properties_prop} {#3} }
% ----------------------------------------------------------------------------
\DeclareExpandableDocumentCommand \cmpdproperty { mm }
@@ -911,7 +943,7 @@
\cs_new_protected:Npn \chemnum_initiate_subcompound:nn #1#2
{
\chemnum_subcompound_if_initiated:nnF {#1} {#2}
- { \seq_gput_right:cn { g__chemnum_#1_initiated_subcompounds_seq } {#2} }
+ { \seq_gput_right:cn {g__chemnum_#1_initiated_subcompounds_seq} {#2} }
}
% ----------------------------------------------------------------------------
@@ -927,13 +959,11 @@
% #8: label format
\cs_new_protected:Npn \__chemnum_write_compound_to_auxfile_x:nnnnnnnn #1#2#3#4#5#6#7#8
{
- \if@filesw
- \token_if_eq_meaning:NNT \@nodocument \relax
- {
- \iow_now:Nx \@auxout
- { \exp_not:N \chemnum@cmpd {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8} }
- }
- \fi
+ \legacy_if:nT {@filesw}
+ {
+ \iow_now:Nx \@auxout
+ { \exp_not:N \chemnum@cmpd {#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8} }
+ }
}
\cs_generate_variant:Nn \__chemnum_write_compound_to_auxfile_x:nnnnnnnn { nnnVVVVV }
@@ -955,13 +985,11 @@
% #3: counter representation
\cs_new_protected:Npn \__chemnum_write_subcompound_to_auxfile_x:nnnn #1#2#3#4
{
- \if@filesw
- \token_if_eq_meaning:NNT \@nodocument \relax
- {
- \iow_now:Nx \@auxout
- { \exp_not:N \chemnum@subcmpd {#1}{#2}{#3}{#4} }
- }
- \fi
+ \legacy_if:nT {@filesw}
+ {
+ \iow_now:Nx \@auxout
+ { \exp_not:N \chemnum@subcmpd {#1}{#2}{#3}{#4} }
+ }
}
\cs_new_protected:Npn \chemnum_save_subcompound_to_auxfile:nn #1#2
@@ -989,21 +1017,21 @@
\cs_new_protected:Npn \chemnum@cmpd #1#2#3#4#5#6#7#8
{
% \chemnum_initialize_compound:n {#1}
- \prop_if_exist:cF { g__chemnum_compound_#1_prop }
- { \prop_new:c { g__chemnum_compound_#1_prop } }
- \prop_gput:cnn { g__chemnum_compound_#1_prop }
+ \prop_if_exist:cF {g__chemnum_compound_#1_prop}
+ { \prop_new:c {g__chemnum_compound_#1_prop} }
+ \prop_gput:cnn {g__chemnum_compound_#1_prop}
{previous-number} {#2}
- \prop_gput:cnn { g__chemnum_compound_#1_prop }
+ \prop_gput:cnn {g__chemnum_compound_#1_prop}
{previous-counter-representation} {#3}
- \prop_gput:cnn { g__chemnum_compound_#1_prop }
+ \prop_gput:cnn {g__chemnum_compound_#1_prop}
{previous-pre-label-code} {#4}
- \prop_gput:cnn { g__chemnum_compound_#1_prop }
+ \prop_gput:cnn {g__chemnum_compound_#1_prop}
{previous-post-label-code} {#5}
- \prop_gput:cnn { g__chemnum_compound_#1_prop }
+ \prop_gput:cnn {g__chemnum_compound_#1_prop}
{previous-pre-main-label-code} {#6}
- \prop_gput:cnn { g__chemnum_compound_#1_prop }
+ \prop_gput:cnn {g__chemnum_compound_#1_prop}
{previous-post-main-label-code} {#7}
- \prop_gput:cnn { g__chemnum_compound_#1_prop }
+ \prop_gput:cnn {g__chemnum_compound_#1_prop}
{previous-label-format} {#8}
}
@@ -1013,15 +1041,15 @@
% #4: counter representation
\cs_new_protected:Npn \chemnum@subcmpd #1#2#3#4
{
- \prop_if_exist:cF { g__chemnum_compound_#1_#2_properties_prop }
- { \prop_new:c { g__chemnum_compound_#1_#2_properties_prop } }
- \seq_if_exist:cF { g__chemnum_compound_#1_subcompounds_seq }
- { \seq_new:c { g__chemnum_compound_#1_subcompounds_seq } }
- \seq_if_in:cnF { g__chemnum_compound_#1_subcompounds_seq } {#2}
- { \seq_gput_right:cn { g__chemnum_compound_#1_subcompounds_seq } {#2} }
- \prop_gput:cnn { g__chemnum_compound_#1_#2_properties_prop }
+ \prop_if_exist:cF {g__chemnum_compound_#1_#2_properties_prop}
+ { \prop_new:c {g__chemnum_compound_#1_#2_properties_prop} }
+ \seq_if_exist:cF {g__chemnum_compound_#1_subcompounds_seq}
+ { \seq_new:c {g__chemnum_compound_#1_subcompounds_seq} }
+ \seq_if_in:cnF {g__chemnum_compound_#1_subcompounds_seq} {#2}
+ { \seq_gput_right:cn {g__chemnum_compound_#1_subcompounds_seq} {#2} }
+ \prop_gput:cnn {g__chemnum_compound_#1_#2_properties_prop}
{previous-number} {#3}
- \prop_gput:cnn { g__chemnum_compound_#1_#2_properties_prop }
+ \prop_gput:cnn {g__chemnum_compound_#1_#2_properties_prop}
{previous-counter-representation} {#4}
}
@@ -1060,7 +1088,6 @@
% #3: sub ID
\cs_new_protected:Npn \chemnum_declare_subcompound:nnn #1#2#3
{
- % \keys_set:nn {chemnum} {#1}
\chemnum_subcompound_if_initiated:nnF {#2} {#3}
{
\bool_if:NT \g__chemnum_initiate_sub_bool
@@ -1170,8 +1197,11 @@
\chemnum_get_compound_property:nn {#1} {previous-label-format}
{
\chemnum_get_compound_property_or:nnn {#1}
- { previous-counter-representation }
- { ?? \__chemnum_rerun: }
+ {previous-counter-representation}
+ {
+ \__chemnum_nothing_here:n {#1}
+ \__chemnum_rerun:
+ }
}
\group_end:
\chemnum_get_compound_property:nn {#1} {previous-post-main-label-code}
@@ -1189,7 +1219,10 @@
{
\chemnum_get_subcompound_property_or:nnnn {#1} {#2}
{previous-counter-representation}
- { ?? \__chemnum_rerun: }
+ {
+ \__chemnum_nothing_here:nn {#2} {#1}
+ \__chemnum_rerun:
+ }
}
\group_end:
}
@@ -1265,7 +1298,7 @@
{
\tl_clear:N \l__chemnum_tmpa_tl
\tl_set:Nx \l__chemnum_tmpa_tl
- { \seq_use:cn { g__chemnum_compound_##4_subcompounds_seq } { , } }
+ { \seq_use:cn {g__chemnum_compound_##4_subcompounds_seq} {,} }
\tl_if_blank:VF \l__chemnum_tmpa_tl
{
\chemnum_write_sublist:NNnnV ##1 ##2 {##3} {##4}
@@ -1294,8 +1327,8 @@
{
\bool_if:NTF #2
{
- \chemnum_hyper_link:nn {#4}
- { \chemnum_compound_read:n {#4} }
+ \bool_if:NF \l__chemnum_sub_only_bool
+ { \chemnum_hyper_link:nn {#4} { \chemnum_compound_read:n {#4} } }
\bool_if:NT #1
{ \msg_error:nn {chemnum} {erroneous-argument-combination} }
}
@@ -1353,10 +1386,18 @@
}
% ----------------------------------------------------------------------------
-\cs_set_protected:Npn \chemnum_show_key_def:n #1
- { \marginpar { \fbox { \normalfont \ttfamily #1 } } }
+\cs_new_protected:Npn \chemnum_print_label_id:n #1
+ {
+ \group_begin:
+ \str_set:Nn \l__chemnum_tmpa_str {#1}
+ \str_use:N \l__chemnum_tmpa_str
+ \group_end:
+ }
+
+\cs_new_protected:Npn \chemnum_show_label_margin:n #1
+ { \marginpar { \fbox {#1} } }
-\cs_set_protected:Npn \chemnum_show_key_ref:n #1
+\cs_new_protected:Npn \chemnum_show_label_inline:n #1
{
\group_begin:
\hbox_unpack:N \c_empty_box % this is \leavevmode
@@ -1366,18 +1407,38 @@
\hbox_overlap_right:n
{
\tex_vrule:D \tex_raise:D .75em
- \hbox:n
- { \underbar { \normalfont \footnotesize \ttfamily #1 } }
+ \hbox:n { \underbar {#1} }
}
}
\group_end:
}
-% ----------------------------------------------------------------------------
+\NewDocumentCommand \cmpdprintlabelid {m}
+ { \chemnum_print_label_id:n {#1} }
+
+\NewDocumentCommand \cmpdshowlabelmargin {m}
+ { \chemnum_show_label_margin:n {#1} }
+
+\NewDocumentCommand \cmpdshowlabelinline {m}
+ { \chemnum_show_label_inline:n {#1} }
+
\NewDocumentCommand \chemnumshowdef {m}
- { \chemnum_show_key_def:n {#1} }
+ {
+ \cmpdshowlabelmargin
+ {
+ \normalfont \ttfamily
+ \cmpdprintlabelid {#1}
+ }
+ }
+
\NewDocumentCommand \chemnumshowref {m}
- { \chemnum_show_key_ref:n {#1} }
+ {
+ \cmpdshowlabelinline
+ {
+ \normalfont \ttfamily \footnotesize
+ \cmpdprintlabelid {#1}
+ }
+ }
\NewDocumentCommand \cmpdshowdef {m} { \chemnumshowdef {#1} }
\NewDocumentCommand \cmpdshowref {m} { \chemnumshowref {#1} }
@@ -1396,7 +1457,7 @@
\l__chemnum_tmpc_seq
\l__chemnum_sub_separator_tl
{#5}
- \seq_remove_duplicates:N \l__chemnum_tmpc_seq
+ \seq_remove_duplicates:N \l__chemnum_tmpc_seq
\seq_map_inline:Nn \l__chemnum_tmpc_seq
{
\bool_if:NF #2
@@ -1467,29 +1528,34 @@
\seq_clear:N #7
\bool_if:NF #1
{
- \seq_map_inline:cn { g__chemnum_compound_#5_subcompounds_seq }
+ \seq_if_exist:cTF {g__chemnum_compound_#5_subcompounds_seq}
{
- \seq_if_in:NnT #3 {##1}
+ \seq_map_inline:Nn #3
{
- \seq_put_right:Nn #6
- { \chemnum_write_subcompound:NNnnn #1 #2 {#4} {#5} {##1} }
- \bool_if:NTF #2
+ \seq_if_in:cnTF {g__chemnum_compound_#5_subcompounds_seq} {##1}
{
- \seq_put_right:Nx #7
+ \seq_put_right:Nn #6
+ { \chemnum_write_subcompound:NNnnn #1 #2 {#4} {#5} {##1} }
+ \bool_if:NTF #2
{
- \chemnum_expandable_get_subcompound_property:nnn
- {#5} {##1} {previous-number}
+ \seq_put_right:Nx #7
+ {
+ \chemnum_expandable_get_subcompound_property:nnn
+ {#5} {##1} {previous-number}
+ }
}
- }
- {
- \seq_put_right:Nx #7
{
- \chemnum_expandable_get_subcompound_property:nnn
- {#5} {##1} {number}
+ \seq_put_right:Nx #7
+ {
+ \chemnum_expandable_get_subcompound_property:nnn
+ {#5} {##1} {number}
+ }
}
}
+ { \__chemnum_nothing_here:nn {##1} {#5} }
}
}
+ { \__chemnum_nothing_here:xn { \seq_use:Nnnn #3 {,~} {,~} {,~} } {#5} }
}
}
@@ -1917,8 +1983,8 @@
}
\NewDocumentCommand \initcmpd {O{}m}
- { \chemnum_init:nn {#1} {#2} }
-\@onlypreamble\cmpdinit
+ { \AtBeginDocument { \chemnum_init:nn {#1} {#2} } }
+\@onlypreamble\initcmpd
% ----------------------------------------------------------------------------
% resetting compound numbering
@@ -2008,4 +2074,10 @@ HISTORY:
\prop_item:Nn)
2016/04/14 v1.2 - changes to how compounds are saved to auxfile
- hyperref support: backlinks to first appearance of label
-
+2016/05/11 v1.2a - pre- and post-label options now belong both to the
+ `compound' and the `general' groups
+2016/10/22 v1.2b - enable label keys to be printed (with `show-keys') if they
+ contain underscores or similar tokens
+ - easier customization possibilities of the `show-keys'
+ functions
+2019/10/02 v1.2c - fix issues #5, #7
diff --git a/macros/latex/contrib/chemnum/chemnum_en.pdf b/macros/latex/contrib/chemnum/chemnum_en.pdf
index 4f6a1d26e5..9254c029c5 100644
--- a/macros/latex/contrib/chemnum/chemnum_en.pdf
+++ b/macros/latex/contrib/chemnum/chemnum_en.pdf
Binary files differ
diff --git a/macros/latex/contrib/chemnum/chemnum_en.tex b/macros/latex/contrib/chemnum/chemnum_en.tex
index a5abd7365d..f6da470d1d 100644
--- a/macros/latex/contrib/chemnum/chemnum_en.tex
+++ b/macros/latex/contrib/chemnum/chemnum_en.tex
@@ -1,8 +1,36 @@
-% arara: pdflatex: { shell: on }
-%! arara: pdflatex: { shell: on }
-% arara: biber
-% arara: pdflatex
-% arara: pdflatex
+% --------------------------------------------------------------------------
+% the CHEMNUM package
+%
+% a comprehensive approach for the numbering of chemical compounds
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% --------------------------------------------------------------------------
+% https://github.org/cgnieder/chemnum/
+% contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% --------------------------------------------------------------------------
+% Copyright 2011--2019 Clemens Niederberger
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clemens Niederberger.
+% --------------------------------------------------------------------------
+% !arara: pdflatex: { shell: on , interaction: nonstopmode }
+% !arara: pdflatex: { shell: on , interaction: nonstopmode }
+% !arara: biber
+% arara: pdflatex: { interaction: nonstopmode }
+% arara: pdflatex: { interaction: nonstopmode }
\documentclass[load-preamble+,ngerman,british,american]{cnltx-doc}
\usepackage[utf8]{inputenc}
\usepackage{chemnum}
@@ -47,7 +75,7 @@
keyis,
marginnote, midrule,
NewDocumentCommand,
- schemestart,schemestop,setatomsep,
+ schemestart,schemestop,setchemfig,
theffbibliography, toprule
} ,
index-setup = { othercode=\footnotesize,level=\addsec },
@@ -60,11 +88,13 @@
\usepackage{chemformula}
\setchemformula{format=\libertineLF}
\usepackage{chemfig,relsize}
-\setatomsep{1.78500 em}
-\setbondstyle{line width = 0.06642 em}
+\setchemfig{
+ atom sep = 1.78500 em ,
+ bond style = {line width = 0.06642 em}
+}
\renewcommand*\printatom[1]{\textsmaller{\ensuremath{\mathsf{#1}}}}
-\usepackage{array,booktabs}
+\usepackage{array,booktabs,csquotes}
\usepackage{graphicx}
@@ -112,57 +142,6 @@
\pkg{chemgreek}~\cite{pkg:chemgreek} and the \pkg{psfrag}~\cite{pkg:psfrag}
package.
-\section{News}\label{sec:news}
-The \chemnum\ package has been my first attempt to create a comprehensive
-labeling package for chemical compounds. However, it had and has more than
-one weakness and its code was -- to be frank -- a mess. Version~1 is now a
-complete re-write of \chemnum\ where I tried to achieve several points:
-\begin{itemize}
- \item A cleaner code internally.
- \item A cleaner user interface, \ie, more user macros for different tasks, a
- unified naming of the commands and a less redundant naming of the
- options.
- \item Extended functionality such as sorting and compressing of sublabel
- lists and sorting and merging of main label lists.
-\end{itemize}
-
-Although the syntax seems more or less the same at first sight quite a number
-of changes have been made that make version~1 incompatible with version~0.
-While I thought a while about maintaining backwards compatibility version~0
-was known to be in an experimental stage where everything was allowed to be
-changed at any time. So users \emph{could} know there was a risk. I have a
-feeling that many users nevertheless didn't realize this and may be bothered
-by this incompatibility. So I am well aware that the update will
-inconvenience some users. However, since version~0 won't be updated any more
-it made more sense to make a breaking update once.
-
-The same is not true for version~1. The syntax and commands described in this
-manual will not be changed as easily and from this version on I will take care
-of backwards compatibility.
-
-For those people wanting to keep older versions: they are are still available
-from websites such as \website{ctanhg.scharrer-online.de} or
-\securewebsite{bitbucket.org/cgnieder/chemnum}. You can also email me for an
-older version.
-
-Many commands have got a new name! The most important ones are:
-\begin{itemize}
- \item \cs*{cmpdref}; this is now called \cs{replacecmpd}.
- \item \cs*{cmpdinit}; this is now called \cs{initcmpd}.
- \item \cs*{cmpdreset}; this is now called \cs{resetcmpd}.
- \item \cs*{cmpdsetup}; this is now called \cs{setchemnum}.
-\end{itemize}
-However, there are many more changes. Basically all options have new names
-and often do their thing slightly different from the way things have been
-before.
-
-Please note that this overall change does not mean that version~1 is version~0
-declared stable. It is very likely that version~1 will now have quite a
-number of bugs to be fixed and probably missing features, too. So I'd be very
-glad to receive feedback either on \chemnum's homepage
-\securewebsite{github.com/cgnieder/chemnum} or via email to
-\email{contact@mychemistry.eu}.
-
\section{Overview over the Available Commands}\label{sec:overv-over-avail}
This section lists all available commands with a brief description. Commands
@@ -198,7 +177,7 @@ Most of the commands will be explained in a later section in more detail.
section~\ref{sec:deta-comp-labels}.
\command{replacecmpd}[\code{+}\oarg{options}\marg{\ac{id}}]
A command for replacing tags in \ac{eps} files, see
- section~\ref{sec:replacing-tags-aceps} for details.
+ section~\ref{sec:replacing-tags-eps-ps} for details.
\command{initcmpd}[\oarg{options}\marg{list of \acp{id}}]
Initiate compound labels. This command can only be used in the preamble.
It is desribed in section~\ref{sec:deta-comp-labels}.
@@ -329,7 +308,7 @@ see section~\ref{sec:chang-input-mark} for details.
More than one label can be put inside \cs{cmpd}, separated by commas. Then
a list like \cmpd{a, b, c, e, g.two} is printed.
\end{example}
-The Harvard comma (see section~\ref{sec:lang-depend-sett}) in \code{, and}
+The Harvard comma (see section~\ref{sec:lang-depend-sett}) in \enquote{\code{, and}}
between \cmpd{e} and \cmpd{g.two} suggests that there are options to customize
the list, see section~\ref{sec:formatting-labels} for more on this.
@@ -608,10 +587,14 @@ command. They are marked with \module{replace}.
\keybool{merge}\Module{both (l)}\Default{false}
If set to true a list of labels is merged, \ie,
``\cmpd{q.five,a,q.two}'' becomes ``\cmpd[merge=true]{q.five,a,q.two}''.
- \keyval{pre-label-code}{code}\Module{cmpd (g)}\Default
+ \keyval{pre-label-code}{code}\Module{both (g)}\Default
Code to be inserted before a label.
- \keyval{post-label-code}{code}\Module{cmpd (g)}\Default
+ \keyval{post-label-code}{code}\Module{both (g)}\Default
Code to be inserted after a label.
+ \keyval{pre-main-label-code}{code}\Module{both (g)}\Default
+ \sinceversion{1.2a}Code to be inserted before a main label.
+ \keyval{post-main-label-code}{code}\Module{both (g)}\Default
+ \sinceversion{1.2a}Code to be inserted after a main label.
\keyval{main-sub-sep}{code}\Module{both (l)}\Default{.}
The separator symbol that is used in \cs{cmpd} to separate the \meta{main
\ac{id}} from a \meta{sub \ac{id}}.
@@ -855,9 +838,9 @@ explicitly will overwrite the language sensitivity. If you only want to adapt
the separators to your language have a look at
section~\ref{sec:lang-depend-sett}.
-\section{Replacing Tags in \ac{eps} or \ac{ps} Files}\label{sec:replacing-tags-aceps}
+\section{Replacing Tags in \ac{eps} or \ac{ps} Files}\label{sec:replacing-tags-eps-ps}
-Although it is quite possible to create rection schemes within \LaTeX\
+Although it is quite possible to create reaction schemes within \LaTeX\
directly -- for example with the \pkg{chemfig} package~\cite{pkg:chemfig} --
many people prefer to use a program such as \textsc{ChemDraw} for it. In
order to be able to use the labels with such schemes as well the following
@@ -865,11 +848,18 @@ method is usually used:
\begin{itemize}
\item Create the scheme and place temporary tags like \code{TMP1},
\code{TMP2} and so on where you want the compound labels to be.
- \item Export the scheme as \ac{eps} or \ac{ps} figure where you make sure
- that the tags are embedded as text strings.
+ \item Export the scheme as \ac{eps} or \ac{ps} figure \emph{where you make
+ sure that the tags are embedded as text strings}. If the tags are not
+ present as text strings they cannot be replaced. This is a common source
+ of user problems.
\item Include the \ac{eps} with \cs*{includegraphics}. Right before that
use \cs{replacecmpd} once for every temporary tag.
\end{itemize}
+\emph{For the actual replacement please make sure that you compile with
+ \code{shell-escape} enabled. If you compile with \code{pdflatex} you
+ probably also need \pkg{auto-pst-pdf}~\cite{pkg:auto-pst-pdf} loaded. In
+ subsequent runs load it with option \code{off} when you turned off
+ \code{shell-escape}.}
\begin{commands}
\command{replacecmpd}[\code{+}\oarg{options}\marg{\ac{id}}]
@@ -894,7 +884,7 @@ The tags now can be replaced with labels. The result is shown in
figure~\ref{fig:scheme-tmp-tags-replaced}.
\begin{example}[compile,exe-with={--shell-escape},runs=1,float=htbp,caption={A scheme with
temporary tags replaced with labels.\label{fig:scheme-tmp-tags-replaced}}]
- % code for figure 2
+ % code for figure 2 -- compiled with shell-escape enabled
\documentclass{standalone}
\usepackage{graphicx,auto-pst-pdf,chemnum}
\begin{document}
@@ -971,7 +961,7 @@ respect to the \ac{ps} box that is replaced. This is described in
\begin{example}[compile,exe-with={--shell-escape},runs=1,float=htbp,caption={A scheme with
arbitrary tags replaced with labels.\label{fig:scheme-bla-tags-replaced}}]
- % code for figure 4
+ % code for figure 4 -- compiled with shell-escape enabled
\documentclass{standalone}
\usepackage{graphicx,auto-pst-pdf,chemnum}
\begin{document}
@@ -1025,6 +1015,11 @@ wrong please write me an email and I'll add your language or fix the wrong
translation.
\begin{table}[htbp]
+ \newcommand*\showlanguageentry[1]{%
+ #1
+ & \visualizespaces{\GetTranslationFor{#1}{chemnum-sep-two}}
+ & \visualizespaces{\GetTranslationFor{#1}{chemnum-sep-last-two}}
+ }
\centering
\caption{Available languages}
\label{tab:languages}
@@ -1034,45 +1029,19 @@ translation.
\bfseries chemnum-sep-two &
\bfseries chemnum-sep-last-two \\
\midrule
- English
- & \visualizespaces{\GetTranslationFor{English}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{English}{chemnum-sep-last-two}} \\
- American
- & \visualizespaces{\GetTranslationFor{American}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{American}{chemnum-sep-last-two}} \\
- German
- & \visualizespaces{\GetTranslationFor{German}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{German}{chemnum-sep-last-two}} \\
- French
- & \visualizespaces{\GetTranslationFor{French}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{French}{chemnum-sep-last-two}} \\
- Spanish
- & \visualizespaces{\GetTranslationFor{Spanish}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Spanish}{chemnum-sep-last-two}} \\
- Italian
- & \visualizespaces{\GetTranslationFor{Italian}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Italian}{chemnum-sep-last-two}} \\
- Catalan
- & \visualizespaces{\GetTranslationFor{Catalan}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Catalan}{chemnum-sep-last-two}} \\
- Portuguese
- & \visualizespaces{\GetTranslationFor{Portuguese}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Portuguese}{chemnum-sep-last-two}} \\
- Dutch
- & \visualizespaces{\GetTranslationFor{Dutch}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Dutch}{chemnum-sep-last-two}} \\
- Danish
- & \visualizespaces{\GetTranslationFor{Danish}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Danish}{chemnum-sep-last-two}} \\
- Swedish
- & \visualizespaces{\GetTranslationFor{Swedish}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Swedish}{chemnum-sep-last-two}} \\
- Finnish
- & \visualizespaces{\GetTranslationFor{Finnish}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Finnish}{chemnum-sep-last-two}} \\
- Norwegian
- & \visualizespaces{\GetTranslationFor{Norwegian}{chemnum-sep-two}}
- & \visualizespaces{\GetTranslationFor{Norwegian}{chemnum-sep-last-two}} \\
+ \showlanguageentry{English} \\
+ \showlanguageentry{American} \\
+ \showlanguageentry{German} \\
+ \showlanguageentry{French} \\
+ \showlanguageentry{Spanish} \\
+ \showlanguageentry{Italian} \\
+ \showlanguageentry{Catalan} \\
+ \showlanguageentry{Portuguese} \\
+ \showlanguageentry{Dutch} \\
+ \showlanguageentry{Danish} \\
+ \showlanguageentry{Swedish} \\
+ \showlanguageentry{Finnish} \\
+ \showlanguageentry{Norwegian} \\
\bottomrule
\end{tabular}
\end{table}
@@ -1173,6 +1142,55 @@ above commands are defined in terms of them:
\NewDocumentCommand\subcmpdshowref{mm}{\chemnumshowref{#2}}
\end{sourcecode}
-\end{document}
+\section{From Version~0 to Version~1}\label{sec:news}
+The \chemnum\ package has been my first attempt to create a comprehensive
+labeling package for chemical compounds. However, it had and has more than
+one weakness and its code was -- to be frank -- a mess. Version~1 is now a
+complete re-write of \chemnum\ where I tried to achieve several points:
+\begin{itemize}
+ \item A cleaner code internally.
+ \item A cleaner user interface, \ie, more user macros for different tasks, a
+ unified naming of the commands and a less redundant naming of the
+ options.
+ \item Extended functionality such as sorting and compressing of sublabel
+ lists and sorting and merging of main label lists.
+\end{itemize}
+Although the syntax seems more or less the same at first sight quite a number
+of changes have been made that make version~1 incompatible with version~0.
+While I thought a while about maintaining backwards compatibility version~0
+was known to be in an experimental stage where everything was allowed to be
+changed at any time. So users \emph{could} know there was a risk. I have a
+feeling that many users nevertheless didn't realize this and may be bothered
+by this incompatibility. So I am well aware that the update will
+inconvenience some users. However, since version~0 won't be updated any more
+it made more sense to make a breaking update once.
+The same is not true for version~1. The syntax and commands described in this
+manual will not be changed as easily and from this version on I will take care
+of backwards compatibility.
+
+For those people wanting to keep older versions: they are are still available
+from websites such as \website{ctanhg.scharrer-online.de} or
+\securewebsite{bitbucket.org/cgnieder/chemnum}. You can also email me for an
+older version.
+
+Many commands have got a new name! The most important ones are:
+\begin{itemize}
+ \item \cs*{cmpdref}; this is now called \cs{replacecmpd}.
+ \item \cs*{cmpdinit}; this is now called \cs{initcmpd}.
+ \item \cs*{cmpdreset}; this is now called \cs{resetcmpd}.
+ \item \cs*{cmpdsetup}; this is now called \cs{setchemnum}.
+\end{itemize}
+However, there are many more changes. Basically all options have new names
+and often do their thing slightly different from the way things have been
+before.
+
+Please note that this overall change does not mean that version~1 is version~0
+declared stable. It is very likely that version~1 will now have quite a
+number of bugs to be fixed and probably missing features, too. So I'd be very
+glad to receive feedback either on \chemnum's homepage
+\securewebsite{github.com/cgnieder/chemnum} or via email to
+\email{contact@mychemistry.eu}.
+
+\end{document}
diff --git a/macros/latex/contrib/download/Makefile b/macros/latex/contrib/download/Makefile
index 229e714e72..b6c5e88d6d 100644
--- a/macros/latex/contrib/download/Makefile
+++ b/macros/latex/contrib/download/Makefile
@@ -1,23 +1,36 @@
+ZIP_NOATTRS :=
+ifeq ($(shell uname -s),Darwin)
+ ZIP_NOATTRS += -X
+endif
+
+TAR_NOATTRS :=
+ifeq ($(shell uname -s),Darwin)
+ TAR_NOATTRS += --disable-copyfile
+endif
+
TEXMFHOME ?= $(shell kpsewhich -var-value TEXMFHOME)
-.PHONY: all clean distclean install dist
-all: download.pdf
-clean:
+.PHONY: all clean distclean install dist test clean-test
+all: download.tex download.pdf download.sty README
+clean: clean-test
rm -f *.gl? *.id? *.aux # problematic files
rm -f *.bbl *.bcf *.bib *.blg *.xdy # biblatex
rm -f *.fls *.log *.out *.run.xml *.toc # junk
distclean: clean
- rm -f *.cls *.sty *.clo *.tar.gz *.tds.zip
+ rm -f *.cls *.sty *.clo *.tar.gz *.tds.zip README
git reset --hard
%.pdf: %.tex %.sty
makeglossaries $*
biber $*
- pdflatex -shell-escape $<
+ pdflatex -interaction=nonstopmode -halt-on-error -shell-escape $<
makeglossaries $*
- pdflatex -shell-escape $<
+ pdflatex -interaction=nonstopmode -halt-on-error -shell-escape $<
%.sty: %.tex
- pdflatex $<
+ pdflatex -interaction=nonstopmode -halt-on-error $<
+
+README: README.md
+ sed -e '1,4d;$$d' $< > $@
install: all
install -m 0644 download.sty $(TEXMFHOME)/tex/latex/download/download.sty
@@ -26,22 +39,30 @@ install: all
install -m 0644 README $(TEXMFHOME)/doc/latex/download/README
-mktexlsr
-download.tds.zip: download.tex download.pdf download.sty
- mkdir -p download/{tex,doc,source}/latex/download
+download.tds.zip: all
+ mkdir -p download/tex/latex/download
cp download.sty download/tex/latex/download/download.sty
+ mkdir -p download/doc/latex/download
cp download.pdf download/doc/latex/download/download.pdf
+ mkdir -p download/source/latex/download
cp download.tex download/source/latex/download/download.tex
cp README download/doc/latex/download/README
- cd download && zip -r ../download.tds.zip *
+ cd download && zip $(ZIP_NOATTRS) -r ../download.tds.zip *
rm -rf download
-download.tar.gz: download.tds.zip download.tex download.pdf
+download.tar.gz: all download.tds.zip
mkdir -p download
cp download.tex download/download.tex
cp download.pdf download/download.pdf
cp README download/README
cp Makefile download/Makefile
- tar -czf $@ download download.tds.zip
+ tar $(TAR_NOATTRS) -czf $@ download download.tds.zip
rm -rf download
dist: download.tar.gz
+
+test:
+ $(MAKE) -C tests
+
+clean-test:
+ $(MAKE) -C tests clean
diff --git a/macros/latex/contrib/download/README b/macros/latex/contrib/download/README
index af17fbfc62..653a7be348 100644
--- a/macros/latex/contrib/download/README
+++ b/macros/latex/contrib/download/README
@@ -1,7 +1,7 @@
%% download - download files with LaTeX
%%
-%% Copyright (C) 2012-2013 by Simon Sigurdhsson <sigurdhsson@gmail.com>
-%%
+%% Copyright (C) 2012-2019 by Simon Sigurdhsson <sigurdhsson@gmail.com>
+%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
@@ -9,15 +9,15 @@
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
-%%
+%%
%% This work has the LPPL maintenance status `maintained'.
-%%
+%%
%% The Current Maintainer of this work is Simon Sigurdhsson.
-%%
+%%
%% This work consists of the file download.tex
%% and the derived file download.sty.
-This is version 1.0 of the download package, a package which allows
+This is version 1.2 of the download package, a package which allows
LaTeX to download files using wget or cURL.
The following files are enclosed.
diff --git a/macros/latex/contrib/download/download.pdf b/macros/latex/contrib/download/download.pdf
index f31c6c4191..ef98a165ae 100644
--- a/macros/latex/contrib/download/download.pdf
+++ b/macros/latex/contrib/download/download.pdf
Binary files differ
diff --git a/macros/latex/contrib/download/download.tex b/macros/latex/contrib/download/download.tex
index 07559c8467..5ffa7d0ca7 100644
--- a/macros/latex/contrib/download/download.tex
+++ b/macros/latex/contrib/download/download.tex
@@ -1,7 +1,7 @@
%% download - download files with LaTeX
%%
-%% Copyright (C) 2012-2013 by Simon Sigurdhsson <sigurdhsson@gmail.com>
-%%
+%% Copyright (C) 2012-2019 by Simon Sigurdhsson <sigurdhsson@gmail.com>
+%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
@@ -9,11 +9,11 @@
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
-%%
+%%
%% This work has the LPPL maintenance status `maintained'.
-%%
+%%
%% The Current Maintainer of this work is Simon Sigurdhsson.
-%%
+%%
%% This work consists of the file download.tex
%% and the derived file download.sty.
\documentclass{skdoc}
@@ -41,9 +41,12 @@
\begin{document}
% Change & version info
- \version{1.1}
+ \version{1.2}
\changes{1.0}{Initial version}
\changes{1.1}{Added aria2 and axel engines}
+ \changes{1.2}{Protect a bunch of macros and conditionals. Track \pkg{expl3} changes (thanks to Phelype Oleinik)}
+ % Don't forget to update the version number and release date of
+ % the package declaration in the implementation!
% Metadata
\package[ctan=download,vcs=https://github.com/urdh/download]{download}
@@ -65,7 +68,7 @@
access \Notice{do not indiscriminately run \hologo{pdfLaTeX} with
the \texttt{--shell-escape} flag; using this package it would be
possible to download malicious \texttt{.tex} that may abuse the
- \cs{write18} access to harm your system}.
+ \cs{write18} access to harm your system}.
\section{Usage}
The package is very simple to use, but requires a *nix platform with
@@ -88,12 +91,12 @@
engine (wget supports \texttt{http(s)} and \texttt{ftp}, cURL
supports a few more, aria2 supports torrent downloads and axel
supports downloading from multiple mirrors at once\footnote{See the
- manpage of the respective command for more information.}; for most
+ manpage of the respective command for more information.}; for most
cases wget should be enough). The
optional argument \meta{filename} makes the underlying engine save
the file with the specified filename \Notice{this also enables file
existence checking; without it, the engine will attempt to
- download the file even if it exists --- wget and aria2 see the
+ download the file even if it exists --- wget and aria2 see the
existing file and do nothing, and axel probably replaces any existing
file but cURL will download a new copy with a numeral suffix}.
@@ -111,11 +114,11 @@
\begin{MacroCode}{package}
\RequirePackage{expl3,l3keys2e,pdftexcmds,xparse}
\end{MacroCode}
-
+
Then, we declare ourselves to provide the \thepkg\ \LaTeX3 package.
\begin{MacroCode}{package}
\ProvidesExplPackage{download}
- {2013/04/08}{1.1}{download files with LaTeX}
+ {2019/10/01}{1.2}{download files with LaTeX}
\end{MacroCode}
\subsection{Messages}
@@ -130,7 +133,7 @@
\msg_new:nnnn{download}{no-engine}{Could~not~find~any~engine!}
{Please~make~sure~one~of~the~engines~is~installed~and~in~your~PATH.}
\end{MacroCode}
-
+
We also have a message being displayed when \cs{download} is being
used without its optional argument. This is a warning, since it may
imply that cURL is creating a lot of unwanted files.
@@ -138,7 +141,7 @@
\msg_new:nnnn{download}{no-name}{Using~\string\download\space~with~no~filename!}
{This~means~I~will~download~the~file~even~if~it~already~exists.}
\end{MacroCode}
-
+
The last two messages are diagnostics written to the log when
\opt{engine} is set to \texttt{auto}.
\begin{MacroCode}{package}
@@ -154,8 +157,9 @@
can define a new conditional that decides if we have unrestricted
\cs{write18}.
\begin{macro}{\__download_if_shellescape:F}
+ \changes{1.2}{This conditional is now protected}
\begin{MacroCode}{package}
-\prg_new_conditional:Nnn\__download_if_shellescape:{F}{
+\prg_new_protected_conditional:Nnn\__download_if_shellescape:{F}{
\if_cs_exist:N\pdf@shellescape
\end{MacroCode}
If the command sequence exists (it really should), we test to see
@@ -163,7 +167,7 @@
if no \cs{write18} access is available, two if we have restricted
access and one if access is unrestricted.
\begin{MacroCode}{package}
- \if_int_compare:w\pdf@shellescape=\c_one
+ \if_int_compare:w\pdf@shellescape=\c_one_int
\prg_return_true:
\else:
\prg_return_false:
@@ -187,8 +191,9 @@
an old file may break the check.
\begin{macro}{\__download_rm:n}[1]
{The file to be removed}
+ \changes{1.2}{This macro is now protected}
\begin{MacroCode}{package}
-\cs_new:Npn\__download_rm:n#1{
+\cs_new_protected:Npn\__download_rm:n#1{
\immediate\write18{rm~#1}
}
\end{MacroCode}
@@ -234,8 +239,9 @@
{Filename to save file to, or \cs{NoValue}}
{URL to fetch the file from}
\changes{1.1}{cURL now follows redirects}
+ \changes{1.2}{This macro is now protected}
\begin{MacroCode}{package}
-\cs_new:Npn\__download_curl_do:nn#1#2{
+\cs_new_protected:Npn\__download_curl_do:nn#1#2{
\IfNoValueTF{#1}{
\end{MacroCode}
When no optional argument is given, we just invoke cURL with the
@@ -257,8 +263,9 @@
\begin{macro}{\__download_wget_do:nn}[2]
{Filename to save file to, or \cs{NoValue}}
{URL to fetch the file from}
+ \changes{1.2}{This macro is now protected}
\begin{MacroCode}{package}
-\cs_new:Npn\__download_wget_do:nn#1#2{
+\cs_new_protected:Npn\__download_wget_do:nn#1#2{
\IfNoValueTF{#1}{
\end{MacroCode}
With wget, we pass the \texttt{-q} (quiet) flag as well as the
@@ -280,8 +287,9 @@
\begin{macro}{\__download_ariaII_do:nn}[2]
{Filename to save file to, or \cs{NoValue}}
{URL to fetch the file from}
+ \changes{1.2}{This macro is now protected}
\begin{MacroCode}{package}
-\cs_new:Npn\__download_ariaII_do:nn#1#2{
+\cs_new_protected:Npn\__download_ariaII_do:nn#1#2{
\IfNoValueTF{#1}{
\end{MacroCode}
With aria2, we pass the \texttt{-q} (quiet) flag as well as the
@@ -303,8 +311,9 @@
\begin{macro}{\__download_axel_do:nn}[2]
{Filename to save file to, or \cs{NoValue}}
{URL to fetch the file from}
+ \changes{1.2}{This macro is now protected}
\begin{MacroCode}{package}
-\cs_new:Npn\__download_axel_do:nn#1#2{
+\cs_new_protected:Npn\__download_axel_do:nn#1#2{
\IfNoValueTF{#1}{
\end{MacroCode}
With axel, we pass the \texttt{-q} (quiet) flag.
@@ -330,8 +339,9 @@
\begin{macro*}{\__download_if_auto_test:TF}
\begin{macro}{\__download_if_auto_test:F}
\changes{1.1}{Added aria2c and axel engines to stack}
+ \changes{1.2}{This conditional is now protected}
\begin{MacroCode}{package}
-\prg_new_conditional:Nnn\__download_if_auto_test:{F,TF}{
+\prg_new_protected_conditional:Nnn\__download_if_auto_test:{F,TF}{
\__download_if_executable_test:nTF{wget}{
\prg_return_true:
}{
@@ -355,13 +365,14 @@
\end{macro*}
We also define an automatic equivalent of the engine \texttt{_do}
- macros, which selects the engines in the order wget, cURL, aria2
+ macros, which selects the engines in the order wget, cURL, aria2
and axel.
\begin{macro}{\__download_auto_do:nn}[2]
{Filename to save file to, or \cs{NoValue}}
{URL to fetch the file from}
+ \changes{1.2}{This macro is now protected}
\begin{MacroCode}{package}
-\cs_new:Npn\__download_auto_do:nn#1#2{
+\cs_new_protected:Npn\__download_auto_do:nn#1#2{
\__download_if_executable_test:nTF{wget}{
\msg_info:nn{download}{use-wget}
\__download_wget_do:nn{#1}{#2}
@@ -468,7 +479,7 @@
}
\end{MacroCode}
\end{macro}
-
+
And we're done.
\begin{MacroCode}{package}
\endinput
diff --git a/macros/latex/contrib/l3build/CHANGELOG.md b/macros/latex/contrib/l3build/CHANGELOG.md
index 330e7b73ef..ec89a3f58a 100644
--- a/macros/latex/contrib/l3build/CHANGELOG.md
+++ b/macros/latex/contrib/l3build/CHANGELOG.md
@@ -7,6 +7,16 @@ this project uses date-based 'snapshot' version identifiers.
## [Unreleased]
+## [2019-10-02]
+
+### Added
+
+- `docinit_hook()`
+
+### Changed
+
+- Normalise out file paths in all cases
+
## [2019-09-30]
### Added
@@ -360,7 +370,8 @@ this project uses date-based 'snapshot' version identifiers.
- Rationalise short option names: removed `-d`, `-E`, `-r`
- Target `cmdcheck`: specific to LaTeX3 kernel work
-[Unreleased]: https://github.com/latex3/l3build/compare/2019-09-30...HEAD
+[Unreleased]: https://github.com/latex3/l3build/compare/2019-10-02...HEAD
+[2019-10-02]: https://github.com/latex3/l3build/compare/2019-09-30...2019-10-02
[2019-09-30]: https://github.com/latex3/l3build/compare/2019-09-29...2019-09-30
[2019-09-29]: https://github.com/latex3/l3build/compare/2019-09-28...2019-09-29
[2019-09-28]: https://github.com/latex3/l3build/compare/2019-09-25...2019-09-28
diff --git a/macros/latex/contrib/l3build/README.md b/macros/latex/contrib/l3build/README.md
index 66cc0e28ec..04fb613e32 100644
--- a/macros/latex/contrib/l3build/README.md
+++ b/macros/latex/contrib/l3build/README.md
@@ -1,7 +1,7 @@
l3build: a testing and building system for LaTeX3
=================================================
-Release 2019-09-30
+Release 2019-10-02
Overview
--------
diff --git a/macros/latex/contrib/l3build/l3build-check.lua b/macros/latex/contrib/l3build/l3build-check.lua
index aad0328103..e2cdd655bf 100644
--- a/macros/latex/contrib/l3build/l3build-check.lua
+++ b/macros/latex/contrib/l3build/l3build-check.lua
@@ -137,22 +137,20 @@ local function normalize_log(content,engine,errlevels)
lastline = ""
-- Zap ./ at begin of filename
line = gsub(line, "%(%.%/", "(")
- -- Zap paths if places other than 'here' are accessible
- if checksearch then
- -- The pattern excludes < and > as the image part can have
- -- several entries on one line
- local pattern = "%w?:?/[^ %<%>]*/([^/%(%)]*%.%w*)"
- -- Files loaded from TeX: all start ( -- )
- line = gsub(line, "%(" .. pattern, "(../%1")
- -- Images
- line = gsub(line, "<" .. pattern .. ">", "<../%1>")
- -- luaotfload files start with keywords
- line = gsub(line, "from " .. pattern .. "%(", "from. ./%1(")
- line = gsub(line, ": " .. pattern .. "%)", ": ../%1)")
- -- Deal with XeTeX specials
- if match(line, "^%.+\\XeTeX.?.?.?file") then
- line = gsub(line, pattern, "../%1")
- end
+ -- Zap paths
+ -- The pattern excludes < and > as the image part can have
+ -- several entries on one line
+ local pattern = "%w?:?/[^ %<%>]*/([^/%(%)]*%.%w*)"
+ -- Files loaded from TeX: all start ( -- )
+ line = gsub(line, "%(" .. pattern, "(../%1")
+ -- Images
+ line = gsub(line, "<" .. pattern .. ">", "<../%1>")
+ -- luaotfload files start with keywords
+ line = gsub(line, "from " .. pattern .. "%(", "from. ./%1(")
+ line = gsub(line, ": " .. pattern .. "%)", ": ../%1)")
+ -- Deal with XeTeX specials
+ if match(line, "^%.+\\XeTeX.?.?.?file") then
+ line = gsub(line, pattern, "../%1")
end
-- Deal with dates
if match(line, "[^<]%d%d%d%d[/%-]%d%d[/%-]%d%d") then
diff --git a/macros/latex/contrib/l3build/l3build-typesetting.lua b/macros/latex/contrib/l3build/l3build-typesetting.lua
index 7f588a7c23..fe6a6a58dc 100644
--- a/macros/latex/contrib/l3build/l3build-typesetting.lua
+++ b/macros/latex/contrib/l3build/l3build-typesetting.lua
@@ -174,9 +174,7 @@ typeset_demo_tasks = typeset_demo_tasks or function()
return 0
end
--- Typeset all required documents
--- Uses a set of dedicated auxiliaries that need to be available to others
-function doc(files)
+local function docinit()
-- Set up
cleandir(typesetdir)
for _,filetype in pairs(
@@ -199,6 +197,16 @@ function doc(files)
if errorlevel ~= 0 then
return errorlevel
end
+ return docinit_hook()
+end
+
+docinit_hook = docinit_hook or function() return 0 end
+
+-- Typeset all required documents
+-- Uses a set of dedicated auxiliaries that need to be available to others
+function doc(files)
+ local errorlevel = docinit()
+ if errorlevel ~= 0 then return errorlevel end
local done = {}
for _,typesetfiles in ipairs({typesetdemofiles,typesetfiles}) do
for _,glob in pairs(typesetfiles) do
diff --git a/macros/latex/contrib/l3build/l3build.1 b/macros/latex/contrib/l3build/l3build.1
index 3317114e5b..91374cd0fa 100644
--- a/macros/latex/contrib/l3build/l3build.1
+++ b/macros/latex/contrib/l3build/l3build.1
@@ -1,4 +1,4 @@
-.TH l3build 1 "2019-09-30"
+.TH l3build 1 "2019-10-02"
.SH NAME
l3build \- Checking and building packages
.SH SYNOPSIS
diff --git a/macros/latex/contrib/l3build/l3build.dtx b/macros/latex/contrib/l3build/l3build.dtx
index 5c1f0db5ed..e48fd8b195 100644
--- a/macros/latex/contrib/l3build/l3build.dtx
+++ b/macros/latex/contrib/l3build/l3build.dtx
@@ -231,7 +231,7 @@
% }^^A
% }
%
-% \date{Released 2019-09-30}
+% \date{Released 2019-10-02}
%
% \maketitle
% \tableofcontents
@@ -1382,6 +1382,11 @@
% \label{fig:PDF}
% \end{figure}
%
+% \subsection{Pre-typesetting hook}
+%
+% To allow complex set up for typesetting, a hook |docinit_hook()| is available
+% to be executed once all standard set up is complete but before any typesetting
+% is run.
%
% \subsection{Automated upload to CTAN}
% \label{sec:upload}
diff --git a/macros/latex/contrib/l3build/l3build.lua b/macros/latex/contrib/l3build/l3build.lua
index 7f0f9dced9..d9f4fe23f8 100755
--- a/macros/latex/contrib/l3build/l3build.lua
+++ b/macros/latex/contrib/l3build/l3build.lua
@@ -25,7 +25,7 @@ for those people who are interested.
--]]
-- Version information
-release_date = "2019-09-30"
+release_date = "2019-10-02"
-- File operations are aided by the LuaFileSystem module
local lfs = require("lfs")
diff --git a/macros/latex/contrib/l3build/l3build.pdf b/macros/latex/contrib/l3build/l3build.pdf
index 41594c4ebb..8a7d3fc1de 100644
--- a/macros/latex/contrib/l3build/l3build.pdf
+++ b/macros/latex/contrib/l3build/l3build.pdf
Binary files differ
diff --git a/macros/latex/contrib/ocgx2/ChangeLog b/macros/latex/contrib/ocgx2/ChangeLog
index 5957ad4c5c..947383cc65 100644
--- a/macros/latex/contrib/ocgx2/ChangeLog
+++ b/macros/latex/contrib/ocgx2/ChangeLog
@@ -1,3 +1,7 @@
+2019-10-01
+ * v0.46: ocgx2.sty
+ * fix: 2020 deprecations (fixocgx.sty)
+
2019-09-19
* v0.45: ocgx2.sty
* new: using comma for separating OCG ids in \showocg, \hideocg etc.; <space>
diff --git a/macros/latex/contrib/ocgx2/fixocgx.sty b/macros/latex/contrib/ocgx2/fixocgx.sty
index 256a71b2e0..9a61f188f7 100644
--- a/macros/latex/contrib/ocgx2/fixocgx.sty
+++ b/macros/latex/contrib/ocgx2/fixocgx.sty
@@ -7,7 +7,7 @@
\ExplSyntaxOn
-\msg_interrupt:nnn{Package~`fixocgx':}{
+\msg_new:nnnn{fixocgx}{obsolete}{
This~package~is~obsolete~and~replaced~by~package~`ocgx2'.\\\\
Remove\\\\
\space\space\string\usepackage{ocgx}\\
@@ -19,4 +19,6 @@
Read~the~manual~(`texdoc~ocgx2')~for~further~information.
}
+\msg_error:nn{fixocgx}{obsolete}
+
\ExplSyntaxOff
diff --git a/macros/latex/contrib/ocgx2/ocgx2.sty b/macros/latex/contrib/ocgx2/ocgx2.sty
index 235fe5f90e..564c032e98 100644
--- a/macros/latex/contrib/ocgx2/ocgx2.sty
+++ b/macros/latex/contrib/ocgx2/ocgx2.sty
@@ -48,8 +48,8 @@
\RequirePackage{xparse}
\RequirePackage{l3keys2e}
-\def\g@ocgxii@date@tl{2019/09/19}
-\def\g@ocgxii@version@tl{0.45}
+\def\g@ocgxii@date@tl{2019/10/01}
+\def\g@ocgxii@version@tl{0.46}
\ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl}
{ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
diff --git a/macros/latex/contrib/scontents/README.md b/macros/latex/contrib/scontents/README.md
index c5ea150461..cc40a94214 100644
--- a/macros/latex/contrib/scontents/README.md
+++ b/macros/latex/contrib/scontents/README.md
@@ -1,6 +1,6 @@
## scontents — Stores LaTeX contents in memory or files
-- Version: 1.3
-- Date: 2019/09/24
+- Version: 1.4
+- Date: 2019/10/03
- Author: Pablo González
## Description
@@ -21,6 +21,11 @@ The package `scontents` is present in `TeXLive` and `MiKTeX`, use the
package manager to install. For a manual installation, put `scontents.dtx`
in your working directory and run `tex scontents.dtx`.
+## 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.
+
## License
The scontents package may be modified and distributed under the terms and
conditions of the [LaTeX Project Public License](https://www.latex-project.org/lppl/), version 1.3c or greater.
diff --git a/macros/latex/contrib/scontents/scontents.dtx b/macros/latex/contrib/scontents/scontents.dtx
index 1aa64dcc3d..fd0504e7a2 100644
--- a/macros/latex/contrib/scontents/scontents.dtx
+++ b/macros/latex/contrib/scontents/scontents.dtx
@@ -1,4 +1,24 @@
% \iffalse meta-comment
+%
+% Copyright (C) 2019 by Pablo González L <pablgonz@educarchile.cl>
+%
+% This work may be distributed and/or modified under the conditions of the
+% LaTeX Project Public License, either version 1.3c of this license or (at
+% your option) any later version. The latest version of this license is in
+%
+% http://www.latex-project.org/lppl.txt
+%
+% and version 1.3c or later is part of all distributions of LaTeX version
+% 2005/12/01 or later.
+%
+% This work is "maintained" (as per the LPPL maintenance status)
+% by Pablo González Luengo.
+%
+% This work consists of the file scontents.dtx
+% and the derived files scontents.ins,
+% scontents.pdf and
+% scontents.sty.
+%
%<*internal>
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
@@ -9,7 +29,28 @@
\input l3docstrip.tex
\keepsilent
\askforoverwritefalse
-\nopreamble\nopostamble
+\preamble
+
+Copyright (C) 2019 by Pablo González L <pablgonz@educarchile.cl>
+
+This work may be distributed and/or modified under the conditions of the
+LaTeX Project Public License, either version 1.3c of this license or (at
+your option) any later version. The latest version of this license is in
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3c or later is part of all distributions of LaTeX version
+2005/12/01 or later.
+
+This work is "maintained" (as per the LPPL maintenance status)
+by Pablo González Luengo.
+
+This work consists of the file scontents.dtx
+and the derived files scontents.ins,
+ scontents.pdf and
+ scontents.sty.
+
+\endpreamble
\usedir{tex/latex/scontents}
\generate{%
\file{\jobname.sty}{\from{\jobname.dtx}{package}}%
@@ -36,7 +77,7 @@
\makeatother
% 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[top=0.5in,bottom=0.5in,left=2.0in,right=1in,footskip=0.2in,headsep=10pt]{geometry}
+\usepackage[top=0.5in,bottom=0.5in,left=2in,right=0.7in,footskip=0.2in,headsep=10pt]{geometry}
\usepackage[osf,mono=false,scale=0.95,llscaled=0.95]{libertine}
\usepackage{unicode-math}
\setmathfont[Scale = 0.95]{latinmodern-math.otf}
@@ -58,6 +99,7 @@
\usepackage{hyperxmp,lastpage,imakeidx,microtype,attachfile2}
\usepackage{adjustbox,multicol,listings,accsupp,titletoc}
\usepackage{scontents} % main
+\usepackage[osf,scale=0.80,semibold]{sourcecodepro}
\usepackage[contents]{colordoc}
% Patching colordoc.sty to work with l3doc.cls
@@ -129,15 +171,15 @@
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 = tt,
+ type .initial:n = rm,
cf .tl_set:N = \l_userdoc_meta_color_tl,
- cf .initial:n = black,
+ cf .initial:n = optcolor,
ac .tl_set:N = \l_userdoc_meta_anglecolor_tl,
- ac .initial:n = black,
+ ac .initial:n = lightgray,
sbc .tl_set:N = \l_userdoc_meta_brackcolor_tl,
- sbc .initial:n = black,
+ sbc .initial:n = gray,
cbc .tl_set:N = \l_userdoc_meta_bracecolor_tl,
- cbc .initial:n = black,
+ cbc .initial:n = gray,
}
% Internal commands
\cs_new_protected:Npn \userdoc_meta_generic:Nnn #1 #2 #3
@@ -197,30 +239,30 @@
\begin{lrbox}{\boxexaenv}%
\begin{minipage}[t]{\marginparwidth}%
\raggedright\ttfamily\small
- \textcolor{gray}{\textbackslash begin\{\textcolor{mypkgcolor}{\bfseries{#1}}\}\myoarg
- [type=tt,sbc=gray,ac=NavyBlue,cf=optcolor]{key=val}}\par%
- \hspace{0.5cm}\mymeta[ac=gray,cf=gray]{env ~ contents}\par%
- \textcolor{gray}{\textbackslash end\{{\textcolor{mypkgcolor}{\bfseries{#1}}}\}}\par
+ \textcolor{gray}{\textbackslash begin\{\textcolor{mypkgcolor}{{#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
\end{minipage}%
\end{lrbox}%
\usebox{\boxexaenv}
}
% \cmdexamp{s m o m o}
-\DeclareDocumentCommand{\cmdexamp}{s m o m o}
+\DeclareDocumentCommand{\cmdexamp}{o m o m o}
{
\group_begin:
\small\ttfamily
\textcolor{mypkgcolor}{\textbackslash#2}
- \IfBooleanTF{#1}{ \textcolor{red}{*} }{ \hphantom{*} }
- \IfValueT{#3}{ \myoarg[type=tt,sbc=gray,ac=NavyBlue,cf=optcolor]{#3} }
+ \IfValueT{#1}{ \textcolor{red}{#1} }
+ \IfValueT{#3}{ \myoarg[type=tt,sbc=gray,ac=lightgray,cf=optcolor]{#3} }
\IfValueTF{#5}
{
- \mymeta[ac=OrangeRed,type=tt,cf=MediumOrchid]{#5}%
- \mymeta[type=tt,cbc=OrangeRed,ac=NavyBlue,cf=MediumOrchid]{#4}
- \mymeta[ac=OrangeRed,type=tt,cf=MediumOrchid]{#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=OrangeRed,ac=NavyBlue,cf=MediumOrchid]{#4} }
+ { \mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{#4} }
\par
\group_end:
\MYSortIndex{Commands}{Commands ~ provide ~ by ~ \textcolor{gray}{scontents}>\texttt{\textbackslash#2}}%
@@ -229,41 +271,43 @@
% \keyexamp{mmm}
\DeclareDocumentCommand{\keyexamp}{ m m m }
{
- \par
- \adjustbox{outer=-\marginparsep}{\textcolor{black}{\small\ttfamily{#1}}}
- \textcolor{gray}{\,\bfseries\texttt{=}}\,{}
- \mymarg[type=tt,cbc=OrangeRed,ac=NavyBlue,cf=MediumOrchid]{\small{#2}}
- \hfill\textcolor{gray}{\small\textsf{(default: ~ \texttt{#3})}}
- \par
- \MYSortIndex{Keys}{Keys>\texttt{#1}}%
+ \par
+ \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})}
+ \par
+ \MYSortIndex{Keys}{Keys>\texttt{#1}}%
}
% \mypkg{sm}
\NewDocumentCommand{\mypkg}{sm}
{
- \IfBooleanTF{#1}
- {
- \normalsize{\sffamily\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}
- \MYSortIndex{packages}{Packages>\texttt{#2}}
- }
- {
- \textcolor{gray}{\textsf{#2}}
- \MYSortIndex{packages}{Packages>\texttt{#2}}%
- }
+ \group_begin:
+ \IfBooleanTF{#1}
+ {
+ \textsf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}
+ \MYSortIndex{packages}{Packages>\texttt{#2}}
+ }
+ {
+ \textcolor{darkgray}{\textsf{#2}}
+ \MYSortIndex{packages}{Packages>\texttt{#2}}%
+ }
+ \group_end:
}
% \myenv{sm}
\DeclareDocumentCommand{\myenv}{sm}
{
- \IfBooleanTF{#1}
- {
- \textcolor{mypkgcolor}{\ttfamily{#2}}%
- \MYSortIndex{environment}{Environment ~ provide ~ by ~ \textcolor{gray}{scontents}:>\texttt{#2}}
- }
- {
- \textcolor{gray}{\ttfamily{#2}}%
- \MYSortIndex{environment}{Environments>\texttt{#2}}
- }
+ \IfBooleanTF{#1}
+ {
+ \textcolor{mypkgcolor}{\ttfamily{#2}}%
+ \MYSortIndex{environment}{Environment ~ provide ~ by ~ \textcolor{gray}{scontents}:>\texttt{#2}}
+ }
+ {
+ \textcolor{darkgray}{\ttfamily{#2}}%
+ \MYSortIndex{environment}{Environments>\texttt{#2}}
+ }
}
% \ics{sm}
@@ -271,11 +315,13 @@
{
\IfBooleanTF{#1}
{
- \textcolor{mypkgcolor}{\ttfamily\textbackslash{#2}}
+ \tl_set:Nn \l_tmpa_tl { #2 }
+ \regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{red\cE\}\cB\{\1\cE\} } \l_tmpa_tl
+ \textcolor{mypkgcolor}{\ttfamily\textbackslash{\tl_use:N \l_tmpa_tl}}
\MYSortIndex{Commands}{Commands ~ provide ~ by ~ \textcolor{gray}{scontents}>\texttt{\textbackslash#2}}
}
{
- \textcolor{gray}{\ttfamily\textbackslash{#2}}
+ \textcolor{darkgray}{\ttfamily\textbackslash{#2}}
\MYSortIndex{#2}{\texttt{\textbackslash#2}}
}
}
@@ -302,6 +348,23 @@
}
\makeatother
+% Custom vertamimsc
+\makeatletter
+\let\verbatimsc\@undefined
+\let\endverbatimsc\@undefined
+\makeatother
+\usepackage{listings}
+\lstnewenvironment{verbatimsc}
+ {
+ \lstset{
+ language=,%
+ basicstyle= \ttfamily,
+ columns = fullflexible,
+ gobble = 2,%
+ }
+ }{}
+\makeatother
+
% Don't copy numbers in code example
\newcommand*{\noaccsupp}[1]{\BeginAccSupp{ActualText={}}#1\EndAccSupp{}}
@@ -311,46 +374,53 @@
escapechar=`,%
showstringspaces=false,%
extendedchars=true, %
- stringstyle = {\color{red}},%
+ stringstyle= {\color{red}},%
basicstyle=\ttfamily\small,%
+ alsoletter=-,%
% comments
morecomment=[l]{\%},%
commentstyle=\lmmitalic\small\itshape\color{lightgray},%
% Important words 1
- keywordstyle=[1]{\bfseries\color{NavyBlue}},%
- keywords=[1]{begin,end,documentclass},%
+ keywordstyle=[1]{\color{gray}},%
+ keywords=[1]{begin,end},%
% Other words 2
keywordstyle=[2]{\color{blue!75}},%
- keywords=[2]{usepackage,section},%
+ keywords=[2]{usepackage,section,documentclass},%
% Other words 3
keywordstyle=[3]{\color{optcolor!85}},%
keywords=[3]{document,article},%
-% Reserved words 4(inputfile options)
- keywordstyle=[4]{\bfseries\color{mypkgcolor}},%
- keywords=[4]{scontents,Scontents,getstored,typestored,verbatimsc,endverbatimsc,countsc},%
+% Reserved words 4 (scontents pkg)
+ keywordstyle=[4]{\color{mypkgcolor}},%
+ keywords=[4]{scontents,Scontents,getstored,typestored,verbatimsc,%
+ endverbatimsc,countsc,meaningsc},%
+% Reserved in red
+ keywordstyle=[5]{\color{red}},%
+ keywords=[5]{makeatletter,makeatother,let},%
% Reserved in orange
- keywordstyle=[5]{\color{OrangeRed}},%
- keywords=[5]{makeatletter,makeatother,foreach,DefineVerbatimEnvironment,lstnewenvironment,newminted},%
+ keywordstyle=[6]{\color{optcolor}},%
+ keywords=[6]{verb,myverb,store-cmd,store-env,print-env,write-env,%
+ write-out,width-tab,force-eol,inner,outer,I,J,M,L,Ascheol},%
% Reserved in orange
- keywordstyle=[6]{\color{red}},%
- keywords=[6]{verb,myverb,store-cmd,store-env},%
+ keywordstyle=[7]{\color{OrangeRed}},%
+ keywords=[7]{foreach,DefineVerbatimEnvironment,lstnewenvironment,newminted},%
% literateee
- literate=*{\{}{{\bfseries\textcolor{gray}{\{}}}{1}
- {\}}{{\bfseries\textcolor{gray}{\}}}}{1}
- {[}{{\bfseries\textcolor{optcolor}{[}}}{1}
- {]}{{\bfseries\textcolor{optcolor}{]}}}{1}
+ literate=*{\{}{{\textcolor{gray}{\{}}}{1}
+ {\}}{{\textcolor{gray}{\}}}}{1}
+ {[}{{\textcolor{gray}{[}}}{1}
+ {]}{{\textcolor{gray}{]}}}{1}
{,}{{\textcolor{gray}{,}}}{1}
- {\$}{{\textcolor{blue}{\$}}}{1}
- {*}{{\bfseries\textcolor{red}{*}}}{1}
+ {>}{{\textcolor{OrangeRed}{\guillemotright}}}{1}
+ {*}{{\textcolor{red}{*}}}{1}
{@}{{\textcolor{red}{@}}}{1}
- {=}{{\textcolor{red}{=}}}{1},%
+ {\^}{{\textcolor{optcolor}{\textasciicircum}}}{1}
+ {=}{{\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}},%
+ stringstyle= {\color{red}},%
basicstyle=\ttfamily\small,%
numbersep=1em,%
numberstyle=\tiny\color{lightgray}\noaccsupp,%
@@ -367,16 +437,16 @@
\lstdefinestyle{inline}
{
language=scontents-doc,%
- numbersep=1em,%
- numberstyle=\tiny\color{lightgray}\noaccsupp,%
- basicstyle=\ttfamily\small\color{gray},%
escapechar=`,%
upquote=true,%
+ numbersep=1em,%
+ numberstyle=\tiny\color{lightgray}\noaccsupp,%
literate=*{\%}{{\bfseries\textcolor{gray}{\%}}}{1}
}
% Set default \lstinline style
\lstset{style=inline}
+\lstMakeShortInline[language=scontents-doc,basicstyle=\ttfamily]§
% Get file info
\GetFileInfo{\jobname.sty}
@@ -467,12 +537,15 @@
% \date{}
% \maketitle
%
+% \begin{scontents}[store-env=abstract,print-env=true]
% \begin{abstract}
-% The \mypkg*{scontents} package stores valid \hologo{LaTeX} code in memory
-% (sequences) using the \mypkg{l3seq} module of \mypkg{expl3}. The stored
-% content, including \emph{verbatim} material, can be used as many times
-% as desired in the document, additionally can be written to external files.
+% 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}.
% \end{abstract}
+% \end{scontents}
%
% \tableofcontents
%
@@ -480,8 +553,8 @@
%
% \section{Motivation and Acknowledgments}
%
-% In \hologo{LaTeX} there is no direct way to record content for later use, although
-% you can do this using \verb|\macros|, recording \meta{verbatim content} is a
+% In \hologo{(La)TeX} there is no direct way to record content for later use, although
+% you can do this using "\macros", recording \mymeta{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
@@ -517,9 +590,11 @@
% (\url{http://www.latex-project.org/lppl.txt}). The software has the status
% \enquote{maintained}.
%
+% \medskip
+%
% The \mypkg*{scontents} package loads \mypkg{expl3}, \mypkg{xparse} and
-% \mypkg{l3keys2e}. This package can be used with |xelatex|, |lualatex|
-% , |pdflatex| and the classical workflow |latex|-|dvips|-|ps2pdf|.
+% \mypkg{l3keys2e}. This package can be used with "xelatex", "lualatex"
+% , "pdflatex" and the classical workflow §latex>dvips>ps2pdf§.
%
% \thispagestyle{plain}
%
@@ -530,16 +605,19 @@
% \section{The \texttt{scontents} package}
% \label{sec:pkgscontents}
%
-% \subsection{Description}
+% \subsection{Description of the package and load}
%
-% The \mypkg*{scontents} package allows to store contents in memory (sequence)
-% or external files, provides a user interface style \myoarg{key = val}
-% along with the ability to store contents in sequences for later use in
-% different parts of the document. In some ways it works very much like
-% the \mypkg{filecontentsdef} package, with the difference that it preserves
-% the |TAB|s characters in the output files (see \ref{sec:tabcharacter}).
+% \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}.
+% \end{scontents}
%
-% The package is loaded in the usual way:
+% The package uses a \myoarg{key \textnormal{\textcolor{gray}{=}} val}
+% system for the options and is loaded in the usual way:
%
% \iffalse
%<*example>
@@ -550,12 +628,13 @@
% \iffalse
%</example>
% \fi
+% \vspace*{-5pt}
% or
% \iffalse
%<*example>
% \fi
\begin{examplecode}[frame=single]
-\usepackage`\myoarg[type=tt,cbc=OrangeRed,ac=NavyBlue,cf=optcolor]{key=val}`{scontents}
+\usepackage`\small\myoarg{key \textnormal{\textcolor{gray}{=}} val}`{scontents}
\end{examplecode}
% \iffalse
%</example>
@@ -564,62 +643,89 @@
% \subsection{The TAB character}
% \label{sec:tabcharacter}
%
-% In a standard \hologo{LaTeX} document, horizontal |TAB|s (\LKeyTab) typed
-% from the keyboard are treated as explicit spaces in most contexts. Some
-% users use this character to indented the source code of the document and
-% depending on the text editor used, some will use real |TAB|s (sometimes
-% called \enquote{hard tabs}), others with \enquote{soft tabs}
-% (\textvisiblespace\textvisiblespace or \textvisiblespace
-% \textvisiblespace\textvisiblespace\textvisiblespace) or both.
+% 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.
%
-% At first glance it may seem the same, but the way in which |TAB|s (\enquote{hard tabs})
+% 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
-% a file, both in reading\footnote{Check the answer given by Ulrich Diez
+% a file, both in \mymeta{reading}\footnote{Check the answer given by Ulrich Diez
% in \href{https://tex.stackexchange.com/a/508103/7832}{Keyboard TAB
-% character in argument v (xparse)}.} and writing\footnote{Check the answer
+% character in argument v (xparse)}.} and \mymeta{writing}\footnote{Check the answer
% given by Enrico Gregorio in \href{https://tex.stackexchange.com/a/58740/7832}{How to output a
-% tabulation into a file}.}, are different and may have adverse consequences.
+% tabulation into a file}.} are different and may have adverse consequences.
%
-% The behavior of this character for the \emph{stored} content can be
-% configured with the |widht-tab| key, but, these will be preserved by
-% writing an output file, unfortunately, dependent on the \hologo{TeX}
-% distribution you have and how the formats were initialized.
+% In a standard \hologo{LaTeX} document, the character "TAB" \enquote{\LKeyTab}
+% are treated as explicit spaces (in most contexts) and is the behavior when
+% \mymeta{stored contents}, but when \mymeta{writing files} these are preserved.
%
-% With a \hologo{TeX}Live distribution, the formats for |latex|, |pdflatex|
-% and |lualatex| are prepared feeding the option |-translate-file=cp227.tcx|,
-% that makes the |TAB| character \enquote{printable}. To write a literal
-% |TAB| character using |xelatex| you must add the |-8bit| option on command
-% line, otherwise you will get \hologo{TeX}-|TAB|s (|^^I|) in the \mymeta{output file}.
+% With a \hologo{TeX}Live distribution, the "TAB" character is \enquote{printable}
+% for "latex", "pdflatex" and "lualatex", but if you use "xelatex" you
+% must add the \texttt{\textcolor{optcolor}{-8bit}} option on the command
+% line, otherwise you will get \hologo{TeX}-"TAB" (§^^I§) in the \mymeta{output file}.
%
-% As a general recommendation \enquote{Do not use |TAB|s unless strictly
-% necessary}, for example within a verbatim environment that supports
-% this character such as |Verbatim| or |lstlisting| or when you want to
-% generate a |MakeFile| file.
+% As a general recommendation \enquote{Do not use "TAB" character unless strictly
+% necessary}, for example within a \emph{verbatim} environment that supports
+% this character such as §Verbatim§ of the package \mypkg{fancyvrb} or §lstlisting§
+% of the package \mypkg{listings} or when you want to generate a §MakeFile§ file.
%
% \subsection{Configuration of the options}
% \label{sec:confopt}
%
% Most of the options can be passed directly to the package or using the
-% command the command \ics*{setupsc}.
+% command \ics*{setupsc}. All boolean keys can be passed using the
+% equal sign \enquote{\textnormal{\textcolor{optcolor}{=}}} 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}.
%
% \vspace*{-10pt}
%
% \begin{function}{\setupsc}
% \begin{syntax}
-% \cmdexamp{setupsc}{key=val}
+% \cmdexamp{setupsc}{keyval list}
% \end{syntax}
%
-% The command \ics*{setupsc} configures the options in a global way,
+% The command \ics*{setupsc} sets the \mymeta{keys} in a global way,
% it can be used both in the preamble and in the body of the document
% as many times as desired.
% \end{function}
%
+% \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
+% 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
+% only available as a package option or using \ics*{setupsc}.
+%
% \medskip
%
-% \keyexamp{verb-font}{number}{ \textbackslash{}ttfamily }
-% Sets the font type used to display the stored content for the commands
-% \ics*{typestored} and \ics*{meaningsc}. This key is only available as
-% a package option or using \ics*{setupsc}.
+% \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
+% 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{...}%§. 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"
+% used when displaying stored content in \emph{verbatim style}. The value
+% must be a \mymeta{positive integer}. This key is available for the \ics*{typestored}
+% and the \ics*{meaningsc} commands.
%
% \subsection{Options Overview}
% \label{sec:optover}
@@ -627,18 +733,21 @@
% \newcommand*{\xmark}{\textcolor{red}{✘}}%
% \newcommand*{\cmark}{\textcolor{green}{✔}}%
%
-% Summary table 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 & \cmark & \xmark & \xmark & \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 \\
@@ -646,14 +755,15 @@
% \texttt{verb-font} & \cmark & \cmark & \xmark & \xmark & \xmark & \xmark & \xmark \\
% \bottomrule
% \end{tabular}
+% \end{center}
%
% \section{User interface}
% \label{sec:interface}
%
-% The \emph{user interface} provided by this package consists in \myenv*{scontents}
-% environment, \ics*{Scontents} and \ics*{Scontents*} commands to stored
-% contents and \ics*{getstored} command to get the \meta{stored content}
-% along with other utilities described in this documentation.
+% The user interface consists in \myenv*{scontents} environment, \ics*{Scontents}
+% and \ics*{Scontents*} commands to \mymeta{stored content} and \ics*{getstored}
+% command to get the \mymeta{stored content} along with other utilities described
+% in this documentation.
%
% \subsection{The environment \env{scontents}}
% \label{sec:scontents}
@@ -665,91 +775,92 @@
% \envexamp{scontents}
% \end{syntax}
%
-% The \myenv*{scontents} environment allows you to save the content to memory
-% or external files in a similar way to the package \mypkg{filecontentsdef}.
-% This allows you to record content, including \emph{verbatim}, for later reuse.
+% The \myenv*{scontents} environment allows you to \mymeta{store} and \mymeta{write}
+% content, including \emph{verbatim} material. After the package has been loaded,
+% the environment can be used both in the preamble and in the body of the document.
%
-% Some considerations to keep in mind, |\begin{scontents}| and |\end{scontents}|
-% must be on different lines, the \myoarg{key=val} options must be passed on
-% \mymeta{one line} right after starting the environment and |TAB|s characters
-% are preserved when writing an \mymeta{external file}.
+% For the correct operation §\begin{scontents}§ and §\end{scontents}§ must be in
+% different lines, all \mymeta{keys} must be passed in a \mymeta{single line} separated
+% by commas \enquote{without vertical spaces} and \enquote{without separation} of
+% the start of the environment.
% \end{function}
%
-% The environment can be nested complying with the above considerations
-% and bearing in mind that within it should not be written literally, as a
-% comment or within verbatim environments |\begin{scontents}| and |\end{scontents}|.
-% For example:
+% Comments \enquote{\textcolor{gray}{\%}} or \enquote{any character} after
+% §\begin{scontents}§ or \myoarg{keyval list} on the same line are not
+% supported, the package will return an \enquote{error} message if this happens.
+% In a similar way comments \enquote{\textcolor{gray}{\%}} or \enquote{any character} after
+% §\end{scontents}§ on the same line the package will return a \enquote{warning} message.
+%
+% The environment can be \mymeta{nested} if it is properly balanced and
+% does not appear \enquote{literally} in commented lines or in some \emph{verbatim}
+% environment or command. As an example:
%
% \iffalse
%<*example>
% \fi
\begin{examplecode}[frame=single]
\begin{scontents}[store-env=outer]
-This text is in the outermost environment.
+This text is in the outer environment (before nested).
\begin{scontents}[store-env=inner]
-This text is found in the most inner environment.
+This text is found in the inner environment (inside of nested).
\end{scontents}
-This text is in the outermost environment.
+This text is in the outer environment (after nested).
\end{scontents}
\end{examplecode}
% \iffalse
%</example>
% \fi
%
+% 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.
+%
+% 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.
+%
% \subsection*{Options for environment}
%
% The environment options can be configured globally using option
-% in package or the \ics*{setupsc} command and locally
-% using \myoarg{key=val} in the environment.
-%
-% \medskip
+% 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.
%
% \keyexamp{store-env}{seq name}{contents}
-% The name of the \mymeta{sequence} in which the content recorded by the
-% environment was stored.
-%
-% \medskip
-%
-% \keyexamp{print-env}{true\textbar false}{false}
-% It will show the current content of the environment.
+% Sets the name of the \mymeta{sequence} in which the contents will be
+% stored. If the sequence does not exist, it will be created globally.
%
% \medskip
%
-% \keyexamp{force-eol}{true\textbar false}{false}
-% This key is only necessary if the last line inside the environment is
-% |\end{Verbatim}| or the |\end{...}| of some environment created with
-% the package \mypkg{fancyvrb}. This adds an extra line to the \ics*{typestored}
-% output.
+% \keyexamp{print-env}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false}
+% Sets if the \mymeta{stored content} is displayed or not at the time of
+% running the environment. The content is extracted from the \mymeta{sequence}
+% in which it is stored.
%
-% \medskip
+% \newpage
%
% \keyexamp{write-env}{file.ext}{not used}
-% In addition to storing the content of the environment will write this
-% in an external \mymeta{file.ext}, if \mymeta{file.ext} exists it will
-% be overwritten. The \mymeta{file.ext} will be created in the working
-% directory, relative or absolute paths are not supported, the way the
-% external \mymeta{file.ext} is recorded is similar to that produced by
-% \myenv{filecontents*} environment. If the content within the environment
-% has literal |TAB|s they will be recorded in \mymeta{file.ext}.
-%
-% To write a literal |TAB| character using |xelatex| you must add the |-8bit|
-% option on command line, otherwise you will get \hologo{TeX}-|TAB|s (|^^I|) in
-% the \mymeta{output file}.
+% Sets the name of the \mymeta{external file} in which the \mymeta{contents} of
+% the environment will be written. The \mymeta{file.ext} will be created
+% in the working directory, if \mymeta{file.ext} exists it will be overwritten,
+% relative or absolute paths are not supported.
+% The characters "TAB"s will be written in \mymeta{file.ext} and the \mymeta{contents}
+% will be stored in the sequence established at that time. \hologo{XeLaTeX} users
+% using the "TAB" character must add \texttt{\textcolor{optcolor}{-8bit}}
+% at the command line, otherwise you will get \hologo{TeX}-"TAB" (§^^I§)
+% in \mymeta{file.ext}.
%
% \medskip
%
% \keyexamp{write-out}{file.ext}{not used}
-% It will write the contents in an external \mymeta{file.ext}, but, it
-% will not store the contents of this one. The \mymeta{file.ext} will be
-% created in the working directory, relative or absolute paths are not
-% supported. The way the external \mymeta{file.ext} is recorded is similar
-% to that produced by \myenv{filecontents*} environment. If the content
-% within the environment has literal |TAB|s they will be recorded in
-% \mymeta{file.ext}.
-%
-% To write a literal |TAB| character using |xelatex| you must add the |-8bit|
-% option on command line, otherwise you will get \hologo{TeX}-|TAB|s (|^^I|) in
-% the \mymeta{output file}.
+% Sets the name of the \mymeta{external file} in which the \mymeta{contents} of
+% the environment will be written. The \mymeta{file.ext} will be created
+% in the working directory, if \mymeta{file.ext} exists it will be overwritten,
+% relative or absolute paths are not supported.
+% The characters "TAB"s will be written in \mymeta{file.ext}, the rest of the
+% \mymeta{keys} will not be available and the \mymeta{contents} will NOT
+% be stored in any sequence. \hologo{XeLaTeX} users using the "TAB" character
+% 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{Scontents}}
% \label{sec:Scontents}
@@ -758,27 +869,29 @@ This text is in the outermost environment.
%
% \begin{function}{\Scontents}
% \begin{syntax}
-% \cmdexamp{Scontents}[key=val]{argument}
-% \cmdexamp*{Scontents}[key=val]{argument}
-% \cmdexamp*{Scontents}[key=val]{argument}[del]
+% \cmdexamp{Scontents}[key \textnormal{\textcolor{gray}{=}} val]{argument}
+% \cmdexamp[*]{Scontents}[key \textnormal{\textcolor{gray}{=}} val]{argument}
+% \cmdexamp[*]{Scontents}[key \textnormal{\textcolor{gray}{=}} val]{argument}[del]
% \end{syntax}
% \end{function}
%
-% The \ics*{Scontents} command reads the \mymeta{argument} in standard
-% mode. It is not possible to pass environments such as \meta{verbatim},
+% The \ics*{Scontents} command reads the \mymarg{argument} in standard
+% mode. It is not possible to pass environments such as \emph{verbatim},
% but it is possible to use the implementation of \ics{Verb} provided by
% the \mypkg{fvextra} package for contents on one line and \ics{lstinline}
% from \mypkg{listings} package, but it is preferable to use the starred
% version.
%
-% The \ics*{Scontents*} command reads the \mymeta{argument} under verbatim
+% The \ics*{Scontents*} command reads the \mymarg{argument} under \emph{verbatim}
% category code regimen. If its first delimiter is a brace, it will be
-% assumed that the \mymeta{argument} is nested into braces. Otherwise it
-% will be assumed that the ending of that argument is delimited by that
-% first delimiter-like the argument of \ics{verb}. Blank lines are preserved,
-% escaped |\{| and |\}| must also be balanced if the argument is used
-% with braces and |TAB|s characters typed from the keyboard are converted
-% into spaces.
+% assumed that the \mymarg{argument} is nested into braces. Otherwise it
+% will be assumed that the ending of that \mymeta{argument} is delimited by that
+% first delimiter \mymeta[cf=MediumOrchid]{del} like command \ics{verb}.
+%
+% Blank lines are preserved, escaped braces \enquote{\texttt{\textcolor{gray}{\textbackslash\hspace{-1pt}\{}}} and
+% \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.
%
% Both versions can be used anywhere in the document and cannot be used
% as an \mymeta{argument} for other command.
@@ -786,27 +899,20 @@ This text is in the outermost environment.
% \subsection*{Options for command}
% \label{sec:optcmdsc}
%
-% The command options (including starred version) can be configured globally
-% using option in package or the \ics*{setupsc} command and locally
-% using \myoarg{key=val}.
-% \medskip
+% 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.
%
% \keyexamp{store-cmd}{seq name}{contents}
-% The name of the sequence in which the content recorded by \ics*{Scontents}
-% was stored.
+% Sets the name of the \mymeta{sequence} in which the contents will be stored.
+% If the sequence does not exist, it will be created globally.
%
% \medskip
%
-% \keyexamp{print-cmd}{true\textbar{}false}{false}
-% It will show the current content of \ics*{Scontents}.
-%
-% \medskip
-%
-% \keyexamp{force-eol}{true\textbar{}false}{false}
-% This key is only necessary if the last line inside the command is
-% |\end{Verbatim}| or the |\end{...}| of some environment created with
-% the package \mypkg{fancyvrb}. This adds an extra line to the \ics*{typestored}
-% output.
+% \keyexamp{print-cmd}{true \textnormal{\textcolor{lightgray}{\textbar}} false}{false}
+% Sets if the \mymeta{stored content} is displayed or not at the time of
+% running the command. The content is extracted from the \mymeta{sequence}
+% in which it is stored.
%
% \subsection{The command \cs{getstored}}
% \label{sec:getstored}
@@ -819,11 +925,11 @@ This text is in the outermost environment.
% \end{syntax}
% \end{function}
%
-% The command \ics*{getstored} gets the content stored in \meta{seq name}
+% The command \ics*{getstored} gets the content stored in \mymeta{seq name}
% according to the \mymeta{index} in which it was stored. The command is
-% robust and can be used as an \meta{argument} for another command. If the
-% optional argument is not passed it defaults to the last element saved
-% in the \meta{seq name}.
+% 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 \mymeta{seq name}.
%
% \subsection{The command \cs{typestored}}
% \label{sec:typestored}
@@ -832,22 +938,24 @@ This text is in the outermost environment.
%
% \begin{function}{\typestored}
% \begin{syntax}
-% \cmdexamp{typestored}[index, width-tab=number]{seq name}
+% \cmdexamp{typestored}[index\textnormal{\textcolor{gray}{,}} width-tab \textnormal{\textcolor{gray}{=}} number]{seq name}
% \end{syntax}
-% \end{function}
-%
% The command \ics*{typestored} internally places the content stored in
-% the \meta{seq name} into the \myenv*{verbatimsc} environment. The \mymeta{index}
+% the \mymeta{seq name} into the \myenv*{verbatimsc} environment. The \mymeta{index}
% number corresponds to the position in which the content is stored in
-% the \meta{seq name}.
+% the \mymeta{seq name}.
+% \end{function}
%
-% If the optional argument is not passed it defaults to the last element
-% saved in the \meta{seq name}.
-% \medskip
+% If the optional argument is not passed it defaults to the first element
+% stored in the \mymeta{seq name}. The key §width-tab§ is available for
+% this command.
%
-% \keyexamp{width-tab}{number}{ 1 }
-% Establishes the equivalence in \mymeta{spaces} for the character |TAB|
-% typed from the keyboard. The value must be a \mymeta{positive integer}.
+% The \mypkg{verbatim} package is not compatible with the implementation
+% of the \myenv*{verbatimsc} environment used by this command, if you are
+% a user of that package consider customizing the \myenv*{verbatimsc}
+% environment.
+%
+% \newpage
%
% \subsection{The environment \env{verbatimsc}}
% \label{sec:verbatimsc}
@@ -855,13 +963,16 @@ This text is in the outermost environment.
% \vspace*{-10pt}
%
% \begin{function}{verbatimsc}
-% Internal environment used by \cs{typestored} to display \meta{verbatim style}
+% Internal environment used by \ics*{typestored} to display \mymeta{verbatim style}
% contents.
% \end{function}
%
% One consideration to keep in mind is that this is a \emph{representation}
-% of the content in a \meta{verbatim} environment and not a real \meta{verbatim}
-% environment. The \myenv*{verbatimsc} environment can be customized in the
+% of the \mymeta{stored content} in a \emph{verbatim} environment and not
+% a real \emph{verbatim} environment.
+%
+%
+% The \myenv*{verbatimsc} environment can be customized in the
% following ways:
%
% Using the package \mypkg{fancyvrb}:
@@ -929,19 +1040,16 @@ This text is in the outermost environment.
%
% \begin{function}{\meaningsc}
% \begin{syntax}
-% \cmdexamp{meaningsc}[index, width-tab=number]{seq name}
+% \cmdexamp{meaningsc}[index\textnormal{\textcolor{gray}{,}} width-tab \textnormal{\textcolor{gray}{=}} number]{seq name}
% \end{syntax}
% The command \ics*{meaningsc} executes \ics{meaning} on the content stored
-% in \meta{seq name}. The \mymeta{index} number corresponds to the position
-% in which the content is stored in the \meta{seq name}. If the optional
-% argument is not passed it defaults to the last element saved in the \meta{seq name}.
+% in \mymeta{seq name}. The \mymeta{index} number corresponds to the position
+% in which the content is stored in the \mymeta{seq name}.
% \end{function}
%
-% \medskip
-%
-% \keyexamp{width-tab}{number}{ 1 }
-% Establishes the equivalence in \mymeta{spaces} for the character |TAB|
-% typed from the keyboard. The value must be a \mymeta{positive integer}.
+% If the optional argument is not passed it defaults to the first element
+% stored in the \mymeta{seq name}. The key §width-tab§ is available for
+% this command.
%
% \subsection{The command \cs{countsc}}
% \label{sec:countsc}
@@ -952,23 +1060,89 @@ This text is in the outermost environment.
% \begin{syntax}
% \cmdexamp{countsc}{seq name}
% \end{syntax}
-% The command \ics*{countsc} count a number of contents stored in \meta{seq name}.
+% The command \ics*{countsc} count a number of contents stored in \mymeta{seq name}.
% \end{function}
%
-% \subsection{The command \cs{cleansc}}
+% \subsection{The command \cs{cleanseqsc}}
% \label{sec:cleansc}
%
% \vspace*{-10pt}
%
% \begin{function}{\cleanseqsc}
% \begin{syntax}
-% \cmdexamp{cleansc}{seq name}
+% \cmdexamp{cleanseqsc}{seq name}
% \end{syntax}
-% The command \ics*{cleansc} remove all contents stored in \meta{seq name}.
+% The command \ics*{cleanseqsc} remove all contents stored in \mymeta{seq name}.
% \end{function}
%
% \newpage
%
+% \pdfstringdefDisableCommands{%
+% \RenewExpandableDocumentCommand{\mypkg}{sm}{#2}%
+% }
+% \section{The \mypkg*{scontents} package in action}
+% Remember the abstract on the first page?, this is it:
+%
+% \getstored{abstract}
+%
+% And the description of the package?
+%
+% \getstored{description}
+%
+% \medskip
+%
+% I've only written:
+%
+% \typestored{abstract}
+%
+% and
+%
+% \typestored{description}
+%
+% Of course, I didn't copy and paste. The real code they were written with is:
+%
+% \iffalse
+%<*example>
+% \fi
+\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}.
+\end{abstract}
+\end{scontents}
+\end{examplecode}
+% \iffalse
+%</example>
+% \fi
+%
+% and
+%
+% \iffalse
+%<*example>
+% \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}.
+\end{scontents}
+\end{examplecode}
+% \iffalse
+%</example>
+% \fi
+%
+% I stored the content in memory and then ran §\getstored§ and
+% §\typestored§. This is one of the ways you can use \mypkg*{scontents}.
+%
+% \newpage
+%
% \section{Examples}
%
% These are some (adapted) examples that have served as inspiration for
@@ -988,7 +1162,6 @@ This text is in the outermost environment.
\newtheorem{ex}{Exercise}
\begin{document}
\section{Problems}
-
\begin{ex}
First exercise
\Scontents{
@@ -1004,7 +1177,6 @@ Second exercise
\end{ex}
\section{Solutions}
-
\foreach \i in {1,...,\countsc{solutions}} {
\noindent\textbf{\i} \getstored[\i]{solutions}\par
}
@@ -1031,27 +1203,27 @@ Second exercise
\usepackage{pgffor}
\pagestyle{empty}
\begin{document}
-
+% not starred
\Scontents{
Prove that \[x^n+y^n=z^n\] is not solvable in positive integers if $n$ is at
most $-3$.\par
}
-
-\Scontents*{Refute the existence of black holes in less than $140$ characters.}
-
-\begin{scontents}[write-env=\jobname-3.txt]
+% starred
+\Scontents*|Refute the existence of black holes in less than $140$ characters.|
+% write environment to \jobname.txt
+\begin{scontents}[write-env=\jobname.txt]
\def\NSA{NSA}%
Prove that factorization is easily done via probabilistic algorithms and
advance evidence from knowledge of the names of its employees in the
seventies that the \NSA\ has known that for 40 years.\par
\end{scontents}
-
+% see all stored
\foreach \i in {1,...,3} {
\begin{itemize}
\item \getstored[\i]{defexercise}
\end{itemize}}
-
-\section{\getstored[2]{defexercise}} % \getstored are robust :)
+% \getstored are robust :)
+\section{\getstored[2]{defexercise}}
\end{document}
\end{scontents}
% \iffalse
@@ -1131,8 +1303,7 @@ Something with no label
\textbf{Let's print them}
-This is a: \getstored[1]{a}
-
+This is a: \getstored[1]{a}\par
This is b: \getstored[2]{a}
\textbf{Print all of them}
@@ -1226,21 +1397,17 @@ Prove new \Verb*{ fancyvrb whit braces } and environment \verb+Verbatim*+
\end{scontents}
\section{Test \texttt{\textbackslash Scontents} whit \texttt{fancyvrb}}
-
\Scontents{ We have coded this in \LaTeX: $E=mc^2$.}
\section{Test \texttt{\textbackslash getstored}}
-
\getstored[1]{contents}\par
\getstored[2]{contents}
\section{Test \texttt{\textbackslash meaningsc}}
-
\meaningsc[1]{contents}\par
\meaningsc[2]{contents}
\section{Test \texttt{\textbackslash typestored}}
-
\typestored[1]{contents}
\typestored[2]{contents}
\end{document}
@@ -1249,7 +1416,8 @@ Prove new \Verb*{ fancyvrb whit braces } and environment \verb+Verbatim*+
%</example>
% \fi
%
-% Customization of \myenv*{verbatimsc} using the \mypkg{fancyvrb} and \mypkg{tcolorbox} package
+% 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}
%
@@ -1283,7 +1451,6 @@ Prove new \Verb*{ fancyvrb whit braces } and environment \verb+Verbatim*+
\setlength{\parindent}{0pt}
\pagestyle{empty}
\begin{document}
-
\section{Test \texttt{\textbackslash begin\{scontents\}} whit \texttt{listings}}
Test \verb+{scontents}+ \par
@@ -1302,12 +1469,10 @@ Prove \lstinline[basicstyle=\ttfamily]| lstinline | and environment \verb+Verbat
and more.+
\section{Test \texttt{\textbackslash getstored}}
-
\getstored[2]{contents}\par
\getstored[1]{contents}
\section{Test \texttt{\textbackslash typestored}}
-
\typestored[1]{contents}
\typestored[2]{contents}
\end{document}
@@ -1326,7 +1491,8 @@ and more.+
%<*example>
% \fi
\begin{scontents}[write-out=scexamp8.ltx]
-\documentclass{article} % need --shell-escape
+% need --shell-escape
+\documentclass{article}
\usepackage{scontents}
\makeatletter
\let\verbatimsc\@undefined
@@ -1381,13 +1547,21 @@ No tab
% development, from the first public implementation using the \mypkg{filecontentsdef}
% package to the current version with only \mypkg{expl3}.
%
-% \setlist[itemize,1]{label=\textendash, wide=0.5em, nosep, noitemsep, leftmargin=10pt}
+% \setlist[itemize,1]{label=\textendash,wide=0.5em,nosep,noitemsep,leftmargin=10pt}
% \newlength\descrwidth
% \settowidth{\descrwidth}{\textsf{v1.0, (ctan), 2019/07/30} }
%
-% \begin{description}[font=\small\sffamily, wide=0pt, style=multiline, leftmargin=\descrwidth, nosep, noitemsep]
+% \begin{description}[font=\small\sffamily,wide=0pt,style=multiline,leftmargin=\descrwidth,nosep,noitemsep]
% \item [\fileversion{} (ctan), \filedate]
% \begin{itemize}
+% \item Add |store-all| key.
+% \item Messages and keys were separated.
+% \item Restructuring of documentation.
+% \item Now the version of |expl3| is checked instead of |xparse|.
+% \item The internal behavior of \verb+force-eol+ has been modified.
+% \end{itemize}
+% \item [v1.3 (ctan), 2019/09/24]
+% \begin{itemize}
% \item The environment can now nest.
% \item Added \verb+force-eol+, \verb+verb-font+ and \verb+width-tab+ keys.
% \item The extra space has been removed when you run \verb+\getstored+.
@@ -1419,7 +1593,7 @@ No tab
% \newpage
%
% \StopEventually{^^A
-% \newgeometry{top=0.5in,bottom=0.5in,left=1.0in,right=1in,footskip=0.2in,headsep=10pt}
+% \newgeometry{top=0.5in,bottom=0.5in,left=1.0in,right=0.5in,footskip=0.2in,headsep=10pt}
% \addtocontents{toc}{\protect\setcounter{tocdepth}{2}}
% \cleardoublepage
% \phantomsection
@@ -1444,22 +1618,20 @@ No tab
% Then, we can give the traditional declaration of a package written with
% \pkg{expl3} and the necessary packages for its operation.
%
-%%^^A Initial declaration of the package
% \begin{macrocode}
\RequirePackage{l3keys2e}
\RequirePackage{xparse}[2019/05/28]
-\ProvidesExplPackage{scontents}{2019/09/24}{1.3}
+\ProvidesExplPackage{scontents}{2019/10/03}{1.4}
{Stores LaTeX contents in memory or files}
% \end{macrocode}
%
-% A check to make sure that \pkg{xparse} is not too old
+% A check to make sure that \pkg{expl3} is not too old
%
-%%^^A Checking the version of xparse
% \begin{macrocode}
-\@ifpackagelater { xparse } { 2019/05/03 }
+\@ifpackagelater { expl3 } { 2019/09/19 }
{ }
{
- \PackageError { scontents } { Support~package~xparse~too~old }
+ \PackageError { scontents } { Support~package~expl3~too~old }
{
You~need~to~update~your~installation~of~the~bundles~
'l3kernel'~and~'l3packages'.\MessageBreak
@@ -1471,10 +1643,9 @@ No tab
%
% \subsection{Definition of common keys}
%
-% We create some common keys that will be used by the options passed to
+% We create some common \mymeta{keys} that will be used by the options passed to
% the package as well as by the environments and commands defined.
%
-%%^^A Common keys available as package options
% \begin{macrocode}
\keys_define:nn { scontents }
{
@@ -1501,13 +1672,15 @@ No tab
width-tab .value_required:n = true,
print-all .meta:n = { print-env = #1 , print-cmd = #1 },
print-all .default:n = true,
- unknown .code:n = { \@@_parse_unknown_key:n {#1} }
+ store-all .meta:n = { store-env = #1 , store-cmd = #1 },
+ store-all .value_required:n = true
}
% \end{macrocode}
%
-% We process the keys as options passed on to the package.
+% We process the \mymeta{keys} as options passed on to the package, the
+% package \pkg{l3keys2e} will verify the \mymeta{keys} and will return
+% an error when they are \emph{unknown}.
%
-%%^^A Process options for package
% \begin{macrocode}
\ProcessKeysOptions { scontents }
% \end{macrocode}
@@ -1524,7 +1697,6 @@ No tab
% of an environment as it's being read, and \cs{l_@@_temp_tl} and
% \cs{g_@@_temp_tl} are generic temporary token lists.
%
-%%^^A Internal token list vars
% \begin{macrocode}
\tl_new:N \l_@@_macro_tmp_tl
\tl_new:N \l_@@_fname_out_tl
@@ -1539,7 +1711,6 @@ No tab
% requested to \cs{typestored} or \cs{meaningsc}. \cs{l_@@_env_nesting_int}
% stores the current nesting level of the \env{scontents} environment.
%
-%%^^A Internal int vars
% \begin{macrocode}
\int_new:N \l_@@_seq_item_int
\int_new:N \l_@@_env_nesting_int
@@ -1550,9 +1721,8 @@ No tab
% \begin{macro}{\l_@@_writing_bool,\l_@@_storing_bool}
% The boolean \cs{l_@@_writing_bool} keeps track of whether we should write
% to a file, and \cs{l_@@_storing_bool} determines whether it is in write-only
-% mode when the |write-out| option is used.
+% mode when the §write-out§ option is used.
%
-%%^^A Internal bool vars
% \begin{macrocode}
\bool_new:N \l_@@_writing_bool
\bool_set_false:N \l_@@_writing_bool
@@ -1565,7 +1735,6 @@ No tab
% A token list to match when ending \env{verbatimsc} and \env{scontents}
% environments.
%
-%%^^A A token list to match \env{verbatimsc} and \env{scontents}
% \begin{macrocode}
\tl_new:N \g_@@_end_verbatimsc_tl
\tl_gset_rescan:Nnn
@@ -1581,11 +1750,22 @@ No tab
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\c_@@_hidden_space_str}
+% \cs{c_@@_hidden_space_str} is a constant \emph{string} to used to hide
+% the \mymeta{forced space} added by \hologo{TeX} when recording content
+% in a macro. This \emph{string} contains the \emph{reserved phrase}
+% ``§%§§^^Ascheol%§'' which is added to the end of the argument stored
+% in |seq| when the key §force-eol§ is false.
+%
+% \begin{macrocode}
+\str_const:Nx \c_@@_hidden_space_str
+ { \c_percent_str \c_circumflex_str \c_circumflex_str A scheol \c_percent_str }
+% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\q_@@_stop,\q_@@_mark}
% Some quarks used along the code as macro delimiters.
%
-%%^^A Internal quarks
% \begin{macrocode}
\quark_new:N \q_@@_stop
\quark_new:N \q_@@_mark
@@ -1595,7 +1775,6 @@ No tab
% \begin{macro}{\l_@@_file_iow}
% An output stream for saving the contents of an environment to a file.
%
-%%^^A Stream for saving the contents
% \begin{macrocode}
\iow_new:N \l_@@_file_iow
% \end{macrocode}
@@ -1608,7 +1787,6 @@ No tab
% will not work. Here we create a private copy of \cs{tex_scantokens:D}
% which will serve our purposes.
%
-%%^^A Copy of scantokens in expl3
% \begin{macrocode}
\cs_new_protected:Npn \@@_rescan_tokens:n #1 { \tex_scantokens:D {#1} }
\cs_generate_variant:Nn \@@_rescan_tokens:n { V, x }
@@ -1616,20 +1794,18 @@ No tab
% \end{macro}
%
% \begin{macro}{\@@_tab:,\@@_par:}
-% Control sequences to replace tab (|^^I|) and form feed (|^^L|) characters.
+% Control sequences to replace tab (§^^I§) and form feed (§^^L§) characters.
%
-%%^^A Internal \tab and \par
% \begin{macrocode}
\cs_new:Npx \@@_tab: { \c_space_tl }
\cs_new:Npn \@@_par: { ^^J ^^J }
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\tl_remove_once:NV,\tl_replace_all:Nxx,
+% \begin{macro}[int]{\tl_remove_once:NV,\tl_replace_all:Nxx,
% \tl_replace_all:Nxn,\tl_replace_all:Nnx,\tl_if_empty:fTF}
% Some nonstandard variants.
%
-%%^^A Some nonstandard variants
% \begin{macrocode}
\cs_generate_variant:Nn \tl_remove_once:Nn { NV }
\cs_generate_variant:Nn \tl_replace_all:Nnn { Nx, Nxx, Nnx }
@@ -1637,13 +1813,17 @@ No tab
% \end{macrocode}
% \end{macro}
%
-% \subsection{Add keys for environment}
+% \subsection{Defining keys for the environment and commands}
+%
+% We add the \mymeta{keys} divided into subgroups to handle errors and
+% \emph{unknown} \mymeta{keys} separately.
%
-% We define a set of keys for environment \env{scontents}.
+% \subsubsection{Keys for environment \env{scontents}}
+%
+% We define a set of \mymeta{keys} for environment §scontents§.
%
-%%^^A Add keys to scontents environnment
% \begin{macrocode}
-\keys_define:nn { scontents }
+\keys_define:nn { scontents / scontents }
{
write-env .code:n = {
\bool_set_true:N \l_@@_writing_bool
@@ -1655,61 +1835,129 @@ No tab
\tl_set:Nn \l_@@_fname_out_tl {#1}
},
write-env .value_required:n = true,
- write-out .value_required:n = true
+ write-out .value_required:n = true,
+ print-env .meta:nn = { scontents } { print-env = #1 },
+ print-env .default:n = true,
+ store-env .meta:nn = { scontents } { store-env = #1 },
+ force-eol .meta:nn = { scontents } { force-eol = #1 },
+ force-eol .default:n = true,
+ unknown .code:n = { \@@_parse_environment_keys:n {#1} }
}
% \end{macrocode}
%
-% \subsection{Define keys for command}
+% \subsubsection{Keys for command \cs{Scontents}}
%
-% A sub/keys for command |\Scontents| and |\Scontents*|
+% We define a set of \mymeta{keys} for commands §\Scontents§ and
+% §\Scontents*§.
%
-%%^^A A sub/keys for command \Scontents
% \begin{macrocode}
\keys_define:nn { scontents / Scontents }
{
- print-cmd .meta:nn = { scontents } { print-cmd = #1 },
- store-cmd .meta:nn = { scontents } { store-cmd = #1 },
- force-eol .meta:nn = { scontents } { force-eol = #1 }
+ print-cmd .meta:nn = { scontents } { print-cmd = #1 },
+ print-cmd .default:n = true,
+ store-cmd .meta:nn = { scontents } { store-cmd = #1 },
+ force-eol .meta:nn = { scontents } { force-eol = #1 },
+ force-eol .default:n = true,
+ unknown .code:n = { \@@_parse_command_keys:n {#1} }
+ }
+% \end{macrocode}
+%
+% \subsubsection{Key for commands \cs{typestored} and \cs{meaningsc}}
+%
+% We define a \mymeta{key} for command §\typestored§ and §\meaningsc§.
+% Both commands accept the same type of optional arguments, just define
+% a common \mymeta{key}.
+%
+% \begin{macrocode}
+\keys_define:nn { scontents / typemeaning }
+ {
+ width-tab .meta:nn = { scontents } { width-tab = #1 },
+ unknown .code:n = { \@@_parse_type_meaning_key:n {#1} }
}
% \end{macrocode}
%
% \subsection{Handling undefined keys}
%
-% \begin{macro}{\@@_parse_unknown_key:n,\@@_parse_unknown_key:nn}
-% The commands \cs{typestored} and \cs{meaningsc} accept an optional
-% argument for setting the \texttt{width-tab} to print the stored
+% The \mymeta{keys} are stored in the token list variable \cs{l_keys_key_tl},
+% and the value (if any) is passed as an argument to each \mymeta{function}.
+%
+% \subsubsection{Undefined keys for environment \env{scontents}}
+%
+% \begin{macro}{\@@_parse_environment_keys:n,
+% \@@_parse_environment_keys:nn}
+%
+% We check the \mymeta{keys} passed to the environment
+% §scontents§ and process it with \cs{@@_parse_environment_keys:n}
+% if the \mymeta{key} is \emph{unknown} we return an error message.
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_parse_environment_keys:n #1
+ { \exp_args:NV \@@_parse_environment_keys:nn \l_keys_key_tl {#1} }
+\cs_new_protected:Npn \@@_parse_environment_keys:nn #1#2
+ {
+ \tl_if_blank:nTF {#2}
+ { \msg_error:nnn { scontents } { env-key-unknown } {#1} }
+ { \msg_error:nnnn { scontents } { env-key-value-unknown } {#1} {#2} }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Undefined keys for \cs{Scontents} and \cs{Scontents*}}
+%
+% \begin{macro}{\@@_parse_command_keys:n,
+% \@@_parse_command_keys:nn}
+%
+% We check the \meta{keys} passed to commands §\Scontents§ or
+% §\Scontents*§ and process it with \cs{@@_parse_command_keys:n}
+% if the \mymeta{key} is \emph{unknown} we return an error message.
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_parse_command_keys:n #1
+ { \exp_args:NV \@@_parse_command_keys:nn \l_keys_key_tl {#1} }
+\cs_new_protected:Npn \@@_parse_command_keys:nn #1#2
+ {
+ \tl_if_blank:nTF {#2}
+ { \msg_error:nnn { scontents } { cmd-key-unknown } {#1} }
+ { \msg_error:nnnn { scontents } { cmd-key-value-unknown } {#1} {#2} }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Undefined keys for \cs{typestored} and \cs{meaningsc}}
+%
+% \begin{macro}{\@@_parse_type_meaning_key:n,
+% \@@_parse_type_meaning_key:nn}
+%
+% The commands §\typestored§ and §\meaningsc§ accept an optional
+% argument for setting the §width-tab§ to print the stored
% contents. However their optional argument also contains the number
% of the item to retrieve from the stored sequence. To avoid the
-% awkward \verb|\typestored[][<options>]{...}| syntax, we'll make the
+% awkward §\typestored[]§\myoarg[type=tt]{options}§{...}§ syntax, we'll make the
% commands have a single optional argument which is processed by
% \pkg{l3keys}, and the unknown keys are brought here to
-% \cs{@@_parse_unknown_key:n} to process.
-%
-% The key is stored in the token list variable \cs{l_keys_key_tl}, and
-% the value (if any) is passed as argument to this function.
+% \cs{@@_parse_typemeaning_key:n} to process.
%
-% First we check if the key is an integer using \cs{int_to_roman:n}.
+% First we check if the \mymeta{key} is an integer using \cs{int_to_roman:n}.
% If it is, we check that the value passed to the key is blank
% (otherwise something odd as |1=1| might have been used). If everything
-% is correct, then set the value of the integer which holds the index.
-% Otherwise raise an error about an unknown option.
+% is correct, then set the value of the integer which holds the \mymeta{index}.
+% Otherwise raise an error about an \emph{unknown} option.
%
-%%^^A Parse unknown keys
% \begin{macrocode}
-\cs_new_protected:Npn \@@_parse_unknown_key:n #1
- { \exp_args:NV \@@_parse_unknown_key:nn \l_keys_key_tl {#1} }
-\cs_new_protected:Npn \@@_parse_unknown_key:nn #1 #2
+\cs_new_protected:Npn \@@_parse_type_meaning_key:n #1
+ { \exp_args:NV \@@_parse_type_meaning_key:nn \l_keys_key_tl {#1} }
+\cs_new_protected:Npn \@@_parse_type_meaning_key:nn #1#2
{
\tl_if_empty:fTF { \int_to_roman:n { -0 #1 } }
{
\tl_if_blank:nTF {#2}
{ \int_set:Nn \l_@@_seq_item_int {#1} }
- { \msg_error:nnnn { scontents } { key-value-unknown } {#1} {#2} }
+ { \msg_error:nnnn { scontents } { type-key-value-unknown } {#1} {#2} }
}
{
\tl_if_blank:nTF {#2}
- { \msg_error:nnn { scontents } { key-unknown } {#1} }
- { \msg_error:nnnn { scontents } { key-value-unknown } {#1} {#2} }
+ { \msg_error:nnn { scontents } { type-key-unknown } {#1} }
+ { \msg_error:nnnn { scontents } { type-key-value-unknown } {#1} {#2} }
}
}
% \end{macrocode}
@@ -1717,43 +1965,65 @@ No tab
%
% \subsection{Programming of the sequences}
%
-% \begin{macro}{\@@_append_contents:nn,\@@_getfrom_seq:nn,\@@_getfrom_seq:nnn}
% The storage of the package is done using |seq| variables. Here we
% set up the macros that will manage the variables.
-%
+% \begin{macro}{\@@_append_contents:nn}
% \cs{@@_append_contents:nn} creates a seq variable if one didn't
% exist and appends the contents in the argument to the right of the
-% sequence. \cs{@@_getfrom_seq:nn} retrieves the saved item from the
% sequence.
%
-%%^^A Programming of the sequences
% \begin{macrocode}
\cs_new_protected:Npn \@@_append_contents:nn #1#2
{
\tl_if_blank:nT {#1}
{ \msg_error:nn { scontents } { empty-store-cmd } }
- \seq_if_exist:cF { g_@@_seq_name_#1_seq }
- { \seq_new:c { g_@@_seq_name_#1_seq } }
- \seq_gput_right:cn { g_@@_seq_name_#1_seq } {#2}
+ \seq_if_exist:cF { g_@@_name_#1_seq }
+ { \seq_new:c { g_@@_name_#1_seq } }
+ \seq_gput_right:cn { g_@@_name_#1_seq } {#2}
}
\cs_generate_variant:Nn \@@_append_contents:nn { Vx }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_getfrom_seq:nn,\@@_getfrom_seq:nnn}
+% \cs{@@_getfrom_seq:nn} retrieves the saved item from the
+% sequence.
+%
+% \begin{macrocode}
\cs_new:Npn \@@_getfrom_seq:nn #1#2
{
- \seq_if_exist:cTF { g_@@_seq_name_#2_seq }
+ \seq_if_exist:cTF { g_@@_name_#2_seq }
{
\exp_args:Nf \@@_getfrom_seq:nnn
- { \seq_count:c { g_@@_seq_name_#2_seq } }
+ { \seq_count:c { g_@@_name_#2_seq } }
{#1} {#2}
}
{ \msg_expandable_error:nnn { scontents } { undefined-storage } {#2} }
}
-\cs_new:Npn \@@_getfrom_seq:nnn #1 #2 #3
+\cs_new:Npn \@@_getfrom_seq:nnn #1#2#3
{
\bool_lazy_or:nnTF
{ \int_compare_p:nNn {#2} = { 0 } }
{ \int_compare_p:nNn { \int_abs:n {#2} } > {#1} }
{ \msg_expandable_error:nnnnn { scontents } { index-out-of-range } {#2} {#3} {#1} }
- { \seq_item:cn { g_@@_seq_name_#3_seq } {#2} }
+ { \seq_item:cn { g_@@_name_#3_seq } {#2} }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_lastfrom_seq:n}
+% \cs{@@_lastfrom_seq:n} retrieves the last saved item from the
+% sequence when \cs{l_@@__print_env_bool} or \cs{l_@@__print_cmd_bool}
+% is true.
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_lastfrom_seq:n #1
+ {
+ \tl_gset:Nx \g_@@_temp_tl { \seq_item:cn { g_@@_name_#1_seq } {-1} }
+ \group_insert_after:N \@@_rescan_tokens:V
+ \group_insert_after:N \g_@@_temp_tl
+ \group_insert_after:N \tl_gclear:N
+ \group_insert_after:N \g_@@_temp_tl
}
% \end{macrocode}
% \end{macro}
@@ -1762,9 +2032,8 @@ No tab
% The \cs{@@_store_to_seq:NN} writes the recorded contents
% in |#1| to the log and stores it in |#2|.
%
-%%^^A Storing content in sequences
% \begin{macrocode}
-\cs_new_protected:Npn \@@_store_to_seq:NN #1 #2
+\cs_new_protected:Npn \@@_store_to_seq:NN #1#2
{
\tl_log:N #1
\@@_append_contents:Vx #2 { \exp_not:V #1 }
@@ -1772,17 +2041,16 @@ No tab
% \end{macrocode}
% \end{macro}
%
-% \subsection{Construction of environment scontents}
-%
-% We define the environment \env{scontents}, next to the system |key=val|.
-% The environment is divided into three parts. This implementation is taken
-% from answer by Enrico Gregorio in \url{https://tex.stackexchange.com/a/487746/7832}.
+% \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 three parts. This implementation is taken from answer
+% by Enrico Gregorio in \url{https://tex.stackexchange.com/a/487746/7832}.
%
% \begin{macro}{scontents}
% This is the main environment used in the document.
%
-%%^^A Definition of {scontents}[key=val] env
% \begin{macrocode}
\NewDocumentEnvironment { scontents } { }
{
@@ -1798,18 +2066,18 @@ No tab
%
% \subsubsection{key val for environment}
%
-% Define a |key=val| for environment \env{scontents}
+% Define a \myoarg{key \textnormal{\textcolor{gray}{=}} val} for
+% environment \env{scontents}
%
% \begin{macro}{\@@_environment_inline:w,\@@_environment_keys:w,
% \@@_environment_junk:nw,\@@_environment_junk:xw}
% The macro \cs{@@_environment_inline:w} is called from the
% \env{scontents} environment with the tokens following the
-% |\begin{scontents}|. If the immediate next token (ignoring spaces)
-% is a |[|, then we look for an optional argument delimited by a |]|.
+% §\begin{scontents}§. If the immediate next token (ignoring spaces)
+% is a §[§, then we look for an optional argument delimited by a §]§.
% All the remaining tokens are treated as junk and an error is raised
% if they are non-blank.
%
-%%^^A Test [key=val] for environment scontents
% \begin{macrocode}
\cs_new_protected:Npn \@@_environment_inline:w
{
@@ -1822,7 +2090,7 @@ No tab
}
\cs_new_protected:Npn \@@_environment_keys:w [ #1 ]
{
- \keys_set_known:nn { scontents } {#1}
+ \keys_set:nn { scontents / scontents } {#1}
\@@_environment_junk:xw
{ after~optional~argument~to~\c_backslash_str begin{scontents} }
}
@@ -1838,11 +2106,11 @@ No tab
% \subsubsection{The environment itself}
%
% \begin{macro}{\@@_start_environment:w,\@@_stop_environment:}
-% Here we make |^^I|, |^^L|, and |^^M| active characters so that the end of
-% line can be ``seen'' to be used as a delimiter, and TeX doesn't try to
+% 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. First we check if the line
-% directly after |\begin{scontents}| contains an optional argument
-% enclosed in |[...]|, or other tokens. The trailing tokens are
+% directly after §\begin{scontents}§ contains an optional argument
+% enclosed in §[...]§ or other tokens. The trailing tokens are
% treated as junk and an error is raised. The
% \cs{@@_environment_inline:w} macro checks for those cases.
%
@@ -1857,10 +2125,8 @@ No tab
%
%^^A Hm... Apparently this is not the verbatim group, but one level above. Is
%^^A this group really necessary?
-%^^A Reply : Maybe the groups aren't in the right places, but when you remove
-%^^A them it just gives you errors...(test-pkg-current.tex)
+%^^A Reply : I've checked it several times, it seems to be correct.
%
-%%^^A First start_environment/stop_environment
% \begin{macrocode}
\group_begin:
\char_set_catcode_active:N \^^I
@@ -1893,17 +2159,16 @@ No tab
% }
% This is the main macro to collect the contents of a verbatim environment.
% The macro starts a group, opens the output file, if necessary, sets verbatim
-% catcodes, and then issues |^^M| (set equal to \cs{@@_ret:w}) to read the
+% catcodes, and then issues §^^M§ (set equal to \cs{@@_ret:w}) to read the
% environment line by line until reaching its end. The output token list will
-% be appended with an active |^^J| character and the line just read, and this
+% be appended with an active §^^J§ character and the line just read, and this
% line is written to the output file, if any. At the end of the environment
% the output file is closed (if it was open), and the output token list is
-% smuggled out of the verbatim group. A leading |^^M| is removed from the
-% token list using \cs{@@_remove_leading_nl:n} (which expects an active |^^M|
-% token at the head of the token list; a low level TeX error is raised
+% smuggled out of the verbatim group. A leading §^^J§ is removed from the
+% token list using \cs{@@_remove_leading_nl:n} (which expects an active §^^J§
+% token at the head of the token list; a low level \hologo{TeX} error is raised
% otherwise).
%
-%%^^A File write start/File write stop
% \begin{macrocode}
\cs_new_protected:Npn \@@_file_tl_write_start:n #1
{
@@ -1976,10 +2241,7 @@ No tab
\bool_if:NT \l_@@_storing_bool
{
\tl_set:Nn \exp_not:N #1
- {
- \exp_args:NV \@@_remove_leading_nl:n \l_@@_file_tl
- \bool_if:NT \l_@@_forced_eol_bool { \exp_not:N ^^J }
- }
+ { \exp_args:NV \@@_remove_leading_nl:n \l_@@_file_tl }
}
}
}
@@ -2002,13 +2264,13 @@ No tab
% 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 \cs{begin}|{scontents}|
+% \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 \cs{end}|{scontents}|
+% \cs{@@_nesting_decr:} reduces the nesting level, if an §\end{scontents}§
% is found.
%
-% Multiple \cs{end}|{scontents}| in the same line are not supported...
+% Multiple §\end{scontents}§ in the same line are not supported...
% \begin{macrocode}
\cs_new_protected:Npn \@@_verb_processor_output:n #1
{
@@ -2070,35 +2332,30 @@ No tab
% Finishes the environment by optionally calling \cs{@@_store_to_seq:}
% and then clearing the temporary token list.
%
-%%^^A Second atend_environment/stored_to_seq
% \begin{macrocode}
\cs_new_protected:Npn \@@_atend_environment:
{
\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
+ \bool_if:NT \l_@@_print_env_bool
+ { \@@_lastfrom_seq:n \l_@@_name_seq_env_tl }
}
- \bool_if:NT \l_@@_print_env_bool
- {
- \tl_gset_eq:NN \g_@@_temp_tl \l_@@_macro_tmp_tl
- \tl_gput_right:NV \g_@@_temp_tl \c_percent_str
- \group_insert_after:N \@@_rescan_tokens:V
- \group_insert_after:N \g_@@_temp_tl
- }
- \tl_clear:N \l_@@_macro_tmp_tl
}
% \end{macrocode}
% \end{macro}
%
% \subsection{The \cs{Scontents} command}
%
-% User command to stored content, adapted from
+% User command to \mymeta{stored content}, adapted from
% \url{https://tex.stackexchange.com/a/500281/7832}.
%
% \begin{macro}{\Scontents,\@@_norm_arg:n,\@@_verb_arg:w}
-% The \cs{Scontents} macro starts by parsing an optional argument and
+% The §\Scontents§ macro starts by parsing an optional argument and
% then delegates to \cs{@@_verb_arg:w} or \cs{@@_norm_arg:n} depending whether
-% a star argument is present.
+% a star (§*§) argument is present.
%
% \cs{@@_norm_arg:n} grabs a normal argument, adds it to the |seq| varaible,
% and optionally prints it.
@@ -2106,18 +2363,12 @@ No tab
% \cs{@@_verb_arg:w} grabs a verbatim argument using \pkg{xparse}'s |+v|
% argument parser.
%
-%^^A NOTE: Any particular reason why \keys_set_known:nn instead of just
-%^^A \keys_set:nn? The latter reports if an unknown key is used...
-%^^A Reply: The redirection of error messages has never worked well for me
-%^^A perhaps it would be better to implement it.
-%
-%%^^A User command \Scontents to stored content
% \begin{macrocode}
\NewDocumentCommand { \Scontents }{ !s !O{} }
{
\group_begin:
\IfNoValueF {#2}
- { \keys_set_known:nn { scontents / Scontents } {#2} }
+ { \keys_set:nn { scontents / Scontents } {#2} }
\char_set_catcode_active:n { 9 }
\IfBooleanTF {#1}
{ \@@_verb_arg:w }
@@ -2125,21 +2376,22 @@ No tab
}
\cs_new_protected:Npn \@@_norm_arg:n #1
{
- \exp_args:NV \@@_append_contents:nn \l_@@_name_seq_cmd_tl {#1}
- \bool_if:NT \l_@@_print_cmd_bool { \@@_rescan_tokens:n {#1} }
+ \tl_set:Nx \l_@@_temp_tl { \exp_not:n {#1} }
+ \tl_put_right:Nx \l_@@_temp_tl { \c_@@_hidden_space_str }
+ \@@_store_to_seq:NN \l_@@_temp_tl \l_@@_name_seq_cmd_tl
+ \bool_if:NT \l_@@_print_cmd_bool
+ { \@@_lastfrom_seq:n \l_@@_name_seq_cmd_tl }
\group_end:
}
\NewDocumentCommand { \@@_verb_arg:w } { +v }
{
- \tl_set:Nx \l_@@_temp_tl
- {
- \exp_not:n {#1}
- \bool_if:NT \l_@@_forced_eol_bool { \exp_not:N ^^J }
- }
+ \tl_set:Nx \l_@@_temp_tl { \exp_not:n {#1} }
\tl_replace_all:Nxx \l_@@_temp_tl { \iow_char:N \^^M } { \iow_char:N \^^J }
+ \bool_if:NF \l_@@_forced_eol_bool
+ { \tl_put_right:Nx \l_@@_temp_tl { \c_@@_hidden_space_str } }
\@@_store_to_seq:NN \l_@@_temp_tl \l_@@_name_seq_cmd_tl
\bool_if:NT \l_@@_print_cmd_bool
- { \@@_rescan_tokens:V \l_@@_temp_tl }
+ { \@@_lastfrom_seq:n \l_@@_name_seq_cmd_tl }
\group_end:
}
% \end{macrocode}
@@ -2147,21 +2399,16 @@ No tab
%
% \subsection{The command \cs{getstored}}
%
-%
% \begin{macro}{\getstored}
-% User command \cs{getstored} to extract stored content in |seq|
+% User command §\getstored§ to extract \mymeta{stored content} in |seq|
% (robust).
%
-%%^^A User command \getstored to get content
% \begin{macrocode}
\NewDocumentCommand { \getstored } { O{1} m }
{
\group_begin:
\@@_rescan_tokens:x
- {
- \@@_getfrom_seq:nn {#1} {#2}
- \c_percent_str
- }
+ { \@@_getfrom_seq:nn {#1} {#2} }
\group_end:
}
% \end{macrocode}
@@ -2173,29 +2420,32 @@ No tab
% in (\url{https://tex.stackexchange.com/a/497651/7832}).
%
% \begin{macro}{\typestored,\@@_verb_print:N,\@@_xverb:w,verbatimsc}
-% The \cs{typestored} commands fetches a buffer from memory, prints it
+% The §\typestored§ commands fetches a buffer from memory, prints it
% to the log file, and then calls \cs{@@_verb_print:N}.
%
-%%^^A User command \typestored to verbatimized content
% \begin{macrocode}
\NewDocumentCommand { \typestored } { o m }
{
\group_begin:
\int_set:Nn \l_@@_seq_item_int { 1 }
- \IfValueT {#1} { \keys_set:nn { scontents } {#1} }
- \tl_set:Nx \l_@@_temp_tl { \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#2} }
+ \IfValueT {#1} { \keys_set:nn { scontents / typemeaning } {#1} }
+ \tl_set:Nx \l_@@_temp_tl
+ {
+ \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#2}
+ }
+ \tl_remove_once:NV \l_@@_temp_tl \c_@@_hidden_space_str
\tl_log:N \l_@@_temp_tl
\tl_if_empty:NF \l_@@_temp_tl
{ \@@_verb_print:N \l_@@_temp_tl }
\group_end:
}
% \end{macrocode}
+%
% The \cs{@@_verb_print:N} macro is defined with active carriage return
% (\textsc{ascii} 13) characters to mimick an actual verbatim environment
% \enquote{on the loose}. The contents of the environment are placed in a
-% \env{verbatimsc} environment and rescanned using \cs{@@_rescan_tokens:x}.
+% §verbatimsc§ environment and rescanned using \cs{@@_rescan_tokens:x}.
%
-%%^^A Internal verb_print:N, need to verbatimized content
% \begin{macrocode}
\group_begin:
\char_set_catcode_active:N \^^M
@@ -2217,9 +2467,8 @@ No tab
\group_end:
% \end{macrocode}
%
-% Finally, the \env{verbatimsc} environment is defined.
+% Finally, the §verbatimsc§ environment is defined.
%
-%%^^A Definition of verbatimsc environment
% \begin{macrocode}
\cs_new_protected:Npn \@@_xverb:
{
@@ -2245,11 +2494,10 @@ No tab
% \subsection{Some auxiliaries}
%
% \begin{macro}{\@@_tabs_to_spaces:}
-% In a verbatim context the |tab| character is made active and set
+% In a verbatim context the |TAB| character is made active and set
% equal to \cs{@@_tabs_to_spaces:}, to produce as many spaces as
-% the |width-tab| key was set to.
+% the §width-tab§ key was set to.
%
-%%^^A Tab to space
% \begin{macrocode}
\cs_new:Npn \@@_tabs_to_spaces:
{ \prg_replicate:nn { \l_@@_tab_width_int } { ~ } }
@@ -2260,11 +2508,10 @@ No tab
% \cs{@@_do_noligs:N} is an alternative definition for \LaTeXe's
% \cs{do@noligs} which makes sure to not consume following space
% tokens. The \LaTeXe{} version ends with \cs{char}|`#1|, which
-% leaves \TeX{} still looking for an \meta{optional~space}.
+% leaves \TeX{} still looking for an \mymeta{optional~space}.
% This version uses \cs{char_generate:nn} to ensure that doesn't
% happen.
%
-%%^^A Patch do_noligs for ligatures
% \begin{macrocode}
\cs_new:Npn \@@_do_noligs:N #1
{
@@ -2286,7 +2533,6 @@ No tab
% }
% Shortcut definitions for common catcode changes.
%
-%%^^A Common catcode changes
% \begin{macrocode}
\cs_new_protected:Npn \@@_set_active_eq:NN #1
{
@@ -2304,31 +2550,28 @@ No tab
%
% \subsection{The command \cs{setupsc}}
%
-% User command \cs{setupsc} to setup module.
+% User command §\setupsc§ to setup module.
%
% \begin{macro}{\setupsc}
-% A user-level wrapper for \cs{keys_set:nn}|{ scontents }|.
+% A user-level wrapper for \cs{keys_set:nn}§{ scontents }§.
%
-%%^^A User command \setupsc
% \begin{macrocode}
-\NewDocumentCommand { \setupsc } { m }
+\NewDocumentCommand { \setupsc } { +m }
{ \keys_set:nn { scontents } {#1} }
% \end{macrocode}
% \end{macro}
%
% \subsection{The command meaningsc}
%
-%
% \begin{macro}{\meaningsc}
-% User command \cs{meaningsc} to see content stored in |seq|.
+% User command §\meaningsc§ to see content stored in |seq|.
%
-%%^^A User command \meaningsc
% \begin{macrocode}
\NewDocumentCommand { \meaningsc } { o m }
{
\group_begin:
\int_set:Nn \l_@@_seq_item_int { 1 }
- \IfValueT {#1} { \keys_set:nn { scontents } {#1} }
+ \IfValueT {#1} { \keys_set:nn { scontents / typemeaning } {#1} }
\@@_meaningsc:n {#2}
\group_end:
}
@@ -2336,8 +2579,12 @@ No tab
\char_set_catcode_active:N \^^I
\cs_new_protected:Npn \@@_meaningsc:n #1
{
- \tl_set:Nx \l_@@_temp_tl { \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#1} }
+ \tl_set:Nx \l_@@_temp_tl
+ {
+ \exp_args:NV \@@_getfrom_seq:nn \l_@@_seq_item_int {#1}
+ }
\tl_replace_all:Nxn \l_@@_temp_tl { \iow_char:N \^^J } { ~ }
+ \tl_remove_once:NV \l_@@_temp_tl \c_@@_hidden_space_str
\tl_log:N \l_@@_temp_tl
\tl_use:N \l_@@_verb_font_tl
\tl_replace_all:Nnx \l_@@_temp_tl { ^^I } { \@@_tabs_to_spaces: }
@@ -2351,12 +2598,11 @@ No tab
%
%
% \begin{macro}{\countsc}
-% User command \cs{countsc} to count number of contents stored in |seq|.
+% User command §\countsc§ to count number of contents stored in |seq|.
%
-%%^^A User command \countsc
% \begin{macrocode}
\NewExpandableDocumentCommand { \countsc } { m }
- { \seq_count:c { g_@@_seq_name_#1_seq } }
+ { \seq_count:c { g_@@_name_#1_seq } }
% \end{macrocode}
% \end{macro}
%
@@ -2364,20 +2610,18 @@ No tab
%
%
% \begin{macro}{\cleanseqsc}
-% A user command \cs{cleanseqsc} to clear (remove) a defined |seq|.
+% A user command §\cleanseqsc§ to clear (remove) a defined |seq|.
%
-%%^^A User command \cleanseqsc
% \begin{macrocode}
\NewDocumentCommand { \cleanseqsc } { m }
- { \seq_clear_new:c { g_@@_seq_name_#1_seq } }
+ { \seq_clear_new:c { g_@@_name_#1_seq } }
% \end{macrocode}
% \end{macro}
%
-% \subsection{Messages}
+% \subsection{Warning and error messages}
%
-% Messages used throughout the package.
+% Warning and error messages used throughout the package.
%
-%%^^A Messages used throughout the package
% \begin{macrocode}
\msg_new:nnn { scontents } { junk-after-begin }
{
@@ -2386,33 +2630,17 @@ No tab
#2
}
\msg_new:nnn { scontents } { empty-stored-content }
- { Empty~value~for~key~`getstored'~\msg_line_context:. }
+ { Empty~value~for~key~'getstored'~\msg_line_context:. }
\msg_new:nnn { scontents } { empty-variable }
- { Variable~`#1'~empty~\msg_line_context:. }
+ { Variable~'#1'~empty~\msg_line_context:. }
\msg_new:nnn { scontents } { rewriting-file }
- { Overwriting ~ file ~ `#1' }
+ { 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{scontents}~\msg_line_context:.}
\msg_new:nnn { scontents } { multiple-begin }
{ Multiple~\c_backslash_str begin{scontents}~\msg_line_context:.}
-\msg_new:nnn { scontents } { tab-to-space }
- { Tab~has~been~converted~to~Blank~Space }
-\msg_new:nnn { scontents } { feed-to-space }
- { Form~Feed~has~been~converted~to~Blank~Space }
-\msg_new:nnnn { scontents } { key-unknown }
- { The~key~'#1'~is~unknown~and~is~being~ignored. }
- {
- The~module~'scontents'~does~not~have~a~key~called~'#1'.\\
- Check~that~you~have~spelled~the~key~name~correctly.
- }
-\msg_new:nnnn { scontents } { key-value-unknown }
- { The~key~'#1'~to~which~you~passed~'#2'~is~unknown~and~is~being~ignored. }
- {
- The~module~'scontents'~does~not~have~a~key~called~'#1'.\\
- Check~that~you~have~spelled~the~key~name~correctly.
- }
\msg_new:nnn { scontents } { undefined-storage }
{ Storage~named~'#1'~is~not~defined. }
\msg_new:nnn { scontents } { index-out-of-range }
@@ -2425,13 +2653,48 @@ No tab
{ Max = } { Min = -} #3.
}
}
+\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'.\\
+ 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'.\\
+ Check~that~you~have~spelled~the~key~name~correctly.
+ }
+\msg_new:nnnn { scontents } { cmd-key-unknown }
+ { The~key~'#1'~is~unknown~by~'\c_backslash_str Scontents'~and~is~being~ignored.}
+ {
+ The~command~'\c_backslash_str Scontents'~does~not~have~a~key~called~'#1'.\\
+ Check~that~you~have~spelled~the~key~name~correctly.
+ }
+\msg_new:nnnn { scontents } { cmd-key-value-unknown }
+ { The~key~'#1=#2'~is~unknown~by~'\c_backslash_str Scontents'~and~is~being~ignored. }
+ {
+ The~command~'\c_backslash_str Scontents'~does~not~have~a~key~called~'#1'.\\
+ Check~that~you~have~spelled~the~key~name~correctly.
+ }
+\msg_new:nnnn { scontents } { type-key-unknown }
+ { The~key~'#1'~is~unknown~and~is~being~ignored. }
+ {
+ This~command~does~not~have~a~key~called~'#1'.\\
+ This~command~only~accepts~the~key~'width-tab'.
+ }
+\msg_new:nnnn { scontents } { type-key-value-unknown }
+ { The~key~'#1'~to~which~you~passed~'#2'~is~unknown~and~is~being~ignored. }
+ {
+ This~command~does~not~have~a~key~called~'#1'.\\
+ This~command~only~accepts~the~key~'width-tab'.
+ }
% \end{macrocode}
%
% \subsection{Finish package}
%
-% Finish package
+% Finish package implementation.
%
-%%^^A Finish package :)
% \begin{macrocode}
\file_input_stop:
% \end{macrocode}
diff --git a/macros/latex/contrib/scontents/scontents.pdf b/macros/latex/contrib/scontents/scontents.pdf
index 3dd1234ddb..8e48969cc4 100644
--- a/macros/latex/contrib/scontents/scontents.pdf
+++ b/macros/latex/contrib/scontents/scontents.pdf
Binary files differ