diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-29 21:24:55 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-29 21:24:55 +0000 |
commit | d4a75ab9db4e8f02b22024ac4e7eb53f983512eb (patch) | |
tree | fa20e2e5c9d41dd0737f5071586c66840789232d /Master/texmf-dist/source/latex/scontents | |
parent | 45ee5d92b198fe66f73b1db07106418d6c97b5e1 (diff) |
scontents (29oct19)
git-svn-id: svn://tug.org/texlive/trunk@52575 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/scontents')
-rw-r--r-- | Master/texmf-dist/source/latex/scontents/scontents.dtx | 352 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/scontents/scontents.ins | 4 |
2 files changed, 230 insertions, 126 deletions
diff --git a/Master/texmf-dist/source/latex/scontents/scontents.dtx b/Master/texmf-dist/source/latex/scontents/scontents.dtx index 70c7ea4b14f..c2316fb9991 100644 --- a/Master/texmf-dist/source/latex/scontents/scontents.dtx +++ b/Master/texmf-dist/source/latex/scontents/scontents.dtx @@ -30,6 +30,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[english]{babel} \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} \setmonofont[ @@ -46,8 +47,12 @@ \newfontfamily\sourcecodeprolight{SourceCodePro-Regular.otf}[Scale = 0.80,FakeStretch =0.75] \RenewDocumentCommand{\MacroLongFont}{} { \sourcecodeprolight\small } -\usepackage{unicode-math} +% The character of visible space is now taken from Latin Modern Mono +% to prevent fonts in T1. The original definition for xetex/luatex is +% \def\verbvisiblespace{\usefont{OT1}{cmtt}{m}{n}\asciispace} +\def\verbvisiblespace{{\fontfamily{lmtt}\selectfont\char"2423}} +\usepackage{unicode-math} % Unicode-math changes the position of the glyphs, so the position 26A is now % a letter `j'. The doc package ensures that mathcode and the | actually prints % a j inside docstrip guards. This changes the mathcode of | to 07C: @@ -67,6 +72,7 @@ \newfontfamily\fetamontotf{ffmw10.otf}[ Scale = 0.95,% RawFeature = {+latn,+rand,+kern,+size},% + FontFace = {bx}{n}{ffmw10.otf}, ] \usepackage[svgnames]{xcolor} \usepackage[sf,bf,compact,medium,pagestyles]{titlesec} @@ -74,6 +80,13 @@ \usepackage{adjustbox,multicol,listings,accsupp,titletoc} \usepackage{scontents} % main \usepackage[contents]{colordoc} +\def\textnew#1{\color{color-def}#1\/} +\def\AltMacroFont{\fontencoding\encodingdefault + \fontfamily\ttdefault + \fontseries\mddefault + \fontshape\updefault + \small + }% % Patching colordoc.sty to work with l3doc.cls \ExplSyntaxOn @@ -121,6 +134,18 @@ % Colors for options \definecolor{optcolor}{rgb}{0.281,0.275,0.485} \definecolor{mypkgcolor}{RGB}{0,128,128}% + +% Logo with fetamont font for title +\makeatletter +\newsavebox{\logobox} +\savebox{\logobox}{% + \normalsize\fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}} +\newcommand{\mylogo}{% + \settoheight{\@tempdima}{L}% + \resizebox{!}{\@tempdima}{\usebox{\logobox}}% + } +\makeatother + % Custom \meta[...]{...}, \marg[...]{...} and \oarg[...]{...} with color \ExplSyntaxOn % User level commands @@ -204,7 +229,6 @@ { \textcolor{\l_userdoc_meta_brackcolor_tl}{#1} } - % \envexamp{m} \newsavebox{\boxexaenv} \NewDocumentCommand{\envexamp}{m} @@ -220,6 +244,19 @@ \end{lrbox}% \usebox{\boxexaenv} } +\NewDocumentCommand{\envexaplain}{O{} m O{end}} + { + \begin{lrbox}{\boxexaenv}% + \begin{minipage}[t]{\marginparwidth}% + \raggedright\ttfamily\small + \textcolor{mypkgcolor}{{\textbackslash#1#2}}\myoarg + [type=tt,sbc=gray,ac=lightgray,cf=optcolor]{keyval ~ list}\par% + \hspace{0.5cm}\mymeta[type=tt,ac=lightgray,cf=gray]{env ~ contents}\par% + \textcolor{mypkgcolor}{{\textbackslash #3#2}}\par + \end{minipage}% + \end{lrbox}% + \usebox{\boxexaenv} + } % \cmdexamp{s m o m o} \DeclareDocumentCommand{\cmdexamp}{o m o m o} @@ -227,7 +264,7 @@ \group_begin: \small\ttfamily \textcolor{mypkgcolor}{\textbackslash#2} - \IfValueT{#1}{ \textcolor{red}{#1} } + \IfValueT{#1}{ \textcolor{MediumOrchid}{#1} } \IfValueT{#3}{ \myoarg[type=tt,sbc=gray,ac=lightgray,cf=optcolor]{#3} } \IfValueTF{#5} { @@ -238,7 +275,8 @@ { \mymarg[type=tt,cbc=gray,ac=lightgray,cf=optcolor]{#4} } \par \group_end: - \MYSortIndex{Commands}{Commands ~ provide ~ by ~ \textcolor{gray}{scontents}>\texttt{\textbackslash#2}}% + \MYSortIndex{Commands}{Commands ~ provide ~ by ~ + {\fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}}:}% } % \keyexamp{mmm} @@ -259,7 +297,8 @@ \group_begin: \IfBooleanTF{#1} { - \textsf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}} + %\textsf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}} + \fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}} \MYSortIndex{packages}{Packages>\texttt{#2}} } { @@ -274,8 +313,9 @@ { \IfBooleanTF{#1} { - \textcolor{mypkgcolor}{\ttfamily{#2}}% - \MYSortIndex{environment}{Environment ~ provide ~ by ~ \textcolor{gray}{scontents}:>\texttt{#2}} + \textcolor{mypkgcolor}{\ttfamily{#2}}% + \MYSortIndex{environment}{ Environment ~ provide ~ by ~ + {\fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}}:>\texttt{#2}} } { \textcolor{darkgray}{\ttfamily{#2}}% @@ -289,9 +329,13 @@ \IfBooleanTF{#1} { \tl_set:Nn \l_tmpa_tl { #2 } - \regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{red\cE\}\cB\{\1\cE\} } \l_tmpa_tl + \regex_replace_once:nnN { (\*) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl \textcolor{mypkgcolor}{\ttfamily\textbackslash{\tl_use:N \l_tmpa_tl}} - \MYSortIndex{Commands}{Commands ~ provide ~ by ~ \textcolor{gray}{scontents}>\texttt{\textbackslash#2}} + \MYSortIndex{Commands}{ Commands ~ provide ~ by ~ + { + \fetamontotf{ + \textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}} + }:>\texttt{\textbackslash#2}} } { \textcolor{darkgray}{\ttfamily\textbackslash{#2}} @@ -310,17 +354,6 @@ \newcommand\emailampersat{{\color{optcolor}\footnotesize @}}% \catcode`\_=8\relax% -\makeatletter -% Logo whit fetamont font for title -\newsavebox{\logobox} -\savebox{\logobox}{% - \normalsize\fetamontotf{\textcolor{mypkgcolor}{s}\textcolor{OrangeRed}{content}\textcolor{mypkgcolor}{s}}} -\newcommand{\mylogo}{% - \settoheight{\@tempdima}{L}% - \resizebox{!}{\@tempdima}{\usebox{\logobox}}% - } -\makeatother - % Custom vertamimsc \makeatletter \let\verbatimsc\@undefined @@ -352,7 +385,7 @@ columns=fullflexible,% stringstyle= {\color{red}},% basicstyle=\ttfamily\small,% - alsoletter=-,% + alsoletter={-,@,.},% % comments morecomment=[l]{\%},% commentstyle=\lmmitalic\small\itshape\color{lightgray},% @@ -361,36 +394,66 @@ keywords=[1]{begin,end,Verbatim},% % Other words 2 keywordstyle=[2]{\color{blue!75}},% - keywords=[2]{usepackage,section,documentclass,input,usemodule},% + keywords=[2]{usepackage,section,documentclass,input,usemodule, + subsection,ExplSyntaxOff,ExplSyntaxOn,RequirePackage, + ProvidesExplPackage},% % Other words 3 keywordstyle=[3]{\color{optcolor!85}},% - keywords=[3]{document,article},% + keywords=[3]{document,article,setlength,pagestyle,definecolor},% % Reserved words 4 (scontents pkg) keywordstyle=[4]{\color{mypkgcolor}},% keywords=[4]{scontents,Scontents,getstored,typestored,verbatimsc,% endverbatimsc,countsc,meaningsc,foreachsc,macros - endscontents,startscontents,stopscontents},% + endscontents,startscontents,stopscontents,scontents.tex},% % Reserved in red keywordstyle=[5]{\color{red}},% - keywords=[5]{makeatletter,makeatother,let,verb,undefined,makebox},% + keywords=[5]{makeatletter,makeatother,let,verb,@undefined,makebox,def,% + par,item,parindent,lstinline,@ifpackagelater,ver@xparse.sty,% + dospecials,do@noligs,char,outer},% % Reserved in orange keywordstyle=[6]{\color{optcolor}},% - keywords=[6]{store-cmd,store-env,print-env,write-env,% + keywords=[6]{store-cmd,store-env,print-env,print-cmd,write-env,% start,stopt,wrapper,sep,step,before,after,write-out,% width-tab,force-eol,inner,outer,I,J,M,L,Ascheol},% % Reserved in orange keywordstyle=[7]{\color{OrangeRed}},% - keywords=[7]{DefineVerbatimEnvironment,lstnewenvironment,newminted,newenvironment},% + keywords=[7]{DefineVerbatimEnvironment,lstnewenvironment,newminted,% + newtheorem,newenvironment,VerbatimEnvironment},% % literate - literate=*{\{}{{\textcolor{gray}{\{}}}{1} - {\}}{{\textcolor{gray}{\}}}}{1} + literate=*{\{}{{{\color{gray}{\char`\{}}}}{1} + {\}}{{{\color{gray}{\char`\}}}}}{1} + {\|}{{{\color{gray}{\char`\|}}}}{1} + {\$}{{{\color{gray}{\char`\$}}}}{1} + {\#}{{{\color{optcolor}{\char`\#}}}}{1} {[}{{\textcolor{gray}{[}}}{1} {]}{{\textcolor{gray}{]}}}{1} {,}{{\textcolor{gray}{,}}}{1} + {;}{{\textcolor{gray}{;}}}{1} + {\&}{{\textcolor{gray}{\&}}}{1} {>}{{\textcolor{OrangeRed}{\guillemotright}}}{1} - {*}{{\textcolor{red}{*}}}{1} - {@}{{\textcolor{red}{@}}}{1} + {*}{{\textcolor{MediumOrchid}{*}}}{1} + %{@}{{\textcolor{red}{@}}}{1} {\^}{{\textcolor{optcolor}{\textasciicircum}}}{1} + {0}{{\textcolor{MediumOrchid}{0}}}{1} + {1}{{\textcolor{MediumOrchid}{1}}}{1} + {2}{{\textcolor{MediumOrchid}{2}}}{1} + %{3}{{\textcolor{MediumOrchid}{3}}}{1}% expl3 + {4}{{\textcolor{MediumOrchid}{4}}}{1} + {5}{{\textcolor{MediumOrchid}{5}}}{1} + {6}{{\textcolor{MediumOrchid}{6}}}{1} + {7}{{\textcolor{MediumOrchid}{7}}}{1} + {8}{{\textcolor{MediumOrchid}{8}}}{1} + {9}{{\textcolor{MediumOrchid}{9}}}{1} + {.0}{{\textcolor{MediumOrchid}{.0}}}{2}% Following is to ensure that only periods + {.1}{{\textcolor{MediumOrchid}{.1}}}{2}% followed by a digit are changed. + {.2}{{\textcolor{MediumOrchid}{.2}}}{2} + {.3}{{\textcolor{MediumOrchid}{.3}}}{2} + {.4}{{\textcolor{MediumOrchid}{.4}}}{2} + {.5}{{\textcolor{MediumOrchid}{.5}}}{2} + {.6}{{\textcolor{MediumOrchid}{.6}}}{2} + {.7}{{\textcolor{MediumOrchid}{.7}}}{2} + {.8}{{\textcolor{MediumOrchid}{.8}}}{2} + {.9}{{\textcolor{MediumOrchid}{.9}}}{2} {=}{{\textcolor{gray}{=}}}{1},% }[keywords,tex,comments,strings]% end languaje @@ -428,13 +491,14 @@ \lstMakeShortInline[language=scontents-doc,basicstyle=\ttfamily]§ % Get file info -\GetFileInfo{scontents.sty} +\GetFileInfo{\jobname.sty} % Config hyperref +\definecolor{linkcolour}{cmyk}{0.64,0,0.95,0.40}% <-Olive Green \hypersetup{ - linkcolor = blue!50, - citecolor = red!50,% - urlcolor = magenta,% + linkcolor = linkcolour,% + citecolor = linkcolour,% + urlcolor = linkcolour,% colorlinks = true,% linktoc = all,% pdftitle = {.:: The scontents package --- \fileinfo{} ::.},% @@ -477,7 +541,7 @@ \makeatletter \renewcommand\tableofcontents{% \begingroup% -\section*{\contentsname\quad{\color{gray}\leaders\hrule height 5pt depth -4.4pt\hfill}% +\section*{\contentsname\quad{\color{optcolor}\leaders\hrule height 5pt depth -4.4pt\hfill}% \@mkboth{% \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% \vspace*{-14pt} @@ -485,7 +549,7 @@ \begin{multicols}{2}% \@starttoc{toc}% \end{multicols}% -\vspace*{-3pt}{\color{gray}\hrule height 0.6pt}% +\vspace*{-3pt}{\color{optcolor}\hrule height 0.6pt}% \vspace*{5pt} \endgroup } @@ -499,7 +563,7 @@ % \title{ % \scalebox{1.025}{\mylogo}\\[2pt] % \Large -% \textsf{Stores \hologo{LaTeX} contents}\\[3pt] +% \textsf{Stores \hologo{LaTeX}}{ \fetamontotf{contents} }\\[3pt] % \fileversion{} --- \filedate\thanks{ % This file describes a documentation for \fileversion, last revised % \filedate.}\\[25pt] @@ -518,7 +582,7 @@ % % \begin{scontents}[store-env=abstract,print-env=true] % \begin{abstract} -% The \mypkg*{scontents} package stores valid \hologo{(La)TeX} code in +% The \mypkg*{scontents} package stores valid \hologo{LaTeX} code in % \mymeta{sequences} using the \mypkg{l3seq} module of \mypkg{expl3}. % The \mymeta{stored content}, including \emph{verbatim}, can be used % as many times as desired in the document, additionally can be written @@ -532,7 +596,7 @@ % % \section{Motivation and Acknowledgments} % -% In \hologo{(La)TeX} there is no direct way to record content for later use, although +% In \hologo{LaTeX} there is no direct way to record content for later use, although % you can do this using §\macros§, recording \mymeta{verbatim content} is a % 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 @@ -613,12 +677,15 @@ %<*example> % \fi \begin{examplecode}[frame=single] -\usepackage`\small\myoarg{key \textnormal{\textcolor{gray}{=}} val}`{scontents} +\usepackage`\small\myoarg[type=tt]{key \textnormal{\textcolor{gray}{=}} val}`{scontents} \end{examplecode} % \iffalse %</example> % \fi % +% The package options are not available for \hologo{plainTeX} and +% \hologo{ConTeXt}, see \ref{sec:confopt}. +% % \subsubsection*{For \hologo{plainTeX} users} % % \iffalse @@ -768,12 +835,12 @@ % command to get the \mymeta{stored content} along with other utilities described % in this documentation. % -% \subsection{The environment \env{scontents}} -% \label{sec:scontents} +% \subsection{The environment \texttt{scontents}} +% \label{sec:envscontents} % % \vspace*{-10pt} % -% \begin{function}{scontents} +% \begin{function}[label=SCONTENTS]{scontents} % \begin{syntax} % \envexamp{scontents} % \end{syntax} @@ -803,11 +870,14 @@ % \fi \begin{examplecode}[frame=single] \begin{scontents}[store-env=outer] -This text is in the outer environment (before nested). +This text is in the outer environment +(before nested). \begin{scontents}[store-env=inner] -This text is found in the inner environment (inside of nested). +This text is found in the inner environment +(inside of nested). \end{scontents} -This text is in the outer environment (after nested). +This text is in the outer environment +(after nested). \end{scontents} \end{examplecode} % \iffalse @@ -821,11 +891,28 @@ This text is in the outer environment (after nested). % It is advisable to store content within sequences with different names, % so as not to get lost in the order in which content is stored. % +% \newpage +% +% \subsection*{Notes for \hologo{plainTeX} and \hologo{ConTeXt} users} +% % In \hologo{plainTeX} there is not environments as in \hologo{LaTeX}. % Instead of using the environment \myenv*{scontents}, one should use a % \emph{pseudo environment} delimited by \ics*{scontents} and \ics*{endscontents}. -% \hologo{ConTeXt} users should use \ics*{startscontents} and \ics*{stopscontents}. % +% \vspace*{-10pt} +% \begin{function}{\scontents,\endscontents} +% \begin{syntax} +% \envexaplain{scontents} +% \end{syntax} +% \end{function} +% +% \hologo{ConTeXt} users should use \ics*{startscontents} and \ics*{stopscontents}. +% \vspace*{-10pt} +% \begin{function}{\startscontents,\stopscontents} +% \begin{syntax} +% \envexaplain[start]{scontents}[stop] +% \end{syntax} +% \end{function} % \subsection*{Options for environment} % % The environment options can be configured globally using option @@ -1009,11 +1096,6 @@ This text is in the outer environment (after nested). % stored in the \mymarg{seq name}. The key §width-tab§ is available for % this command. % -% 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. -% % \subsection{The environment \env{verbatimsc}} % \label{sec:verbatimsc} % @@ -1026,11 +1108,12 @@ This text is in the outer environment (after nested). % % One consideration to keep in mind is that this is a \emph{representation} % of the \mymeta{stored content} in a \emph{verbatim} environment and not -% a real \emph{verbatim} environment. +% a real \emph{verbatim} environment. The \mypkg{verbatim} package is not +% compatible with the implementation of the \myenv*{verbatimsc} environment. % +% The \myenv*{verbatimsc} environment can be customized in the following ways: % -% The \myenv*{verbatimsc} environment can be customized in the -% following ways: +% \newpage % % Using the package \mypkg{fancyvrb}: % \iffalse @@ -1132,12 +1215,8 @@ This text is in the outer environment (after nested). % The command \ics*{cleanseqsc} remove all contents stored in \mymarg{seq name}. % \end{function} % -% \newpage +% \section[The \textnormal{\texttt{scontents}} package in action]{The \mypkg*{scontents} package in action} % -% \pdfstringdefDisableCommands{% -% \RenewExpandableDocumentCommand{\mypkg}{sm}{#2}% -% } -% \section{The \mypkg*{scontents} package in action} % Remember the abstract on the first page?, this is it: % % \getstored{abstract} @@ -1198,14 +1277,12 @@ by making use \mymeta{sequences}. % 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 +% These are some adapted examples that have served as inspiration for % the creation of this package. % -% \subsection{From answers package} +% \subsection{From \texttt{answers} package} % % \subsubsection*{Example 1} % @@ -1213,23 +1290,19 @@ by making use \mymeta{sequences}. %<*example> % \fi \begin{scontents}[write-out=scexamp1.ltx] -\documentclass[12pt,a4paper]{article} +\documentclass{article} \usepackage[store-cmd=solutions]{scontents} \newtheorem{ex}{Exercise} \begin{document} \section{Problems} \begin{ex} First exercise -\Scontents{ - First solution. -} +\Scontents{First solution.} \end{ex} \begin{ex} Second exercise -\Scontents{ - Second solution. -} +\Scontents{Second solution.} \end{ex} \section{Solutions} @@ -1240,11 +1313,11 @@ Second exercise %</example> % \fi % -% Adaptation of example 1 (ansexam1) of the package \mypkg{answers} +% Adaptation of example 1 of the package \mypkg{answers} % \textattachfile[color=0 0 1]{scexamp1.ltx}{\faFile*[regular]}. % \lstinputlisting[language=scontents-doc,numbers=left]{scexamp1.ltx} % -% \subsection{From filecontentsdef package} +% \subsection{From \texttt{filecontentsdef} package} % % \subsubsection*{Example 2} % @@ -1297,6 +1370,7 @@ seventies that the \NSA\ has known that for 40 years.\par \documentclass{article} \usepackage[store-cmd=tikz]{scontents} \usepackage{tikz} +\setlength{\parindent}{0pt} \pagestyle{empty} \Scontents*{\matrix{ \node (a) {$a$} ; & \node (b) {$b$} ; \\ } ;} \Scontents*{\matrix[ampersand replacement=\&] @@ -1316,10 +1390,27 @@ seventies that the \NSA\ has known that for 40 years.\par \getstored[3]{tikz} \end{tikzpicture} -\section{source} +\begin{scontents}[store-env=buffer] +Hello World! + +This is a \verb*|fake poor man's buffer :)|. +\end{scontents} + +\section{source tikz} \typestored[1]{tikz} \typestored[2]{tikz} \typestored[3]{tikz} + +\section{fake buffer} +\subsection{real content} +\getstored[1]{buffer} +\subsection{verbatim style} +\typestored[1]{buffer} +\subsection{meaning} +\meaningsc[1]{buffer} + +\section{tikz again} +\foreachsc[before={\begin{tikzpicture}},after={\end{tikzpicture}},sep={\\[10pt]}]{tikz} \end{document} \end{scontents} % \iffalse @@ -1340,24 +1431,25 @@ seventies that the \NSA\ has known that for 40 years.\par \usepackage{scontents} \pagestyle{empty} \begin{document} -\begin{scontents}[store-env=a] -Something for a +\begin{scontents}[store-env=main] +Something for main A. \end{scontents} -\begin{scontents}[store-env=a] -Something for b +\begin{scontents}[store-env=main] +Something for \verb|main B|. \end{scontents} -\begin{scontents}[store-env=a] -Something with no label +\begin{scontents}[store-env=other] +Something for \verb|other|. \end{scontents} \textbf{Let's print them} -This is a: \getstored[1]{a}\par -This is b: \getstored[2]{a} +This is first stored in main: \getstored[1]{main}\par +This is second stored in main: \getstored[2]{main}\par +This is stored in other: \getstored[1]{other} -\textbf{Print all of them}\par +\textbf{Print all of stored in main}\par \foreachsc[sep={\\[10pt]}]{a} \end{document} \end{scontents} @@ -1405,7 +1497,7 @@ This is from the verbatim environment: % \textattachfile[color=0 0 1]{scexamp5.ltx}{\faFile*[regular]}. % \lstinputlisting[language=scontents-doc,numbers=left]{scexamp5.ltx} % -% \subsection{Customization of verbatimsc} +% \subsection{Customization of \texttt{verbatimsc}} % % \subsubsection*{Example 6} % @@ -1541,7 +1633,7 @@ and more.+ %<*example> % \fi \begin{scontents}[write-out=scexamp8.ltx] -% need --shell-escape +% need -shell-escape \documentclass{article} \usepackage{scontents} \makeatletter @@ -1604,9 +1696,15 @@ No tab % \begin{description}[font=\small\sffamily,wide=0pt,style=multiline,leftmargin=\descrwidth,nosep,noitemsep] % \item [\fileversion{} (ctan), \filedate] % \begin{itemize} +% \item The |verbatimsc| environment was rewritten. +% \item Minor adjustments in documentation. +% \end{itemize} +% \item [v1.6 (ctan), 2019-10-26] +% \begin{itemize} % \item The internal behavior of |\getstored| has been modified. % \item The internal behavior of |\foreachsc| has been modified. % \item Corrected file extension for \hologo{ConTeXt}. +% \item Remove spurious warning. % \end{itemize} % \item [v1.5 (ctan), 2019-10-24] % \begin{itemize} @@ -1661,6 +1759,11 @@ No tab % \addtocontents{toc}{\protect\setcounter{tocdepth}{2}} % \cleardoublepage % \phantomsection +% \indexprologue{ +% The italic numbers denote the pages where the corresponding entry is +% described, the numbers underlined and all others indicate the line on +% which they are implemented in the package code. +% } % \printindex % } % @@ -1677,10 +1780,10 @@ No tab % % Now we define some common macros to hold the package date and version: % \begin{macrocode} -%<loader>\def\ScontentsFileDate{2019-10-26}% -%<core>\def\ScontentsCoreFileDate{2019-10-26}% +%<loader>\def\ScontentsFileDate{2019-10-29}% +%<core>\def\ScontentsCoreFileDate{2019-10-29}% %<*loader> -\def\ScontentsFileVersion{1.6}% +\def\ScontentsFileVersion{1.7}% \def\ScontentsFileDescription{Stores LaTeX contents in memory or files}% % \end{macrocode} % @@ -1708,7 +1811,7 @@ No tab % \end{macrocode} % The Plain and \hologo{ConTeXt} loaders are similar (probably because I don't % know how to make a proper \hologo{ConTeXt} module :-). We define a -% \LaTeX{}-style ver@scontents.sty macro with version info (just in case): +% \LaTeX{}-style §\ver@scontents.sty§ macro with version info (just in case): % \begin{macrocode} %<*!latex> %<context>\writestatus{loading}{User Module scontents v\ScontentsFileVersion} @@ -2208,7 +2311,7 @@ No tab % % 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 +% (otherwise something odd as §1=1§ might have been used). If everything % is correct, then set the value of the integer which holds the \mymeta{index}. % Otherwise raise an error about an \emph{unknown} option. % @@ -2311,7 +2414,7 @@ No tab % \end{macrocode} % % Now that the compatibility layer is defined, we can finally load \pkg{xparse}. -% \pkg{xparse} expects to be loaded with \cs{ExplSyntaxOff} (not much harm would +% \pkg{xparse} expects to be loaded with §\ExplSyntaxOff§ (not much harm would % be done otherwise, but just to be on the safe side). % % Within \pkg{xparse} a §\RequirePackage{expl3}§ is done. We can ignore that since @@ -2319,7 +2422,7 @@ No tab % we do that test too to ensure that \pkg{xparse} is compatible with the current % running version of \pkg{expl3}. The following §\ProvidesExplPackage§ simply % defines §\ver@xparse.sty§ for any other package that might uset it, and then -% does \cs{ExplSyntaxOn}. At the end of the package, \pkg{xparse} parses (heh) +% does §\ExplSyntaxOn§. At the end of the package, \pkg{xparse} parses (heh) % the package options. Since we don't have those in non-\LaTeX{} formats, they are % ignored. Okay, so load \pkg{xparse}: % \begin{macrocode} @@ -2334,7 +2437,7 @@ No tab %</loader&!latex> %<*core> % \end{macrocode} -% (actually we don't need to do \cs{ExplSyntaxOn} there because we don't have +% (actually we don't need to do §\ExplSyntaxOn§ there because we don't have % \LaTeX{}'s full package loading mechanism, so the \pkg{expl3} syntax remains % active after \pkg{xparse} is loaded, but it doesn't harm either). % @@ -2405,7 +2508,7 @@ No tab % % \begin{macro}{\@@_store_to_seq:NN} % The \cs{@@_store_to_seq:NN} writes the recorded contents -% in |#1| to the log and stores it in |#2|. +% in §#1§ to the log and stores it in §#2§. % % \begin{macrocode} \cs_new_protected:Npn \@@_store_to_seq:NN #1#2 @@ -2580,16 +2683,16 @@ No tab % \@@_remove_leading_nl:w, % } % 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 -% 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 -% 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 §^^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). +% The macro starts a group, opens the \mymeta{output file}, if necessary, +% sets verbatim 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 line is written to the output file, if any. At the end +% of the environment the \mymeta{output file} is closed (if it was open), +% and the output token list is 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). % % \begin{macrocode} \cs_new_protected:Npn \@@_file_tl_write_start:n #1 @@ -2788,14 +2891,19 @@ No tab % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\verbatim,\endverbatim} +% \begin{macro}[int]{\verbatimsc,\endverbatimsc} % In Plain we emulate \LaTeX's \env{verbatim} environment. % \begin{macrocode} %<*plain> \bool_new:N \l_@@_temp_bool -\cs_new_protected:Npn \verbatim - { \@@_verbatim_aux: \frenchspacing \@@_vobeyspaces: \@@_xverb: } -\cs_new_protected:Npn \@@_verbatim_aux: +\cs_new_protected:Npn \verbatimsc + { + \group_begin: + \@@_verbatimsc_aux: \frenchspacing \@@_vobeyspaces: \@@_xverb: + } +\cs_new_protected:Npn \endverbatimsc + { \group_end: } +\cs_new_protected:Npn \@@_verbatimsc_aux: { \skip_vertical:N \parskip \int_set:Nn \parindent { 0pt } @@ -2837,8 +2945,8 @@ No tab % \end{macro} % % \begin{macro}[int]{\dospecials} -% \pkg{xparse} also requires \LaTeX's \cs{dospecials}. In case it doesn't -% exist (at the time \pkg{scontents} is loaded) we define \cs{dospecials} +% \pkg{xparse} also requires \LaTeX's §\dospecials§. In case it doesn't +% exist (at the time \pkg{scontents} is loaded) we define §\dospecials§ % to use the \cs{l_char_special_seq}. % \begin{macrocode} %<*!latex> @@ -2999,9 +3107,6 @@ No tab % % \subsection{The command \cs{typestored}} % -% This implementation is an adaptation taken from answer by Phelype Oleinik -% in (\url{https://tex.stackexchange.com/a/497651/7832}). -% % \begin{macro}{\typestored,\@@_verb_print:N,\@@_xverb:w,verbatimsc} % The §\typestored§ commands fetches a buffer from memory, prints it % to the log file, and then calls \cs{@@_verb_print:N}. @@ -3070,6 +3175,7 @@ No tab } %</core> %<*loader> +%<*!context> \use:x { \cs_new_protected:Npn \exp_not:N \@@_xverb:w @@ -3078,17 +3184,15 @@ No tab %<plain> { ##1 \exp_not:N \endverbatimsc } %<context> { ##1 \exp_not:N \stopverbatimsc } } -%<*!context> +%</!context> +%<*latex> \NewDocumentEnvironment { verbatimsc } { } { -%<plain> \group_begin: -%<latex> \cs_set_eq:cN { @xverbatim } \@@_xverb: + \cs_set_eq:cN { @xverbatim } \@@_xverb: \verbatim } - { -%<plain> \group_end: - } -%</!context> + { } +%</latex> %<context>\definetyping[verbatimsc] %</loader> %<*core> @@ -3110,8 +3214,8 @@ No tab % % \begin{macro}{\@@_do_noligs:N} % \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 +% §\do@noligs§ which makes sure to not consume following space +% tokens. The \LaTeXe{} version ends with §\char`#1§, which % leaves \TeX{} still looking for an \mymeta{optional~space}. % This version uses \cs{char_generate:nn} to ensure that doesn't % happen. @@ -3137,7 +3241,7 @@ No tab % } % Shortcut definitions for common catcode changes. % The §^^L§ needs a special treatment in non-\LaTeX{} mode -% because in Plain\,\TeX{} it is an \cs{outer} token. +% because in Plain\,\TeX{} it is an §\outer§ token. % \begin{macrocode} \cs_new_protected:Npn \@@_set_active_eq:NN #1 { diff --git a/Master/texmf-dist/source/latex/scontents/scontents.ins b/Master/texmf-dist/source/latex/scontents/scontents.ins index 760aea29511..6c761fe6b04 100644 --- a/Master/texmf-dist/source/latex/scontents/scontents.ins +++ b/Master/texmf-dist/source/latex/scontents/scontents.ins @@ -33,11 +33,11 @@ and the derived files scontents.sty, \declarepreamble\context \string\module [ file=t-scontents, - version=1.6, + version=1.7, title=\string\CONTEXT\ User Module, subtitle=Storing Contents, author=Pablo González, - date=2019-10-26, + date=2019-10-29, copyright=Pablo González, email=pablgonz@educarchile.cl, license=LPPL] |