I use \VerbatimInput in package fancyvrb to wrap my text, which is loaded from external file. But when the external file is too large, it gives the following error:

TeX capacity exceeded, sorry [grouping levels=255].
<argument> ...

Is there any solution to increase the file size limit?

  • 1
    Welcome to TeX.SE. Just out of curiosity: How large is the external file? Second, what are you doing with file at the moment? Third, are you open to a LuaLaTeX-based solution?
    – Mico
    Aug 23, 2017 at 19:52
  • Thanks for reply. The file is just about 500 KB, with 200 lines. I want to present a debugging information in pdf, while keeping the format. Aug 23, 2017 at 21:25
  • Thanks for these additional pieces of information. (I must confess to feeling a bit baffled about how 200 lines of text can take up 500KB -- unless the lines are really, really long, I suppose.) If you're open to using LuaLaTeX, do take a look at the posting How to handle verbatim material in LuaLaTeX? With Lua(La)TeX, the only meaningful size constraint should be the amount of RAM on your system.
    – Mico
    Aug 23, 2017 at 21:29
  • Maybe you can convert the text file(s) to pdf in the terminal (unix.stackexchange.com/questions/17406/…) and then include the pdfs in your LaTeX document?
    – Marijn
    Aug 24, 2017 at 8:26
  • Thank you. It works by converting the text files to pdf. I use the following python code code.activestate.com/recipes/… Aug 24, 2017 at 19:38

1 Answer 1


I use the python code http://code.activestate.com/recipes/532908-text-to-pdf-converter-rewrite/ to convert the text to pdf. It works well for large text.

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