# Error-handling in next-generation TeX tools

For many beginners (and many with more experience), the biggest obstacle to using LaTeX is the difficulty of figuring out what is causing an error. A message about something not being \defed, for instance, will make no sense to a novice LaTeX user who might possibly have heard of \newcommand, but certainly not \def. Additionally, line numbers can be misleading, and error message sometimes print out macros given by internal definitions that bear no resemblance to the user's code that actually created the problem.

Is there any hope that next-generation TeX tools like LaTeX3, LuaTeX, and ConTeXt will provide (and/or force package authors to use) a better mechanism for handling errors?

For instance, would it be remotely feasible to include something remotely resembling "print stack trace"?

• This is a bit difficult to answer, as in part you are talking about TeX errors and probably mixing them in with ones from the macro level (LaTeX/ConTeXt). You might appreciate for example the efforts in xparse to give errors at the TeX level such that they 'hide' the internals. – Joseph Wright Feb 13 '14 at 20:39
• Incidentally, I am aware that LuaTeX is not directly comparable to LaTeX3 and ConTeXt, and is in fact compatible with either (and required for cutting-edge ConTeXt). My question is whether any of these tools, at any level, might possibly reform how errors are handled--ideally in a way that won't be negated by well-meaning package writers who put too much time into their package writing anyway and don't want to pour more time in to make errors less confusing. – Charles Staats Feb 13 '14 at 20:39
• At the moment I'm now aware of any work being done in the TeX core or the ConTeXt macro package that addresses the issues you mention. So I'm afraid the answer is “no”, at least not in the near future. Furthermore, it would (at least for TeX error) be something optional which requires to be turned on explicitly to not break backward compatibility. But frankly, I don't think this will happen any time soon. – Marco Feb 13 '14 at 20:42
• @CharlesStaats -- since the "thorniest" errors are usually the ones that come right out of the tex core, i think you have to assume that in many cases, the answer has to be "no"; the underlying tex software would have to be changed to make many error messages more scrutable. – barbara beeton Feb 13 '14 at 20:57
• @CharlesStaats There are many editors/IDEs that parse the stdout/logfile. Changing the output would not break the document itself but the workflow. This could be mitigated by including a command line switch --human-readable (disabled by default) for the new behaviour, then people would at least have a choice. But I don't think it will be an easy task to implement that. TeX operates on the lowest level and lacks certain information which is required for better error messages. – Marco Feb 13 '14 at 20:59