5

According to the description of catchfilebetweentags package command \ExecuteMetaData*[<file>]{tag} should do the same job as \ExecuteMetaData[<file>]{tag} but also ,,uncomment'' comment lines with single % at the beginning. File:

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

with the following file example.tex:

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

should produce output:

some text some more text

Unfortunately, in Texmaker it gives:

[example.tex]tag

while in Overleaf it compiles for 30 seconds and timeout error pops up. How can this be fixed?

2
  • Where I can take your [example.tex]tag?
    – Sebastiano
    Commented Mar 3, 2019 at 20:42
  • 1
    @Sebastiano, [example.tex]tag is precisely the output (one line with 16 characters - 13 letters, a full stop and square brackets). Is this what you mean in your question?
    – Tomasz23
    Commented Mar 3, 2019 at 21:33

1 Answer 1

4

Sorry, but there's no solution. Consider the example

\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}

The first \CatchFileBetweenTags starts with

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

whereas the second one has

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

and you can clearly see that something is wrong.

Worse: the definition of \ExecuteMetaData is

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

so there is no provision at all for distinguishing between \ExecuteMetaData and \ExecuteMetaData*.

Apparently the author documented his wishes about the package, but forgot to implement them.

2
  • Is there any way to achieve the desired result (catchfile which "uncomments" lines)? Shall I ask another question on the forum?
    – Tomasz23
    Commented Mar 4, 2019 at 11:47
  • @Tomasz23 Maybe a real use case would help.
    – egreg
    Commented Mar 4, 2019 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .