# Line break character in equation code

Equations are sometimes part of the text, for example in

\documentclass{article}
\begin{document}
The Pythagorean theorem is often stated as the equation
$a^2 + b^2 = c^2 .$
\end{document}
.


As you can see, I like to put the punctuation marks on a new line, to separate it from the equation. Now lacheck, invoked by the Syntastic plugin of vim gives the following error message [sic]:

Whitespace before punctation mark

I know, that lacheck is not the best guide.

So is there anything wrong with adding line breaks in equations to structure the source code and particularly in front of punctuation marks?

• Since spaces are ignored in math mode, there is no difference in having the period next to the equation or in a line below it (provided no blank line appears, of course). If lacheck complains, change it. – egreg May 30 '16 at 10:29

From the manpage of lacheck:

BUGS
LaCheck gets confused by advanced macros, is fooled by simple macros, can't figure out if you use a non-standard way to switch italic on or off, does not like TeX at all, does not provide any options to turn off specific warnings, and is at best a crude approximation.

There's no difference, as far as TeX is concerned, between

$a^2 + b^2 = c^2.$


and

$a^2 + b^2 = c^2 .$


because TeX ignores spaces in math mode and the end of line is converted to a space token.

In my opinion the program should turn off warnings about punctuation in math mode, but, as the manpage says, there is no way the user can modify the program's behavior.

So, if you want to use lacheck, don't use that way of laying out the source code. Otherwise, you have to live with the spurious warning.

• Thanks, this is exactly what I wanted to know. Also I just found chktex as an alternative, which gives more control over warnings. – bodo May 30 '16 at 10:56