0

Unfortunately I didn't find any helpful question that already exists, so I need to open a new one on my problem.

I have two main documents I use. One is the main.tex with the entire thesis, and one is the SingleChapter.tex where I use single chapters for faster PDF creation. The files look pretty similar with both of them having some (working) header and settings part, and lots of included chapter.tex files.

When using the SingleChapter file everything works fine, but when using the main.tex I get the "no line here to end" error on

\chapter{Chaptername}
\include{./Chapter/Chaptername.tex}

Also, with commenting these two lines out the same error occurs in the same lines.

I don't get it.

Can you please help me?

Thanks a lot! :)

  • 1
    Put the chapter command inside the include file, or don't use include but \input. – Ulrike Fischer Mar 25 '19 at 12:07
  • 2
    it will not generate the error that you state but almost always the \chapter heading should be inside the included file otherwise you get a forced page break after the heading. The error is telling you of a bad use of \\ but unless you show your code it is not possible to say what you have done wrong. – David Carlisle Mar 25 '19 at 12:08
  • 1
    also never use the explicit .tex extension with include just use \include{./Chapter/Chaptername} – David Carlisle Mar 25 '19 at 12:09
  • Hi Guys,Thanks for the quick response. I will check that, and swap the include by inputs and throw away the .tex's and report if the error still occurs. – user184234 Mar 25 '19 at 13:29
  • It's really better to put the \chapter line in the included file; leave it in the main file but comment it out -- that will allow you to take advantage of \includeonly. That said, the error is probably being reported for the line just previous to the \chapter line -- and that means it's quite possibly in another file. – barbara beeton Mar 25 '19 at 13:57
  • Hi, now I'm using the \input{Chapter} without the explicit .tex extension. But still I get the errors while producing the .pdf file. The error now also occurs on a line, that is commented out , with several li nes above and below also being commented out. – user184234 Mar 25 '19 at 15:39
  • Some errors in TeX are only reported a few lines after the initial cause of the error. Several \included subfiles can make it even harder to find the culprit because the line number may not refer to the main file, but rather to an included file. It would be great if you could try to isolate the source of the error. A good way to do that is the binary search method described in https://tex.meta.stackexchange.com/q/228/35864 and https://www.codelord.net/2012/04/10/using-binary-search-for-debugging/. If you can show us code that reproduces the error you are much more likely to get a good answer – moewe Mar 25 '19 at 16:08
  • ... The message no line here to end often occurs when people use \\ extensively in the text to end lines or paragraphs. In normal text one should usually not have to use \\. Paragraphs are ended with a blank line or \par. \\ should be used almost exclusively in tables and tabular/array-like structures and in math mode. See https://tex.stackexchange.com/q/4690/35864 – moewe Mar 25 '19 at 16:11

0 Answers0