Yesterday I posted a question "My attempt to local redefine a command is failing and not sure why" which I really knew the answer to. But I was thrown by the error message I was getting and after failing to figure out on my own what was going on posted a question here. Now this particular error message wasn't that cryptic. And, in retrospect, I should have recognized the error (particularly when defining my macro using \def....).

Nevertheless, there are many times I get errors which bare little resemblance to what's actually going on (such as missing \begin{document} or a complaint about not properly balanced expression even though they are perfectly balanced). Through years of practice, I usually know where to look for even very cryptic messages.

There are numerous posts on this site about debugging, such as How to debug an infinite loop in pdfLaTeX code, or How to go deep and debug the real error?, or How to best debug LaTeX?.

It seems that it would be nice to have consolidated some place a list of errors that may be misleading and suggestions of where to start looking for errors.

So, for example, last night my error was about my macro not matching it's definition. A helpful suggestion would have been to consider whether I passed the parameters correctly to the macro (##1 vs. #1).

Perhaps I should post this on meta instead? Not really sure.

  • 3
    My approach is different than what you propose. Rather than trying to "read the entrails" of LaTeX error messages, I prefer to recompile often, so that when an error arises, I know that it is confined to a small block of code (on which I focus). If I am forced to debug a monstrosity that I didn't develop, I basically comment everything out, and then begin uncommenting blocks and compiling until I hit an error. – Steven B. Segletes Sep 12 '13 at 15:12
  • @StevenB.Segletes Actually, that generally is my approach. – A.Ellett Sep 12 '13 at 15:14
  • Not sure it's possible at that level. I don't think for example the not matching its definition error is related to the ## in any particular way, a more common way to get that is \def\foo2{zzz}...\foo{...} The ## error just meant that you were not operating on the tokens that you intended to operate on and so basically you could get any Tex error, just depending on the code in question. – David Carlisle Sep 12 '13 at 16:09
  • Appendix B in The LaTeX Companion can be quite useful (now available as an ebook). See also Appendix F in the memoir manual. – jon Oct 18 '13 at 14:42

It seems that the suggestions made at "How to best debug LaTeX?" might fall into this category.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.