tags:

views:

1243

answers:

5

I'm using Lyx to produce a Latex document, and when i try to convert to pdf, it complains of the error: "there's no line to end", and description is "//".

My Latex document is like 200 lines without many line breaks. How am I supposed to debug this and get this darned pdf converted. I literally am stuck on this for hours, can't submit this pdf. And for 90% of the time while writing this document, the convert to pdf works fine, I don't know know since what point did it start to fail.

Someone give me a quick way to get rid of this error? Otherwise this Latex document is useless.

Thanks.

+1  A: 

Dear Saobi, please post the offending line. Probably you have a "\" in a single-line math environment. If you post the code for the complete environment, I can try to indicate how to prevent this error.

Martijn
+1  A: 

IMO this is the problem with LyX; when things go wrong it's hard to know where to look to fix the problem. This is a minimal document that shows an example of the error:

\documentclass{article}
\begin{document}
\\ there
\end{document}

I suggest exporting your LyX document to LaTeX, then compiling it "by hand" (with pdflatex mydoc or whatever) and see where in the document the error is appearing. You should then be able to correlate it with some misbehaving piece of the LyX document.

Will Robertson
A: 

Do a binary search. Delete half the document, if it compiles then the problem was in the part you deleted. If not, then it's in the half you kept. Repeat the procedure on the offending portion and you should soon find which line is causing it.

Artelius
+1  A: 

My approach for locating compilation errors in LaTeX documents is based on a binary search approach. I suppose that a similar approach can be used in LyX.

The key idea is to divide your document in two parts of approximately the same size. At the boundary between these two parts a line containing \end{document} is inserted. If the document now can compile with no problems, the problem were located in the second half part of the document (otherwise it were in the first half part).

\documentclass{article}
\begin{document}
% First half part of the document
\section{Hello}

% Location for inserting \end{document}

% Second half part of the document
% in which the error is located
\section{World
\end{document}
midtiby
You could also just read the line number off the error message
Martijn
+1  A: 

That may sound stupid, but sometimes Latex needs a sign before the \, therefore:

~\\

That very much depends on the distribution you chose. LyX btw. is kind of crazy, when it comes to LaTeX export. Try auctex if you've got a month or two to spare ;)

wishi
In cases like this you shouldn't be using `\\` to add extra vertical space; use \vspace or \bigskip or similar.
Will Robertson