% \iffalse meta-comment % catchfilebetweentags : 2011/02/19 v1.1 - catchfilebetweentags : 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 catchfilebetweentags.dtx % and the derived files % catchfilebetweentags.sty, catchfilebetweentags.pdf, catchfilebetweentags.ins % % Unpacking: % (a) If catchfilebetweentags.ins is present: % etex catchfilebetweentags.ins % (b) Without catchfilebetweentags.ins: % etex catchfilebetweentags.dtx % (c) If you insist on using LaTeX % latex \let\install=y\input{catchfilebetweentags.dtx} % (quote the arguments according to the demands of your shell) % % Documentation: % (pdf)latex catchfilebetweentags.dtx % Copyright (C) 2010-2011 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.1 - catchfilebetweentags : catch file between delimiters or tags} \Msg{************************************************************************} \keepsilent \askforoverwritefalse \let\MetaPrefix\relax \preamble This is a generated file. catchfilebetweentags : 2011/02/19 v1.1 - catchfilebetweentags : 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 catchfilebetweentags.dtx and the derived files catchfilebetweentags.sty, catchfilebetweentags.pdf, catchfilebetweentags.ins, catchfilebetweentags : catchfilebetweentags : a new dimen corresponding to the remainder of the line Copyright (C) 2010 by Florent Chervet \endpreamble \let\MetaPrefix\DoubleperCent \generate{% \file{catchfilebetweentags.ins}{\from{catchfilebetweentags.dtx}{install}}% \file{catchfilebetweentags.sty}{\from{catchfilebetweentags.dtx}{package}}% } \askforoverwritefalse \generate{% \file{catchfilebetweentags.drv}{\from{catchfilebetweentags.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{* catchfilebetweentags.sty} \Msg{*} \Msg{* To produce the documentation run the file `catchfilebetweentags.dtx'} \Msg{* through LaTeX.} \Msg{*} \Msg{* Happy TeXing!} \Msg{*} \Msg{************************************************************************} \endbatchfile % %<*ignore> \fi % %<*driver> \edef\thisfile{\jobname} \def\thisinfo{catch file between delimiters or tags} \def\thisdate{2011/02/19} \def\thisversion{1.1} \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} \PassOptionsToPackage{hyperfootnotes=true}{hyperref} \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,catchfile} \usepackage{interfaces} \usepackage{tabu} \csname endofdump\endcsname \CodelineNumbered \usepackage{fancyvrb} \usepackage{catchfilebetweentags} \lastlinefit999 \geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm} \hypersetup{% pdftitle={The catchfilebetweentags package}, pdfsubject={catch file between delimiters or tags}, pdfauthor={Florent CHERVET}, colorlinks,linkcolor=reflink, pdfstartview={FitH}, hyperindex=true, pdfkeywords={tex, e-tex, latex, package, catchfilebetweentags, catchfile, docstrip}, bookmarksopen=true,bookmarksopenlevel=2} \usepackage{bookmark} \embedfile{\thisfile.dtx} \begin{document} \DocInput{\thisfile.dtx} \end{document} % % \fi % % \CheckSum{191} % % \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 % \newrobustcmd*\FC{{\color{copper}\usefont{T1}{fts}xn FC}} % \catcode`\§ \active \def§{\@ifnextchar §{\par\nobreak\vskip-2\parskip}{\par\nobreak\vskip-\parskip}} % \def\pkgcolor{\color{teal}} % \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@ % \g@addto@macro\macro@font{\macrocodecolor\let\AltMacroFont\macro@font} % \g@addto@macro\@list@extra{\parsep\parskip\topsep\z@\itemsep\z@} % \DefineVerbatimEnvironment{VerbLines}{Verbatim}{gobble=1,frame=lines,framesep=6pt,fontfamily=txtt,fontseries=m} % \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 CatchFBT@declcs.\detokenize{#1}\endcsname \hyperref{}{declcs}{#1}{#2}\else #2\fi} % \csundef{CatchFBT@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} % \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{\ifnum##1=2010\else 2010\,\textendash\,\fi ##1}^^A % }\expandafter\thisyear\thisdate\@nil % } % \newrobustcmd*\csanchor[2][]{^^A % \immediate\write\@mainaux{\csgdef{CatchFBT@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} % \let\plainllap\llap % \newrobustcmd\macro@llap[1]{{\global\let\llap\plainllap % \setbox0=\hbox\bgroup \raisedhyperdef{macro}{\saved@macroname}{#1}\egroup % \ifdim\wd0>32mm % \hbox to\z@ \bgroup\hss \hbox to32mm{\unhcopy0\hss}\egroup % \edef\@tempa{\hskip\dimexpr\the\wd0-32mm}\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} % \newrobustcmd*\xspaceverb{\ifnum\catcode`\ =\active\else\expandafter\xspace\fi} % \new\let\Xspace \xspaceverb % \newrobustcmd*\stform{\ifincsname\else\expandafter\@stform\fi} % \newrobustcmd*\@stform{\@ifnextchar*{\@@stform[]\textasteriskcentered\@gobble}\@@stform} % \newrobustcmd*\@@stform[2][\string]{\textttbf{#1#2}\Xspace} % % \pagesetup{ % head/font=\color[gray]{.35}\footnotesize, % foot/font=\color[gray]{.35}\scriptsize, % head/color=LightSteelBlue, % left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm, % head/left=\moveleft1cm\vbox to\z@{\vss\setbox0=\null\ht0=\z@\wd0=\paperwidth\dp0=\headheight\rlap{\colorbox{GhostWhite}{\box0}}}\vskip-\headheight\thispackage\ -- \thisinfo, % 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]{ % foot/font=\color[gray]{.35}\scriptsize, % foot/right=\oldstylenums{\arabic{page}} / \oldstylenums{\pageref{LastPage}}, % left/offset=3cm,foot/left/offset+=.5cm,right/offset=1cm, % 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}}}}}, % } % % \newrobustcmd*\macrocodecolor{\color{macrocode}}\definecolor{macrocode}{rgb}{0.18,0.00,0.45} % \newrobustcmd*\IMPLEMENTATION{% % \hypersetup{bookmarksopenlevel=1} % \bookmarksetup{bold=true,italic=true} % ^^A\geometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=1.5cm} % \newgeometry{top=0pt,includeheadfoot,headheight=.6cm,headsep=.6cm,bottom=.6cm,footskip=.5cm,left=4cm,right=.5cm} % \pagesetup*{right/offset-=1cm} % \section{Implementation} \label{sec:implementation} % \bookmarksetup{bold=false,italic=false}} % % \colorlet{reflink}{CornflowerBlue!40!Indigo} % % \makeatother % % \deffootnote{1em}{0pt}{\rlap{\textsuperscript{\thefootnotemark}}\kern1em} % % \title{\vspace*{-28pt}\mdseries The {\bfseries\thispackage\footnotemark}\kern.6em package} % \author{\small\thisdate~--~\hyperref[\thisversion]{version \thisversion}} % \date{} % \subtitle{Catch a part of a file between two tags or delimiters.} % \maketitle % % \makeatletter\begingroup\let\@thefnmark\@empty\let\@makefntext\@firstofone % \footnotetext{\noindent % This documentation is produced with the \xpackage{DocStrip} utility.\par % \begin{tabu}{X[-3]X[-1]X} % \smex To get the package, &run: &\texttt{etex \thisfile.dtx} \\ % \smex To get the documentation &run (thrice): &\textt{pdflatex \thisfile.dtx} \\ % \leavevmode\hphantom\smex To get the index, &run: &\texttt{makeindex -s gind.ist \thisfile.idx} % \end{tabu}§ % 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} % \vspace*{-26pt} % {\let\quotation\relax\let\endquotation\relax % \begin{abstract}\parindent0pt\noindent\leftskip1cm\rightskip\leftskip\lastlinefit0\advance\linewidth by-2\leftskip % % \thispackage provides a macro \cs\CatchFileBetweenTags to capture the content of a file between two % docstrip tags, and a macro \cs\CatchFileBetweenDelims to capture between two strings (delimiters): % % {\noindent\tabulinesep=.5mm % \begin{tabu}{*2{X[c]}} % \rowfont{\large\scshape\db} % docstrip tags example & delimiters example \\[.5ex] % \cs\CatchFileBetweenTags & \cs\CatchFileBetweenDelims \\[.5ex] % \makecell[{{>{\ttfamily}c}}]{\dg\%<*meta> \kern2cm\cr % something \cr % to \cr % capture \cr % \dr\%\kern2cm} % & % \makecell[{{>{\ttfamily}c}}]{\dg \kern2cm\cr % something \cr % to \cr % capture \cr % \dr\kern2cm} \cr % \end{tabu} % } % % \bigskip % % Alternatively, it is possible to execute the content of a captured-part with \cs\ExecuteMetaData. % \medskip % % This packages requires \eTeX, and the \Xpackage[oberdiek/catchfile]{catchfile} package by H. Oberdiek. % % \end{abstract} % } % % \sectionformat\section{% % label=\arabic{section}\,\hbox{\color{teal}\small\HandRight},% % labelsep=.5em % } % \tocsetup{% % title=Contents\quad{\pkgcolor\leaders\vrule height3.4pt depth-3pt\hfill\null}, % title/bottom=0pt,% % twocolumns, % section/skip=4pt plus2pt minus2pt,% % subsection/skip=0pt plus2pt minus2pt, % section/leaders,section/dotsep,% % after=\noindent{\pkgcolor\hrule height3.4pt depth-3pt\relax}, % } % \tableofcontents % % \hypersetup{bookmarksopenlevel=2} % % \MakeShortVerb{\+} % % \bookmarksetup{bold=true} % \section{User interface} % \label{userinterface} % % \bookmarksetup{color*=copper} % \subsection[\cs{CatchFileBetweenTags}]{\cs[\copper]{CatchFileBetweenTags}} % % \begin{declcs}[\red]{CatchFileBetweenTags}\stform[\phantom]*\M{cs-name}\M{file-name}\M{tag}\\ % \cs[\red]{CatchFileBetweenTags}\stform*\M{cs-name}\M{file-name}\M{tag} % \end{declcs} % % This command will catch the file given its name \meta{file-name} and store the (first) part of this file % found between the two tags: % \begin{Verb}[commandchars=$(),fontseries=b] % %<*$meta(tag)> ($nnn and) % % \end{Verb} % % If there is no such tags, the result is empty. % % The capture is made inside \cs{makeatletter} ... \cs{makeatother}. % More precisely, the result is retokenized (under the current catcode regime) % with \string @ considered as a letter in all cases. % % The result is stored into either: % \begin{itemize} % \item if \meta{cs-name} is a token register: into this register % \item otherwise \meta{cs-name} will be defined or redefined as a parameterless macro containing the catched part. % \end{itemize} % % \def\interitem{\item[]\hskip-\leftmargin} % \textbf{Comments inside the catched-part of the file are ignored} unless:§ % \begin{enumerate}[label=\arabic*)] % \item This is a \textit{line-comment}: the first character on the line is \%, not followed by \% % \interitem \textbf{\color{red}and} % \item \cs{CatchFileBetweenTags}\stform* is used % \end{enumerate} % In this case, \textit{line-comments} are read as if they were not commented, \ie the first character \% is removed. % % Non line-comments are always ignored. % % \subsection[\cs{ExecuteMetaData}]{\cs[\copper]{ExecuteMetaData}} % % \begin{declcs}[\red]{ExecuteMetaData}\M[filename]\M{tag}\\ % \cs[\red]{ExecuteMetaData}\stform*\M[filename]\M{tag} % \end{declcs} % % This macro will capture the contents of the current (main) file (\ie \cs{jobname}) between the two tags: % \begin{Verb}[commandchars=$(),fontseries=b] % %<*tag> ($nnn and) % %\end{Verb} % % The captured code is immediately expanded. {\small(You may say for example: \cs\AtBeginDocument\cs\ExecuteMetaData).} % % This is a wrapper for: % \begin{Verb}[commandchars=$()] % \CatchFileBetweenTags\temptoken{\jobname}{meta} % \the\temptoken % \global\temptoken{} % \end{Verb} % % \cs{ExecuteMetaData}\stform* will keep the lines that begin with one (not two) \% character. % % Alternatively, it is possible to execute meta datas from an external file with:§ % \qquad \cs{ExecuteMetaData}\M[file]\M{tag} % % % \subsection[\cs{CatchFileBetweenDelims}]{\cs[\copper]{CatchFileBetweenDelims}} % % {\smaller % \begin{declcs}{CatchFileBetweenDelims}\M{cs-name}\M{file-name}\M{start-delimiter}\M{stop-delimiter}\\ % \hphantom{\cs\CatchFileBetweenTags\M{cs-name}\M{file-name}\M{start-delimiter}\qquad}\M[setup] % \end{declcs} % } % % This command will catch the file given its name \meta{file-name} and store the (first) part of this file % found between the two string delimiters \meta{start-delimiter} and \meta{stop-delimiter} into either: % \begin{itemize} % \item if \meta{cs-name} is a token register: into this register % \item otherwise \meta{cs-name} will be defined as a parameterless macro (a string) containing the catched part. % \end{itemize} % % The optional parameter \M[setup] may be used to change \cs{catcodes} or end-of-line characters before the \cs{input} of % \meta{file-name}. % % By default, \M[setup] is \cs{makeatletter}. % % \bookmarksetup{bold=false,color=black} % % \StopEventually{ % } % % \IMPLEMENTATION % % \subsection{Identification} % % The package namespace is \textttbf{\db CatchFBT@}. % % \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{catchfilebetweentags} [2011/02/19 v1.1 - Catch file between tags (FC)] % \end{macrocode} % % \subsection{Requirements} % % \begin{macrocode} \RequirePackage{etex,etoolbox,ltxcmds} \RequirePackage{catchfile} % \end{macrocode} % % \subsection{Some constants} % % \begin{macrocode} \globtoks\CatchFBT@tok % \end{macrocode} % % \subsection{User macros} % %\begin{macro}{\CatchFileBetweenDelims} \quad\\ % {\small\begin{tabular}{c@{\,=\,}l} % \#1 &store-cs \cr % \#2 &fname \cr % \#3 &start \cr % \#4 &end \cr % [\#5] &setup % \end{tabular}} % \begin{macrocode} \newrobustcmd*\CatchFileBetweenDelims[4]{% \begingroup \edef\CatchFileBetweenDelims{\endgroup \noexpand\@testopt {\CatchFBT@Work{\noexpand#1}{#2}{#3}{#4}} {\noexpand\makeatletter}% }\CatchFileBetweenDelims }% \CatchFileBetweenDelims % \end{macrocode} % \end{macro} % %\begin{macro}{\CatchFileBetweenTags} \quad\\ % {\small\begin{tabular}{c@{\,=\,}l} % \#1 &store-cs\cr % \#2 &fname\cr % \#3 &tag\cr % [\#4] &setup (for \cs{CatchFBT@Final}) % \end{tabular}} % \begin{macrocode} \newcommand\CatchFileBetweenTags{} \begingroup \@makeother\<% \@makeother\>% \@makeother\*% \catcode`\: 14% \@makeother\%: \gdef\CatchFileBetweenTags#1#2#3{: \CatchFileBetweenDelims\CatchFBT@tok{#2}{%<*#3>}{%}[\CatchFBT@sanitize]: \CatchFBT@Final{#1}: }:% \CatchFileBetweenTags \endgroup % \end{macrocode} %\end{macro} % % %\begin{macro}{\ExecuteMetaData} % \begin{macrocode} \newrobustcmd*\ExecuteMetaData[2][\jobname]{% \CatchFileBetweenTags\CatchFBT@tok{#1}{#2}% \global\expandafter\CatchFBT@tok\expandafter{% \expandafter}\the\CatchFBT@tok }% \ExecuteMetaData % \end{macrocode} % \end{macro} % % % \subsection{Implementation macros} % % \begin{macro}{\CatchFBT@Work} % {\small\begin{tabular}[t]{c@{\,=\,}l} % \#1 &store-cs\cr % \#2 &fname\cr % \#3 &start\cr % \#4 &end\cr % [\#5] &setup (optional)\cr % \end{tabular}} % \begin{macrocode} \long\protected\def\CatchFBT@Work#1#2#3#4[#5]{% \def\CatchFBT@setup{#5% \long\def\CatchFile@Do####1#3{\CatchFBT@catchthepart}% discard before start-delim \long\edef\CatchFBT@catchthepart####1#4{% capture until end-delim \CatchFBT@tok{\endgroup \CatchFBT@IsAToken#1 {\global\noexpand#1{####1}} {\xdef\noexpand#1{\noexpand\unexpanded{####1}}}}% \noexpand\CatchFBT@discardtherest}% \long\expandafter\def \expandafter\CatchFBT@discardtherest \expandafter####\expandafter1\CatchFile@EOF{}% \everyeof{#3#4}% \everyeof\expandafter\expandafter\expandafter{% \expandafter\the\expandafter\everyeof\CatchFile@EOF \expandafter\the\expandafter\CatchFBT@tok\noexpand}}% \CatchFileDef#1{#2}\CatchFBT@setup }% \CatchFBT@Work % \end{macrocode} % \end{macro} % %\begin{macro}{\CatchFBT@sanitize} \quad \thispackage special setup for \cs{CatchFileBetweenDelims}: % \begin{macrocode} \def\CatchFBT@sanitize{% \@sanitize \@makeother\{% \@makeother\}% \endlinechar=`\^^J% }% \CatchFBT@sanitize % \end{macrocode} %\end{macro} % %\begin{macro}{\CatchFBT@Final} retokenize under the current catcode regime (like standard \cs{input}): % \begin{macrocode} \newrobustcmd*\CatchFBT@Final[1]{\@testopt {\CatchFBT@Fin@l{#1}}{}% }% \CatchFBT@Final \def\CatchFBT@Fin@l#1[#2]{% \begingroup \endlinechar\m@ne \makeatletter #2% \scantokens\expandafter{% \expandafter\CatchFBT@tok\expandafter{\the\CatchFBT@tok}}% \CatchFBT@IsAToken{#1} {\global#1\expandafter{\the\CatchFBT@tok}} {\xdef#1{\the\CatchFBT@tok}}% \ifx\CatchFBT@tok#1\else\global\CatchFBT@tok{}\fi \endgroup }% \CatchFBT@Final % \end{macrocode} %\end{macro} % % \begin{macro}{\CatchFBT@IsAToken} \quad A helper macro to decide if the result should be stored as a token register or as a macro. % \begin{macrocode} \def\CatchFBT@IsAToken#1{% \expandafter\expandafter \expandafter\CatchFBT@Is@Token \expandafter\meaning\expandafter#1\string\toks \\\\{first}{second}\\\\% }% \CatchFBT@IsAToken \expandafter\def\expandafter\CatchFBT@Is@Token \expandafter#\expandafter1\string\toks#2#3\\#4#5#6\\\\{% \csname ltx@% \if\relax\detokenize{#1}\relax#5% \else second\fi oftwo% \endcsname }% \CatchFBT@Is@Token % \end{macrocode} % \end{macro} % % \begin{macrocode} % % \end{macrocode} % % \DeleteShortVerb{\+} % % ^^A\restoregeometry % % \begin{thebibliography}{9} % % \bibitem{docstrip} % \textit{The \xpackage{docstrip} program}; % 2009/09/25 v2.5d; % \CTAN{macros/latex/base/}. % % \bibitem{catchfile} % \textit{The \xpackage{catchfile} package}; % 2010/04/28 v1.5; Heiko Oberdiek. % \href{http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/catchfile.html}{CTAN:catchfile} % \end{thebibliography} % % \sectionformat\subsection{font=\normalsize\bfseries,top=0pt,bottom=0pt} % % \begin{History} % % \begin{Version}{2011/02/19 v1.1}\HistLabel{1.1} % \item Recompilation of the documentation after \Xpackage{tabu} v2.5 and \Xpackage{interfaces} v3.1 release. % \end{Version} % % \begin{Version}{2010/06/20 v1.0}\HistLabel{1.0} % \item First version. % \end{Version} % % \end{History} % % \PrintIndex % % \Finale