What is the recommended way to track down brace mismatches in LaTeX? I have a large beamer
presentation, but this equally applies to any other LaTeX work I've done.
In other computer languages I've used pretty printers to highlight where things mismatch, but I can't seem to find a pretty printer for the LaTeX code itself rather than some other language inside in LaTeX.
My next thought is to start commenting out large sections of the source until the problem is pinned down.
What other strategies might be used?
Best Answer
The log file usually gives some help. For example if you start an environment without ending it then you get
which tells you where group started, if it doesn't tell you where it should have finished.
If you have mis-matched
{ }
pairs it depends whether they are being used for grouping or argument delimiting.In the former case you get
which tells you something is bad and if at the start of the document you put
you get in addition
which tells you where the
{
was.If it is argument matching ie you have
\textbf{
with no}
then you get:which gives you some context, but not a line number, although if you have the tracinggroups set as above it is easy to guess as you are told the last group that was entered or left before the error, in this case the log shows
so it isn't too hard to spot the error on line 16 as line 14 was OK and line 15 (in this case) was empty.