5

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"?

7
  • 1
    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, 2014 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. Feb 13, 2014 at 20:39
  • 2
    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, 2014 at 20:42
  • 3
    @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. Feb 13, 2014 at 20:57
  • 3
    @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, 2014 at 20:59

1 Answer 1

6

A different way of error handling has been on cards for ConTeXt for some time, but it is a low priority. In The History of LuaTeX, on page 82 Hans Hagen says

Other io related improvements involve debugging, error handling and logging. We can pop up helpers and debug screens (MkIV can produce xhtml output and then launch a browser). Users can choose more verbose logging of io and ask for log data to be for- matted in xml. These parts need some additional work, because in the end we will also reimplement and extend TEX's error handling.

Later on pg 175 (emphasis mine):

In parallel to writing this, I made a tracing feature for Oriental TEXer Idris so that he could trace what happened with the Arabic fonts that he is making. This was relatively easy because already in an early stage of MkIV some debugging mechanisms were built. One of its nice features is that on an error, or when one traces something, the results will be shown in a web browser. Unfortunately I have not enough time to explore such aspects in more detail, but at least it demonstrates that we can change some aspects of the traditional interaction with TEX in more radical ways.

I am pretty sure that I have seen the demo of this feature, but I cannot locate the source right now.

You must log in to answer this question.

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