2

I tried to test the package catchfilebetweentags with the following minimal example, but get a compile error. What's wrong here and how to fix it?

Contents of catch_main.tex

\documentclass{article}%
\usepackage{catchfilebetweentags}

\usepackage{etoolbox}
\makeatletter
\patchcmd{\CatchFBT@Fin@l}{\endlinechar\m@ne}{}
  {}{\typeout{Unsuccessful patch!}}
\makeatother

\begin{document}
\ExecuteMetaData[inputfile]{mytag1}

\ExecuteMetaData[inputfile]{mytag1}


\ExecuteMetaData[inputfile]{mytag2}

\end{document} 

Contents of inputfile.tex

\documentclass{article}%

\begin{document}
Some text.
%<*mytag1>
This is the text for mytag1.
% </mytag1>

%<*mytag2>
This is the other text for mytag2.
% </mytag2>


\end{document} 

Compiler messages:

Running `LaTeX' on `catch_main' with ``pdflatex  -file-line-error   -interaction=nonstopmode "\input" catch_main.tex''
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2016/02/01>
Babel <3.9q> and hyphenation patterns for 81 language(s) loaded.
(./catch_main.tex (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
(/usr/share/texlive/texmf-dist/tex/latex/catchfilebetweentags/catchfilebetweentags.sty (/usr/share/texlive/texmf-dist/tex/latex/etex-pkg/etex.sty)
(/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/catchfile.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty))))
(./catch_main.aux) (./inputfile.tex)
Runaway text?
 This is the text for mytag1. \par This is the other text for mytag2.\ETC.
./catch_main.tex:11: File ended while scanning text of \CatchFBT@tok.
<inserted text> 
                }
l.11 \ExecuteMetaData[inputfile]{mytag1}

[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./catch_main.aux) )
(see the transcript file for additional information)</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on catch_main.pdf (1 page, 13823 bytes).
Transcript written on catch_main.log.

TeX Output exited abnormally with code 1 at Sat Jul 23 16:50:02
1

There is a syntax error in inputfile.tex. The end tag should not contain a space:

% </mytag1>%</mytag1>

Corrected version of inputfile.tex:

\documentclass{article}%

\begin{document}
Some text.
%<*mytag1>
This is the text for mytag1.
%</mytag1>

%<*mytag2>
This is the other text for mytag2.
%</mytag2>


\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.