I'm using the package xsim for writing exercises. The exercises are stored in external files and when I use several files, the latex compilation is slow. It is at least 3-4 minutes.

The exercises are grouped by themes, so at the moment I don't want to split the files. They are mathematics exercices, but I don't thinks Tikz slow the compilation.

xsim writes body files during the compilation. In my case about 480 were written (240 for the exercises and 240 for the solutions). It seems to be the problem. With time I will complete my sets of exercices, but it won't be possible to take so much time to compile. At the beginning I comment out some external files, but at the end I have to include them all and to do the last modifications. Do you know an option to speed up the compilation ?

Another option would be to use another package. Does somebody have experience with other packages to build databases of exercises ? Perhaps exercisebank would be a solution.

  • For another possibility, see Using the datatool Package for Exams or Assignment Sheets. Jul 9, 2018 at 12:13
  • @NicolaTalbot (seeing as we don't have PM-possibilities here), I was wanting to ask if you'd bee up for collaborating on making a web-version of your datatool? Aug 18, 2018 at 10:10
  • @AndreasStorvikStrauman (datatool is a LaTeX package or did you mean datatooltk?) I'm sorry, I'm currently too busy to take on any major new projects. Aug 18, 2018 at 10:23
  • @NicolaTalbot I guess I mean datatooltk. I'm not thinking the exact same thing, but something that parses TeX-files and then gives another one. I haven't really thought this through yet. I'll get back to you, if this is something you would find interesting! Maybe perl instead of webbased? Idk. Aug 18, 2018 at 10:35
  • @AndreasStorvikStrauman If I have to parse TeX files, I use Java with the TeX parser library (which is used by datatooltk and bib2gls). TeX syntax can be too complicated for simple regular expressions. Aug 18, 2018 at 11:09

1 Answer 1


It is hard to know exactly what slows your code down, but as the author of exercisebank, I can tell you that it is much more light weight than xsim.

However, exercisebank also writes a temporary file that contains the body of problems and solutions as they are compiled. This, however, should not take too much time unless you're talking problems on a megabyte size-scale. When I looked at xsim, it had so many features I did not need, hence exercisebank was born!

As of now, exercisebank writes all problem and solution content to a temporary file, as mentioned. This is because the comment-package is the only nice package I found that could hide verbatim-environments such as listings. However, the futuristic plan is to push the file-writing to a minimum, so that you would send e.g. a fragile option to the environment.

I asked CTAN to add an example of use to the page so one could easily get started!

Exercisebank is explicitly designed to handle picking problems from collections, so that you can "mix-n-match" exercise sets.

I've (obviously) used it quite alot, and I've never experienced that it is particularly slow.

Hope it helps :)

note: if you do end up using exercisebank, please let me know how it performed on that many exercises! I'd love to improve on it, if it didn't perform very well. Also, there is a issue(/bug) tracker here where you are encouraged to report what doesn't work and request features :)

  • 1
    Finally I tried exercisebank. For the worst case, about four minutes were necessary to compile with xsim. With exercisebank it was a couple of seconds.
    – Luc Armand
    Jul 10, 2018 at 10:23
  • @LucArmand That's nice to hear! There is an upcoming version in July and I hope to have time to implement the new environment-hiding feature that should make it even faster :) Jul 10, 2018 at 10:50

You must log in to answer this question.

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