From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 2 Sep 2019 13:46:59 +0900 Subject: Initial commit --- macros/latex/contrib/parselines/README | 22 + macros/latex/contrib/parselines/parselines.dtx | 634 +++++++++++++++++++++++++ macros/latex/contrib/parselines/parselines.ins | 86 ++++ macros/latex/contrib/parselines/parselines.pdf | Bin 0 -> 183717 bytes 4 files changed, 742 insertions(+) create mode 100644 macros/latex/contrib/parselines/README create mode 100644 macros/latex/contrib/parselines/parselines.dtx create mode 100644 macros/latex/contrib/parselines/parselines.ins create mode 100644 macros/latex/contrib/parselines/parselines.pdf (limited to 'macros/latex/contrib/parselines') diff --git a/macros/latex/contrib/parselines/README b/macros/latex/contrib/parselines/README new file mode 100644 index 0000000000..87576fc699 --- /dev/null +++ b/macros/latex/contrib/parselines/README @@ -0,0 +1,22 @@ +parselines + +This is a simple line parser. + +For files: \dofilebyline{filename} expands \do (a user macro with 1 parameter) +on each line of the given file, reading lines one after another with \read. + +For text: +\begin{parse lines}{\row: #1} + ... + ... +\end{parse lines} + +will add the number of the row before each line in the environment. + +Other funny things can be done (see the .pdf ;-)) + +(c) lppl - 2010 (FC) + + + + diff --git a/macros/latex/contrib/parselines/parselines.dtx b/macros/latex/contrib/parselines/parselines.dtx new file mode 100644 index 0000000000..47e1c8571d --- /dev/null +++ b/macros/latex/contrib/parselines/parselines.dtx @@ -0,0 +1,634 @@ +% \iffalse meta-comment +% parselines : 2011/02/19 v1.4 - parselines : a simple line parser for TeX] +% +% 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 +% +% This work consists of the main source file parselines.dtx +% and the derived files +% parselines.sty, parselines.pdf, parselines.ins +% +% Unpacking: +% (a) If parselines.ins is present: +% etex parselines.ins +% (b) Without parselines.ins: +% etex parselines.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{parselines.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (pdf)latex parselines.dtx +% Copyright (C) 2010 by Florent Chervet +%<*ignore> +\begingroup + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +% +%<*install> +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: 2011/02/19 v1.4 - parselines : a simple line parser for TeX} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +parselines : 2011/02/19 v1.4 - parselines : catch file between delimiters or tags + +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 + +This work consists of the main source file parselines.dtx +and the derived files + parselines.sty, parselines.pdf, parselines.ins + +parselines : a simple line parser for TeX +Copyright (C) 2010 by Florent Chervet + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{parselines.ins}{\from{parselines.dtx}{install}}% + \file{parselines.sty}{\from{parselines.dtx}{package}}% +} + +\askforoverwritefalse +\generate{% + \file{parselines.drv}{\from{parselines.dtx}{driver}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* parselines.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `parselines.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +% +%<*ignore> +\fi +% +%<*driver> +\edef\thisfile{\jobname} +\def\thisinfo{a simple line parser for TeX} +\def\thisdate{2011/02/19} +\def\thisversion{1.4} +\def\CTANbaseurl{http://www.ctan.org/tex-archive/macros/latex} +\def\CTANdisplay{CTAN:macros/latex} +\makeatletter\protected\def\CTANhref{\@ifstar\CTANhrefstar\CTANhrefnost}\makeatother +\newcommand*\CTANhrefstar[3][/contrib/]{\href{\CTANbaseurl#1#2}{#3}} +\newcommand*\CTANhrefnost[2][/contrib/]{\href{\CTANbaseurl#1#2}{\nolinkurl{\CTANdisplay#1#2}}} +\let\loadclass\LoadClass +\def\LoadClass#1{\loadclass[abstracton]{scrartcl}\let\scrmaketitle\maketitle\AtEndOfClass{\let\maketitle\scrmaketitle}} +{\makeatletter{\endlinechar`\^^J\obeyspaces + \gdef\ErrorUpdate#1=#2,{\@ifpackagelater{#1}{#2}{}{\let\CheckDate\errmessage\toks@\expandafter{\the\toks@ + \thisfile-documentation: updates required ! + package #1 must be later than #2 + to compile this documentation.}}}}% + \gdef\CheckDate#1{{\let\CheckDate\relax\toks@{}\@for\x:=\thisfile=\thisdate,#1\do{\expandafter\ErrorUpdate\x,}\CheckDate\expandafter{\the\toks@}}}} +\AtBeginDocument{\CheckDate{interfaces=2011/02/19,tabu=2011/02/19}} +\PassOptionsToPackage{svgnames}{xcolor} +\documentclass[a4paper,oneside]{ltxdoc} +\AtBeginDocument{\DeleteShortVerb{\|}} +\usepackage[latin1]{inputenc} +\usepackage[american]{babel} +\usepackage[T1]{fontenc} +\usepackage{ltxnew,etoolbox,geometry,graphicx,xcolor,needspace,ragged2e} % general tools +\usepackage{lmodern,bbding,hologo,relsize,moresize,manfnt,pifont,upgreek} % fonts +\usepackage[official]{eurosym} % font +\usepackage{xspace,tocloft,titlesec,fancyhdr,lastpage,enumitem,marginnote} % paragraphs & pages management +\usepackage{holtxdoc,bookmark,hypbmsec,enumitem-zref} % hyper-links +\usepackage{array,delarray,longtable,colortbl,multirow,makecell,booktabs} % tabulars +\usepackage{bbding,embedfile,framed,txfonts} +\usepackage[expansion=alltext,protrusion=alltext]{microtype} +\usepackage{interfaces}[2011/02/19] +\usepackage{tabu}[2012/02/19] +\csname endofdump\endcsname +\CodelineNumbered +\usepackage{fancyvrb}\fvset{gobble=1,listparameters={\topsep=0pt}} +\usepackage{parselines} +\lastlinefit999 +\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm} +\hypersetup{% + pdftitle={The parselines package}, + pdfsubject={a simple line parser for TeX}, + pdfauthor={Florent CHERVET}, + colorlinks,linkcolor=reflink, + pdfstartview={FitH}, + hyperindex=true, + pdfkeywords={tex, e-tex, latex, package, parselines, line parser,line parsing, lines, parser}, + bookmarksopen=true,bookmarksopenlevel=2} +\usepackage{bookmark} +\embedfile{\thisfile.dtx} +\begin{document} + \DocInput{\thisfile.dtx} +\end{document} +% +% \fi +% +% \CheckSum{217} +% +% \CharacterTable +% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z +% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z +% Digits \0\1\2\3\4\5\6\7\8\9 +% Exclamation \! Double quote \" Hash (number) \# +% Dollar \$ Percent \% Ampersand \& +% Acute accent \' Left paren \( Right paren \) +% Asterisk \* Plus \+ Comma \, +% Minus \- Point \. Solidus \/ +% Colon \: Semicolon \; Less than \< +% Equals \= Greater than \> Question mark \? +% Commercial at \@ Left bracket \[ Backslash \\ +% Right bracket \] Circumflex \^ Underscore \_ +% Grave accent \` Left brace \{ Vertical bar \| +% Right brace \} Tilde \~} +% +% \DoNotIndex{\begin,\CodelineIndex,\CodelineNumbered,\def,\DisableCrossrefs,\~,\@ifpackagelater,\z@,\@ne} +% \DoNotIndex{\DocInput,\documentclass,\EnableCrossrefs,\end,\GetFileInfo} +% \DoNotIndex{\NeedsTeXFormat,\OnlyDescription,\RecordChanges,\usepackage} +% \DoNotIndex{\ProvidesClass,\ProvidesPackage,\ProvidesFile,\RequirePackage} +% \DoNotIndex{\filename,\fileversion,\filedate,\let} +% \DoNotIndex{\@listctr,\@nameuse,\csname,\else,\endcsname,\expandafter} +% \DoNotIndex{\gdef,\global,\if,\item,\newcommand,\nobibliography,\newrobustcmd,\renewrobustcmd,\providerobustcmd} +% \DoNotIndex{\par,\providecommand,\relax,\renewcommand,\renewenvironment} +% \DoNotIndex{\stepcounter,\usecounter,\nocite,\fi} +% \DoNotIndex{\@fileswfalse,\@gobble,\@ifstar,\@unexpandable@protect} +% \DoNotIndex{\AtBeginDocument,\AtEndDocument,\begingroup,\endgroup} +% \DoNotIndex{\frenchspacing,\MessageBreak,\newif,\PackageWarningNoLine} +% \DoNotIndex{\protect,\string,\xdef,\ifx,\texttt,\@biblabel,\bibitem} +% \DoNotIndex{\z@,\wd,\wheremsg,\vrule,\voidb@x,\verb,\bibitem} +% \DoNotIndex{\FrameCommand,\MakeFramed,\FrameRestore,\hskip,\hfil,\hfill,\hsize,\hspace,\hss,\hbox,\hb@xt@,\endMakeFramed,\escapechar} +% \DoNotIndex{\do,\date,\if@tempswa,\@tempdima,\@tempboxa,\@tempswatrue,\@tempswafalse,\ifdefined,\ifhmode,\ifmmode,\cr} +% \DoNotIndex{\box,\author,\advance,\multiply,\Command,\outer,\next,\leavevmode,\kern,\title,\toks@,\trcg@where,\tt} +% \DoNotIndex{\the,\width,\star,\space,\section,\subsection,\textasteriskcentered,\textwidth} +% \DoNotIndex{\",\:,\@empty,\@for,\@gtempa,\@latex@error,\@namedef,\@nameuse,\@tempa,\@testopt,\@width,\\,\m@ne,\makeatletter,\makeatother} +% \DoNotIndex{\maketitle,\parindent,\setbox,\x,\kernel@ifnextchar} +% \DoNotIndex{\KVS@CommaComma,\KVS@CommaSpace,\KVS@EqualsSpace,\KVS@Equals,\KVS@Global,\KVS@SpaceEquals,\KVS@SpaceComma,\KVS@Comma} +% \DoNotIndex{\DefineShortVerb,\DeleteShortVerb,\UndefineShortVerb,\MakeShortVerb,\endinput} +% \makeatletter +% \newrobustcmd\ClearPage{\@ifstar\clearpage{}} +% \makeatletter +% \catcode`\§ \active \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}} +% \def\thispackage{\xpackage{{\pkgcolor\thisfile}}\xspace} +% \def\ThisPackage{\Xpackage{\thisfile}\xspace} +% \def\Xpackage{\@dblarg\X@package} +% \def\X@package[#1]#2{\@testopt{\X@@package{#1}{#2}}{}} +% \def\X@@package#1#2[#3]{\xpackage{#2\footnote{\noindent\xpackage{#2}: \CTANhref{#1}#3}}} +% \def\Underbrace#1_#2{$\underbrace{\vtop to2ex{}\hbox{#1}}_{\footnotesize\hbox{#2}}$} +% +% \parindent\z@\parskip.4\baselineskip\topsep\parskip\partopsep\z@\leftmargini=2.5cm +% \widowpenalty=5000\clubpenalty=8000 +% \DefineVerbatimEnvironment{VerbLines}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=txtt,fontseries=m} +% \DefineVerbatimEnvironment{VerbLines*}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=txtt,fontseries=m,commandchars=$()} +% \DefineVerbatimEnvironment{Verb}{Verbatim}{gobble=1,fontfamily=txtt,fontseries=m} +% \DefineVerbatimEnvironment{Verb*}{Verbatim}{gobble=1,fontfamily=txtt,fontseries=m,commandchars=$()} +% \def\smex{\leavevmode\hb@xt@2em{\hfil$\longrightarrow$\hfil}} +% \newrobustcmd\verbfont{\usefont{T1}{\ttdefault}{\f@series}{n}} \let\vb\verbfont +% \newrobustcmd\vbbf{\usefont{T1}{\ttdefault}bn} +% \renewrobustcmd\#[1]{{\usefont{T1}{pcr}{bx}{n}\char`\##1}} +% \newrobustcmd*\grabcs{\leavevmode\hbox\bgroup\bgroup\makeatletter\aftergroup\endgrabcs} +% \def\endgrabcs{\egroup\xspaceverb} +% \renewrobustcmd*\cs{\grabcs\cs@} +% \newrobustcmd\cs@[2][]{\begingroup\escapechar\m@ne\def\x ##1{\endgroup\@maybehyperlink{##1}{\texttt{#1{\@backslashchar##1}}}}\expandafter\x\expandafter{\string#2}\egroup} +% \newcommand*\cs@pdf[1]{\@backslashchar\if\@backslashchar\string#1 \else\string#1\fi} +% \newrobustcmd*\csbf{\cs[\textbf]} +% \newrobustcmd\csref[2][]{{\escapechar\m@ne\edef\my@tempa{\string#2}\edef\x ##1{\noexpand\hyperref{}{declcs}{\my@tempa}{\noexpand\cs[{##1}]{\my@tempa}}}\expandafter}\x{#1}} +% \newrobustcmd*\@maybehyperlink [2]{\ifcsname parselin@declcs.\detokenize{#1}\endcsname \hyperref{}{declcs}{#1}{#2}\else #2\fi} +% \csundef{parselin@declcs.begin} +% \newcommand\env{\texorpdfstring \env@ \env@pdf} +% \newcommand*\env@pdf[1]{#1} +% \newrobustcmd*\env@{\@ifstar {\env@starsw[environment]}{\env@starsw[]}} +% \new\def\env@starsw[#1]#2{\textt{#2}\ifblank{#1}{}{ #1}\Xspace} +% \newrobustcmd\CSbf[1]{\textbf{\CS{#1}}} +% \newrobustcmd\textttbf[1]{\textbf{\texttt{#1}}} +% \renewrobustcmd*\bf{\bfseries}\newcommand\nnn{\normalfont\mdseries\upshape}\newcommand\nbf{\normalfont\bfseries\upshape} +% \newrobustcmd*\blue{\color{blue}}\newcommand*\red{\color{dr}}\newcommand*\green{\color{green}}\newcommand\rred{\color{red}} +% \newrobustcmd\rrbf{\color{red}\bfseries} +% \newrobustcmd*\FC{{\color{copper}\usefont{T1}{fts}xn FC}} +% \colorlet{pkgcolor}{teal} \def\pkgcolor{\color{pkgcolor}} +% \definecolor{copper}{rgb}{0.67,0.33,0.00} \newcommand\copper{\color{copper}} +% \definecolor{dg}{rgb}{0.02,0.29,0.00} \newcommand\dg{\color{dg}} +% \definecolor{db}{rgb}{0,0,0.502} \newcommand\db{\color{db}} +% \definecolor{dr}{rgb}{0.75,0.00,0.00} \let\dr\red +% \definecolor{lk}{rgb}{0.2,0.2,0.2} \newrobustcmd\lk{\color{lk}} +% \newrobustcmd\bk{\color{black}}\newcommand\md{\mdseries} +% \newrobustcmd\ie{\emph{ie.}} +% \newrobustcmd\textt[2][]{\texttt{#1#2}} +% \newcommand\cellstrut{}\let\cellstrut\bottopstrut +% \def\M{\@ifstar{\M@i\@firstofone}{\M@i\meta}} +% \def\M@i#1{\@ifnextchar[\M@square +% {\ifx (\@let@token^^A) +% \expandafter\M@paren +% \else\ifx |\@let@token +% \expandafter\expandafter\expandafter\M@bar +% \else \expandafter\expandafter\expandafter\M@brace +% \fi\fi#1}} +% \def\M@square #1[#2]{\M@Bracket[{#1{#2}}]} +% \def\M@paren #1(#2){\M@Bracket({#1{#2}})} +% \def\M@bar #1|#2|{\M@Bracket\textbar{#1{#2}}\textbar} +% \def\M@brace #1#2{\M@Bracket\{{#1{#2}}\}} +% \def\M@Bracket#1#2#3{{\ttfamily#1#2#3}} +% \newrobustcmd*\thisyear{\begingroup +% \def\thisyear##1/##2\@nil{\endgroup +% \oldstylenums{##1\ifnum##1=\year\else\,\textendash\,\the\year\fi}% +% }\expandafter\thisyear\thisdate\@nil +% } +% \newrobustcmd*\csanchor[2][]{^^A +% \immediate\write\@mainaux{\csgdef{tabu@declcs.\string\detokenize{#2}}{}}^^A +% \raisedhyperdef[14pt]{declcs}{#2}{\cs[{#1}]{#2}}^^A +% } +% \renewrobustcmd\declcs[2][]{^^A +% \if@nobreak \par\nobreak +% \else \par\addvspace\parskip +% \Needspace{.08\textheight}\fi +% \changefont{size+=2.5pt,spread=1,fam=\ttdefault}^^A +% \def\*{\unskip\,\texttt{*}}\noindent +% \hskip-\leftmargini +% \begin{tabu}{|l|}\hline +% \expandafter\SpecialUsageIndex\csname #2\endcsname +% \csanchor[{#1}]{#2}} +% \renewcommand\enddeclcs{% +% \crcr \hline \end{tabu}\nobreak +% \par \nobreak \noindent +% \ignorespacesafterend +% } +% \def\declmargin{\hspace*\declmarginwidth } +% \def\declmarginwidth{\dimexpr -\leftmargini +\arrayrulewidth +\tabcolsep\relax} +% \pretocmd\textasteriskcentered{\usefont{OMS}{cmsy}mn}{}{} +% +% \pagesetup{% +% norules, +% left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm, +% font=\scriptsize,foot/font+=\lk, +% head/color=LightSteelBlue, +% head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight\thispackage\ -- \thisinfo, +% head/right=\lk\sffamily\thefirstmarks{section}, +% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC}}}}, +% foot/right=\oldstylenums{\arabic{page}} / \oldstylenums{\pageref{LastPage}}% +% } +% \pagesetup[plain]{% +% norules,font=\scriptsize, +% left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm, +% foot/font=\lk\scriptsize, +% foot/right=\oldstylenums{\arabic{page}} / \oldstylenums{\pageref{LastPage}}, +% foot/left=\vbox to\baselineskip{\vss{{\rotatebox[origin=l]{90}{\thispackage\,[rev.\thisversion]\,\copyright\,\thisyear\,\lower.4ex\hbox{\pkgcolor\NibRight}\,\FC\quad \xemail{florent.chervet at free.fr}}}}}, +% } +% \pagestyle{fancy} +% \sectionformat\section{mark=\marksthe{section}{#1},top-=12pt,bottom=2pt} +% \sectionformat\subsection{top=2pt,bottom=2pt} +% +% \newrobustcmd*\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.0,0.0,0.0} +% \def\macro@font{\def\Cr@scale{.87}\changefont{fam=pcrs,siz=10pt,ser=m,color=macrocode,spread=1}\let\AltMacroFont\macro@font} +% \def\MacroFont{\changefont{fam=pcrs,siz=10pt,ser=b,color=macrocode}} +% \newrobustcmd*\IMPLEMENTATION{% +% \hypersetup{bookmarksopenlevel=1} +% \section{Implementation} \label{sec:implementation}} +% \let\plainllap\llap +% \newrobustcmd\macro@llap[1]{{\global\let\llap\plainllap +% \setbox0=\hbox\bgroup \raisedhyperdef{macro}{\saved@macroname}{#1}\egroup +% \ifdim\wd0>40mm +% \hbox to\z@ \bgroup\hss \hbox to40mm{\unhcopy0\hss}\egroup +% \edef\@tempa{\hskip\dimexpr\the\wd0-40mm}\global\everypar\expandafter{\the\expandafter\everypar +% \@tempa \global\everypar{}}^^A +% \else \llap{\unhbox0}\fi}} +% \AtBeginEnvironment{macro}{\if@nobreak\else\Needspace{2\baselineskip}\fi +% \MacrocodeTopsep\z@skip \MacroTopsep\z@skip \parsep\z@ \topsep\z@ \itemsep\z@ \partopsep\z@ +% \let\llap\macro@llap} +% \AtEndEnvironment{macro}{\goodbreak\vskip.3\parskip} +% +% \newcommand\reflinkcolor{\color{reflink}}\colorlet{reflink}{DarkSlateBlue} +% \newrobustcmd*\stform{\ifincsname\else\expandafter\@stform\fi} +% \newrobustcmd*\@stform{\@ifnextchar*{\@@stform[]\textasteriskcentered\@gobble}\@@stform} +% \newrobustcmd*\@@stform[2][\string]{\textttbf{#1#2}\Xspace} +% \newrobustcmd*\xspaceverb{\ifnum\catcode`\ =\active\else\expandafter\xspace\fi} +% \new\let\Xspace \xspaceverb +% +% \makeatother +% +% \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em} +% +% \title{\vspace*{-28pt}\mdseries The {\bfseries\thispackage\footnotemark}\kern.6em package} +% \author{\small\thisdate~--~version \hyperref[\thisversion]\thisversion} +% \date{} +% \subtitle{\LARGE\thisinfo\endgraf {\small\FC}} +% \maketitle +% +% \makeatletter\begingroup\let\@thefnmark\@empty\let\@makefntext\@firstofone +% \footnotetext{\noindent\topsep=0pt\scriptsize +% This documentation is produced with the +DocStrip+ utility. +% \begin{tabbing} +% \qquad\=\smex\=To get the documentation, \= run (thrice):\quad\= \texttt{pdflatex \thisfile.dtx} \\ +% \qquad\>\>To get the index, \> run:\>\texttt{makeindex -s gind.ist \thisfile.idx} \\ +% \>\smex\>To get the package, \> run:\> \texttt{etex \thisfile.dtx} +% \end{tabbing}§ +% The \xext{dtx} file is embedded into this pdf file thank to \xpackage{embedfile} by H. Oberdiek.} +% \endgroup\makeatother +% +% \deffootnote{1em}{0pt}{\rlap{\thefootnotemark.}\kern1em} +% +% {\let\quotation\relax\vspace*{-1cm}% +% \begin{abstract}\parskip\medskipamount\parindent0pt\lastlinefit0\leftskip1cm\rightskip\leftskip +% +% \thispackage provides an environment ``\textt{parse lines}'' which applies a macro +% to each line of the input between \cs\begin\M*{{\dg parse lines}}\, and\, \cs\end\M*{{\dg parse lines}}. +% +% There is also a macro: \cs\dofilebyline: its purpose is to expand a user-defined macro \cs\do with +% one parameter (the line) on each line of a given text file. +% +% This packages requires \eTeX and no other package. +% +% \end{abstract} +% +% \tocsetup{ +% title/top-=6pt, +% title=Contents\quad{\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null}\kern0pt\vskip-6pt, +% bookmark={text=Contents,bold}, +% after=\leavevmode{\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null}, +% twocolumns, +% dot=$\scriptscriptstyle\ldotp$, +% dotsep=1mu, +% section/leaders,section/dotsep, +% section/skip=4pt plus2pt minus2pt, +% subsection/skip=0pt plus2pt minus2pt, +% } +% \tableofcontents +% \hypersetup{bookmarksopenlevel=2} +% +% \section{User interface} +% \label{userinterface} +% +% \bottomtitles=.3\textwidth \enlargethispage\baselineskip +% +% \subsection[The parse lines environment]{The \textttbf{parse lines} environment} +% +% {\smaller +% \begin{declcs}{begin}\M{\red parse lines}\M[initialisation]\M{replacement text of a macro with 1 parameter} \\ +% \cs{end}\M{\red parse lines} +% \end{declcs} +% } +% +% Example (with \xpackage{xcolor}) -- inside the environment \cs[\red]{row} expands to the current row number +% (stored in plain \TeX{} register \cs\count@): +% +% \begin{SaveVerbatim}[commandchars=$(),gobble=1]{myVerb} +% ($db(\definecolorseries)){serie}{rgb}{last}{Goldenrod}{DarkSeaGreen} +% ($db(\resetcolorseries))[3]{serie} +% \begin{($dg$underline(parse lines))}{($db(\color{serie!!+}``#1''\par))} +% This is a nice little package +% and I really don't know +% What to do with it ! +% May be tomorrow... +% \end{($dg$underline(parse lines))} +% \end{SaveVerbatim} +% +% \setbox1=\vbox{\hsize=.6\linewidth\UseVerbatim{myVerb}} +% +% \setbox0=\vbox{% +% \definecolorseries{serie}{rgb}{last}{Goldenrod}{DarkSeaGreen} +% \resetcolorseries[3]{serie} +% \begin{parse lines}{\color{serie!!+}``#1''\par} +% This is a nice little package +% and I really don't know +% What to do with it ! +% May be tomorrow... +% \end{parse lines} +% } +% +% \begin{tabu}{X[3]X}\savetabu{example} +% \copy1 & \copy0 +% \end{tabu} +% +% \definecolorseries{serie}{rgb}{last}{Fuchsia}{MidnightBlue} +% \resetcolorseries[3]{serie} +% \begin{SaveVerbatim}[commandchars=$(),gobble=1]{myVerb} +% \begin{($dg$underline(parse lines))}{($dr(\row)): #1\par} +% This is a nice little package +% and I really don't know +% What to do with it ! +% May be tomorrow... +% \end{($dg$underline(parse lines))} +% \end{SaveVerbatim} +% \setbox1=\vbox{\hsize=.6\linewidth\UseVerbatim{myVerb}} +% \setbox0=\vbox{% +% \count255=0 +% \begin{parse lines}{\color{serie!!+}\row: #1\par} +% This is a nice little package +% and I really don't know +% What to do with it ! +% May be tomorrow... +% \end{parse lines} +% } +% +% \begin{tabu}{\usetabu{example}} +% \copy1 & \copy0 +% \end{tabu} +% +% +% \subsection[\cs{dofilebyline}]{\csbf{dofilebyline}} +% +% \begin{declcs}[\red]{dofilebyline}\M{file-name} \\ +% \cs[\red]{dofilebyline}\stform*\M{file-name} +% \end{declcs} +% +% Expands the macro \csbf{do} on each line of a given file. +% +% Each line is read using the \TeX{} primitive \csbf{read}. By default, \cs\endlinechar is suppressed ({\vb\cs\endlinechar=-1}) +% in order not to add a space at the end of each line read. If you do not want this behaviour, use the \stform* star form. +% +% If the file does not exist, an error is displayed. +% +% +% Example: +% \begin{VerbLines} +% \def\do#1{\ifx\par#1\else \addto@hook\mytoken{#1}\fi}% +% \dofilebyline{file name.tex} +% \end{VerbLines} +% +% In this example: \cs\ifx\cs\par\#1\cs\else will evaluate to \texttt{false} if \#1 is empty. +% Therefore, empty lines and double empty lines (equivalent to \cs\par) are not captured into the token \cs\mytoken. +% +% +% +% \StopEventually{ +% } +% +% \IMPLEMENTATION +% +% \subsection{Identification} +% +% The package namespace is \textttbf{\db parselin@}. +% +% \begin{macrocode} +%<*package> +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) + [2005/12/01]% LaTeX must be 2005/12/01 or younger +\ProvidesPackage{parselines} + [2011/02/19 v1.4 - a simple line parser for TeX] +% \end{macrocode} +% +% \subsection{Collecting stuff inside an environment} +% +% \begin{macrocode} +\ifdefined\globtoks \globtoks\parselin@tk +\else \newtoks\parselin@tk +\fi +\newcommand\CollectEnvir{} +\protected\def\CollectEnvir#1{% + \gdef\parselin@Finish{#1% + \expandafter{\the\parselin@tk}% + \global\let\parselin@Finish\@undefined}% + \ifx\parselin@tk#1\else + \expandafter\def\expandafter\parselin@Finish + \expandafter{\parselin@Finish\parselin@tk{}}% + \if \relax + \expandafter\expandafter\expandafter\parselin@isatoken + \expandafter\meaning\expandafter#1\string\toks + \relax + \expandafter\gdef\expandafter\parselin@Finish + \expandafter{\expandafter\expandafter + \expandafter\def\expandafter\expandafter + \parselin@Finish}% + \fi\fi + \parselin@tk{}\def\parselin@stack{b}\parselin@Collect@Body +}% \CollectEnvir +\long\def\parselin@Collect@Body#1\end#2{% + \edef\parselin@stack{\parselin@PushBegins#1\begin\end + \expandafter\@gobble\parselin@stack}% + \ifx\parselin@stack\@empty + \global\parselin@tk\expandafter{\the\parselin@tk#1}% + \aftergroup\parselin@Finish + \end{#2}% + \else + \parselin@tk\expandafter{\the\parselin@tk#1\end#2}% + \expandafter\parselin@Collect@Body % recurse + \fi +}% \parselin@Collect@Body +\long\def\parselin@PushBegins#1\begin#2{% + \ifx\end#2\else b\expandafter\parselin@PushBegins\fi} +\expandafter\def\expandafter\parselin@isatoken + \expandafter#\expandafter1\string\toks#2\relax{\detokenize{#2}\relax}% +% \end{macrocode} +% +% +% \subsection{The \texorpdfstring{\textt{parse lines}}{parse lines} environment} +% +% \begin{macrocode} +\newenvironment{parse lines}[2][] +{% + #1% + \count@\z@\def\row{\number\count@}% + \def\parselin@ProcessLine##1{\advance\count@\@ne #2}% + \parselin@endlinechar{% + \def~##1~{% + \ifx\parselin@@@@@@##1\relax + \else \parselin@ProcessLine{##1}\expandafter~% + \fi}% + }% + \catcode\endlinechar\active + \CollectEnvir\parselin@tk +} +{% + \parselin@endlinechar{% + \parselin@tk\expandafter{\the\parselin@tk\parselin@@@@@@~}% + }\the\parselin@tk +}% +\long\def\parselin@endlinechar#1{\begingroup + \lccode`\~\endlinechar \lowercase{\endgroup#1}% +}% \parselin@endlinechar +\def\parselin@@@@@@{\parselin@@@@@@} +% \end{macrocode} +% +% \subsection{\cs{dofilebyline}} +% +% \begin{macrocode} +\newread\parselin@read +\protected\def\dofilebyline{\let\parselin@Finish\@empty + \@ifstar + \parselin@dobyline + {\edef\parselin@Finish{\endlinechar\the\endlinechar\relax}% + \endlinechar\m@ne + \parselin@dobyline}% +}% \dofilebyline +\protected\def\parselin@dobyline#1{% #1 = file name + \IfFileExists{#1} + \parselin@do@byline + {\PackageError{parselines} + {No file #1 found ! + \MessageBreak Your command \string\dobyline\space was ignored}\@eha + }% +}% \parselin@dobyline +\def\parselin@do@byline{% + \openin\parselin@read=\@filef@und% + \loop + \ifeof\parselin@read\else + \read\parselin@read to\@tempa + \expandafter\do\expandafter{\@tempa}% + \repeat + \parselin@Finish +}% \parselin@do@byline +% \end{macrocode} +% +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \sectionformat\subsection{font=\normalsize\bfseries,top=-.5\smallskipamount,bottom=-\smallskipamount} +% +% \begin{History} +% +% \begin{Version}{2011/02/19 v1.4}\HistLabel{1.4} +% \item Recompilation of the documentation to conform to \Xpackage{tabu} v2.5 and \Xpackage{interfaces} v3.1 +% \end{Version} +% +% \begin{Version}{2010/11/20 v1.3}\HistLabel{1.3} +% \item Replacement of \cs\newrobustcmd by \cs\protected\cs\def: +% \thispackage does not require \xpackage{etoolbox}... +% \end{Version} +% +% \begin{Version}{2010/11/16 v1.2}\HistLabel{1.2} +% \item Fix in CTAN archive (\xext{ins} file). +% \end{Version} +% +% \begin{Version}{2010/10/23 v1.1}\HistLabel{1.1} +% \item \cs\row counter added +% \item Improved documentation. +% \end{Version} +% +% \begin{Version}{2010/06/20 v1.0}\HistLabel{1.0} +% \item First version. +% \end{Version} +% +% \end{History} +% +% \PrintIndex +% +% \Finale \ No newline at end of file diff --git a/macros/latex/contrib/parselines/parselines.ins b/macros/latex/contrib/parselines/parselines.ins new file mode 100644 index 0000000000..bb12090022 --- /dev/null +++ b/macros/latex/contrib/parselines/parselines.ins @@ -0,0 +1,86 @@ +%% +%% This is file `parselines.ins', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% parselines.dtx (with options: `install') +%% +%% This is a generated file. +%% +%% parselines : 2011/02/19 v1.4 - parselines : catch file between delimiters or tags +%% +%% 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 +%% +%% This work consists of the main source file parselines.dtx +%% and the derived files +%% parselines.sty, parselines.pdf, parselines.ins +%% +%% parselines : a simple line parser for TeX +%% Copyright (C) 2010 by Florent Chervet +%% +\input docstrip.tex +\Msg{************************************************************************} +\Msg{* Installation} +\Msg{* Package: 2011/02/19 v1.4 - parselines : a simple line parser for TeX} +\Msg{************************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +parselines : 2011/02/19 v1.4 - parselines : catch file between delimiters or tags + +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 + +This work consists of the main source file parselines.dtx +and the derived files + parselines.sty, parselines.pdf, parselines.ins + +parselines : a simple line parser for TeX +Copyright (C) 2010 by Florent Chervet + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{parselines.ins}{\from{parselines.dtx}{install}}% + \file{parselines.sty}{\from{parselines.dtx}{package}}% +} + +\askforoverwritefalse +\generate{% + \file{parselines.drv}{\from{parselines.dtx}{driver}}% +} + +\obeyspaces +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* parselines.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `parselines.dtx'} +\Msg{* through LaTeX.} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +\endinput +%% +%% End of file `parselines.ins'. diff --git a/macros/latex/contrib/parselines/parselines.pdf b/macros/latex/contrib/parselines/parselines.pdf new file mode 100644 index 0000000000..5f080cbc34 Binary files /dev/null and b/macros/latex/contrib/parselines/parselines.pdf differ -- cgit v1.2.3