I would like to use a verbatim environment inside an ExecuteMetaData call from the catchfilebetweentags package.

The use case is that my econometric software creates a fixed-width table that I don't want to convert to a proper table, yet. I can wrap this fixed-width table in tags and send it to a log file. I would like to also wrap the table in verbatim so that the table is more legible, but when I add the verbatim environment I get a Runaway argument? error. I would like to use the catchfilebetweentags package so that I can avoid manually trimming the header and footer from each table (or counting line numbers).

Can I somehow combine fixed-width type with the catchfilebetweentags package?

Here's my MWE.



Where inner.tex is as follows.

col1    col2
1   2
3   4
  • 1
    You can put \ttfamily before the \ExecuteMetaData command, which will give the output in fixed width font. But unless the table data ends each line in '\\', it won't do the carriage return Jun 20, 2013 at 20:01
  • @StevenB.Segletes - Thanks. This might be my ultimate solution if verbatim won't work inside tags. I can't append `\` to each line inside my econometrics suite, but that should be easy enough to script. Jun 21, 2013 at 13:42

1 Answer 1


Instead of using the catchfilebetweentags package, I adapted my readarray package to do the trick, even using the tags that would otherwise be sought by catchfilebetweentags. It is able to handle multiple tables per input file, interspersed with whatever text (I think).

To handle the search for the % in the tag, I temporarily make $ the comment character. I don't think this screws things up, but it may if $ appears in your tabular data. In that case, you may wish to select a different replacement.

EDITED (12/2016) to remove reliance on the defunct internal readarray package command \record<romannumeral record index>.

\parindent 0in

  \if T\printit\def\printit{F}\else\def\printit{T}\fi%

\whiledo{\value{rcrd} < \nrecords}{$
  }{\if T\printit\MyArray[\arabic{rcrd}]~\\\fi}$
\catcode`\$=3 %




Back to normal text

And here is what I used for inner.tex. Note that it contains more than one table. When extracting the table, I place rules above and below it to set it off from the rest of the document.

this is
my document prior to
col1    col2
1   2
3   4
and my 
document after
the table
col3    col4
1   8
3   47
and $ then some more
some more

enter image description here

p.s It doesn't actually do verbatim, but just \ttfamily. If doing verbatim is essential, let me know, and I think I might be able to extend the solution.

You must log in to answer this question.

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