Checking for errors in a latex document

347 views
Skip to first unread message

Gerry Wolff

unread,
Nov 8, 2010, 7:05:23 AM11/8/10
to LaTeX Users Group
Can anyone recommend a good user-friendly system for checking for
errors in a Latex document?

The document I am working on is not producing a DVI file, probably
because of an error in the source file.

The log file is impossible to understand.

There is probably a missing bracket or an extra bracket somewhere but
I have not found any easy way to check whether brackets are matching.
I am using WinEdt but I can't find anything to help check brackets in
that.

Any help would be much appreciated.


David Owen

unread,
Nov 8, 2010, 7:39:03 AM11/8/10
to latexus...@googlegroups.com
I also use Winedt and I have found that if the bracket is one which is "user put in" then it does not complain i.e.if you have $(X,Y,Z  where you forgot the end bracket ) ,Winedt does not complain. However, if the bracket is needed by Latex, then it complains, i.e. if you have : \section{Introduction     where you forgot to include the end bracket, } ,  then Winedt will complain.
Does this help?
D.O.



--
You received this message because you are subscribed to the Google Groups "LaTeX Users Group" group.
To post to this group, send email to latexus...@googlegroups.com.
To unsubscribe from this group, send email to latexusersgro...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/latexusersgroup?hl=en.


David Owen

unread,
Nov 8, 2010, 7:41:36 AM11/8/10
to latexus...@googlegroups.com
I also use Winedt and I have found that if the bracket is one which is "user put in" then it does not complain i.e.if you have $(X,Y,Z$  where you forgot the end bracket ) ,Winedt does not complain. However, if the bracket is needed by Latex, then it complains, i.e. if you have for example,  \section{Introduction     where you forgot to include the end bracket, } ,  then Winedt will complain.
Please ignore the first reply.
Does this help?
D.O.

On Mon, Nov 8, 2010 at 5:05 AM, Gerry Wolff <gerryw...@gmail.com> wrote:

James

unread,
Nov 8, 2010, 9:59:36 AM11/8/10
to latexus...@googlegroups.com
Sometimes I have found that the good old 'comment out half and see what
happens' is the worst-case method. In the end, you end up binary searching
for the problem. It is especially easy to do if you have included code from
separate files. In the master file, comment out half of the included files.
If it cleanly compiles, then the error is _probably_ in one of the files
that you just commented out. Uncomment half of them and try again. Keep
doing that until you have just one file left. Once you get it isolated to a
particular file, comment out half of it and repeat... If it cleanly
compiles, the problem is _probably_ in the half that was commented out.
Take that half, and comment out half of it, compile, ... Eventually, you'll
find the problem, unless it's a macro.

One particularly painful thing to find is an error in the macros that you've
created. That can lead the compiler to point to locations where the macro
is used and report some bizarre error occurring there, when in reality, the
error is in the definition of the macro, which is defined somewhere else
entirely.

For example, your macro could use a parenthesis when it should have used a
brace. Then, when you call it, the call will look ok, \mymacro{x}, but the
problem may be in the definition of \mymacro itself.

It sucks to have to do that, and its time consuming, but that always works
for me.

Good luck...
James

--------------------------------------------------
From: "Gerry Wolff" <gerryw...@gmail.com>
Sent: Monday, November 08, 2010 7:05 AM
To: "LaTeX Users Group" <latexus...@googlegroups.com>
Subject: [latexusersgroup] Checking for errors in a latex document

James

unread,
Nov 8, 2010, 10:14:18 AM11/8/10
to latexus...@googlegroups.com
One more thing... search the log file for these:

"Runaway argument?" - You either forgot a "{" or maybe have "(" or "["
instead of a "{", or maybe don't have a "}" or have a ")" or "]" instead.
If you have the latter, the

"Undefined control sequence". You either forgot to define this command
entirely, or have a typo in the command's name where it is defined, or where
it is used. *command names are case sensitive and you cannot have a number
in a command name: "mymacro" is ok but "mymacro1" is not. The second
results in weird things such as maybe a "Missing \begin{document}.

Hope that helps, too
James

--------------------------------------------------
From: "James" <james_mc...@hotmail.com>
Sent: Monday, November 08, 2010 9:59 AM
To: <latexus...@googlegroups.com>
Subject: Re: [latexusersgroup] Checking for errors in a latex document

Gerry Wolff

unread,
Nov 8, 2010, 10:55:11 AM11/8/10
to LaTeX Users Group
Thanks very much for both tips. I've tried commenting out sections of
the text and finally tracked down where the error is and corrected it.

Thanks again.

Gerry

On Nov 8, 3:14 pm, "James" <james_mcelhan...@hotmail.com> wrote:
> One more thing... search the log file for these:
>
> "Runaway argument?" - You either forgot a "{" or maybe have "(" or "["
> instead of a "{", or maybe don't have a "}" or have a ")" or "]" instead.
> If you have the latter, the
>
> "Undefined control sequence".  You either forgot to define this command
> entirely, or have a typo in the command's name where it is defined, or where
> it is used.  *command names are case sensitive and you cannot have a number
> in a command name: "mymacro" is ok but "mymacro1" is not.  The second
> results in weird things such as maybe a "Missing \begin{document}.
>
> Hope that helps, too
> James
>
> --------------------------------------------------
> From: "James" <james_mcelhan...@hotmail.com>
> > From: "Gerry Wolff" <gerrywolf...@gmail.com>

Peter Flynn

unread,
Nov 8, 2010, 1:38:37 PM11/8/10
to latexus...@googlegroups.com

To answer the original question, the only real syntax checker is LaTeX itself. Learning to read the log file is a valuable skill.

///Peter

On 8 Nov 2010 15:55, "Gerry Wolff" <gerryw...@gmail.com> wrote:

Thanks very much for both tips. I've tried commenting out sections of
the text and finally tracked down where the error is and corrected it.

Thanks again.

Gerry


On Nov 8, 3:14 pm, "James" <james_mcelhan...@hotmail.com> wrote:

> One more thing... search the log...

> From: "James" <james_mcelhan...@hotmail.com>

> Sent: Monday, November 08, 2010 9:59 AM
> To: <latexus...@googlegroups.com>

> Subject: Re: [l...

> > From: "Gerry Wolff" <gerrywolf...@gmail.com>

> > Sent: Monday, November 08, 2010 7:05 AM

> > To: "LaTeX Users Group" <latexusersgroup@googlegroup...

Reply all
Reply to author
Forward
0 new messages