I want to learn debugging of long LaTeX equations like below:

```
$\tau=\int\frac{dt}{\gamma} = \int\sqrt{1-\frac{v(t)^2}{c^2}}dt = \int\sqrt{1-\frac{1}{c^2}\left(\left(\frac{dx}{dt}\right)^2+\left(\frac{dy}{dt}\right)^2+\left(\frac{dz}{dt}\right)^2 \right) dt$
```

I have tried to find LaTeX -debugger in places such as iPad's MathBot but MathJax is pretty much the best tool as you can see below and particularly this script here but the tool is only for ready outputs, I press it and it will display in red if something wrong. I would be very happy if I found some tool that put my equation to red in points where I may have error, does such debugging TeX -tool exist?

**Perhaps useful to readers**

## Best Answer

Similar to what I wrote in Help me to write Long LaTeX equations fast with colours and possibly with other aids, and what others have wrote here, the only way to debug these really is to break them down and re write them in a clearer manner.

I don't think there is going to be

onegeneric method that will work for all types of problem. But for this specific case, the equation as is yields the following message:This particular error usually means that the curly braces are not matched. So the next thing I do is to use a feature that I think is available in most LaTeX Editors/IDEs (I know it is in TeXShop and TeXworks), and click on the opening curly brace to get to locate the matching closing curly brace.

So, the first one matches, and so do the next few:

Once you get to the

`\sqrt`

after the third equal sign, you find that there is no matching closing brace:So that tells you where the problem is. Adding the closing brace fixes the syntax, and you are done with the debugging:

So, all that is now left are the cosmetic aspects. The integral sign seems rather small. So you can either load the

`bigints`

package as per Big integral sign, but I found the results better with`\mathlarger`

.## Notes:

`(t)`

, but I left them as is.Then, adding some new lines and spacing the code to make it more readable we have:

If you are typing these types of equations often, you might want to consider defining macro such as the

`\D{}`

below to make your code even more readable and easier to debug. Furthermore, the`d`

in`dt`

should be upright. So with those changes you get: