# "There's no line here to end" error when pages break at unfortunate locations

I'm recieving seemingly random `There's no line here to end` errors at different parts in my code. At first I thought they were truly random and that I had some weird configuration error somewhere, but after more thorough investigations I have found that the error occurs when a page break and an extra line break within a paragraph coincide.

For example, if I have a paragraph containing an `eqnarray*` environment, and the entire paragraph does not fit on the page (so that the page breaks in the middle of the paragraph, usually between a line of text and the `eqnarray*`), I get the error.

Does anyone have any idea why this happens?

• Avoid `eqnarray`, better use `align` of the `amsmath` package. You probably have misplaced \\ check if you really need this there. Perhaps show the relevant piece of code. Dec 9, 2011 at 7:51
• Have a look at Error message: There's no line here to end, and please tell us if that helped. We would close this question as a duplicate then. Dec 9, 2011 at 8:03
• do you have a blank line or `\` before the `eqnarray`? either of those is a bad idea. in fact, it's a bad idea before any display material; in math composition, for good style it is recommended that at least one text line appear at the top of a page before a display, to provide continuity for the reader. Dec 9, 2011 at 14:07

## 1 Answer

It turned out this wasn't at all related to any code I had in my actual document, but to a header definition I use in a package I've authored myself. If some fields where empty, some parts of the header ended up with two `\\` following directly on each other. The first page had `\maketitle` on it, and thus didn't print out the header area, so the error didn't occur until LaTeX tried to create the second page - completely unrelated to what was in the document at the pagebreak.

Lessons learned:

• When things go wrong at page breaks, don't only check the document itself - also check the header and footer definitions.

• When authoring your own packages, make sure they don't make any unrealistic assumptions, such as "the document author will always want a subtitle"...