Catchfilebetweentags não funciona

Catchfilebetweentags não funciona

De acordo com a descrição do catchfilebetweentagspacote, o comando \ExecuteMetaData*[<file>]{tag}deve fazer o mesmo trabalho, \ExecuteMetaData[<file>]{tag}mas também descomentar'' as linhas de comentário com single %no início. Arquivo:

\documentclass{article}
\usepackage{catchfilebetweentags}
\begin{document}
\ExecuteMetaData*[example.tex]{tag}
\end{document}

com o seguinte arquivo example.tex:

%<*tag>
some text 
%some more text
%</tag>

deve produzir saída:

algum texto mais um pouco de texto

Infelizmente, no Texmaker dá:

[exemplo.tex]tag

enquanto no Overleaf ele compila por 30 segundos e um erro de tempo limite aparece. Como isso pode ser consertado?

Responder1

Desculpe, mas não há solução. Considere o exemplo

\begin{filecontents*}{\jobname-example}
%<*tag>
some text 
%some more text
%</tag>

\end{filecontents*}

\documentclass{article}
\usepackage{catchfilebetweentags}

\begin{document}

\tracingmacros=1 % for debugging

\CatchFileBetweenTags{\foo}{\jobname-example.tex}{tag}\show\foo

\CatchFileBetweenTags*{\foo}{\jobname-example.tex}{tag}

%\ExecuteMetaData[\jobname-example.tex]{tag}

\end{document}

O primeiro \CatchFileBetweenTagscomeça com

\CatchFileBetweenTags #1#2#3->\CatchFileBetweenDelims \CatchFBT@tok {#2}{%<*#3>}{%</#3>}[\CatchFBT@sanitize ]\CatchFBT@Final {#1}
#1<-\foo 
#2<-\jobname -example.tex
#3<-tag

enquanto o segundo tem

\CatchFileBetweenTags #1#2#3->\CatchFileBetweenDelims \CatchFBT@tok {#2}{%<*#3>}{%</#3>}[\CatchFBT@sanitize ]\CatchFBT@Final {#1}
#1<-*
#2<-\foo 
#3<-\jobname -example.tex

e você pode ver claramente que algo está errado.

Pior: a definição de \ExecuteMetaDataé

% catchfilebetweentags.sty, line 53:
\newrobustcmd*\ExecuteMetaData[2][\jobname]{%
   \CatchFileBetweenTags\CatchFBT@tok{#1}{#2}%
   \global\expandafter\CatchFBT@tok\expandafter{%
            \expandafter}\the\CatchFBT@tok
}% \ExecuteMetaData

então aí estánenhuma provisãopara distinguir entre \ExecuteMetaDatae \ExecuteMetaData*.

Aparentemente o autor documentou seus desejos em relação ao pacote, mas esqueceu de implementá-los.

informação relacionada