In a letter-class document that had no previous errors I am suddenly getting the error message:

"There's no line here to end" \opening{text}

I've used this file many times and today it starts giving this error. How do I troubleshoot this?

  • 2
    Read the FAQ, in particular this. Oct 29, 2010 at 15:26
  • The error should have given you a line number corresponding to where that error occurred. Look there, and at the one or two lines above it. Is there a newline command ending a blank line? Oct 29, 2010 at 15:28
  • 2
    Did anything change between the last time you compiled it without errors and today? Did you change the file (if so, can you undo those changes to back it into working state)? Did you change packages or distributions? Oct 29, 2010 at 15:43
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – jub0bs
    Aug 13, 2014 at 16:07
  • I've just figured out that `\hphantom{something}\` triggers this error, too. Oct 23, 2015 at 13:39

8 Answers 8


Check for \newline or \\ commands and what comes before. For instance don't write \\\\ to get one further empty line. Possible reasons and solutions are given here in the UK TeX FAQ: No line here to end.

To complement this: sometimes you really wish to break a line but LaTeX doesn't allow it because you are in vertical mode. In such cases \leavevmode directly before \newline or \\ helps. Some people use a quick fix and insert some empty space like in ~\\ to repair that.

  • 3
    OK, I had an empty line above and below the opening. Taking those out fixed it.
    – Kent
    Oct 29, 2010 at 16:34
  • 7
    Why did you write the quick fix at the end of the answer? Gnarf. +1 anyhow ;)
    – k0pernikus
    Apr 22, 2013 at 14:32
  • 1
    The quick fix ~ added an unwanted empty space in my text. Replacing the ~ by \hglue0.001pt provided a quick fix without any actual extra space.
    – SDrolet
    Nov 29, 2015 at 15:50
  • I had a same problem with \linebreak. \leavevmode helped me. Thank you
    – EvgenyChem
    Nov 30, 2016 at 10:45
  • Do you have to remove the empty space above/below when you use the fixes: \leavevmode\` ? And between \leavevmode and \\ there is no space right? What about the other fixes, do you have to remove the space above/below for them?
    – jibo
    Apr 6, 2018 at 16:56

I have had exactly the same problem with one difference: the source file wasn't mine, I received it by email. It worked for the sender, but I got the "There's no line here to end" error associated with an \opening{} command in my machine.

Matching the code against a letter class intro in a blog, Geek Thoughts, I found a difference: the lacking of a second argument for \begin{letter}. Once provided, everything worked fine for me.

Hope it helps.

  • 6
    I replaced \begin{letter}{ } with \begin{letter}{~} and it works. Sep 4, 2015 at 14:33

Empty lines above and below the opening caused the error. Removing the empty lines solved it.


The error observed when using the 'centre' environment in the Title section of the poster (package baposter). Solution: put the title into the minipage environment.

  • 1
    It's hard to tell what you're suggesting here. Are you saying that you got the same error in another context, and solved it by using a minipage? If so, how do you know it will apply to this context? Post a MWE which you have compiled and shown to work in the questioner's situation, so your answer will be clearer. May 22, 2015 at 20:19

For me, none of the other answers so far worked. I was using the scrlttr2 class and it turned out that I had unused from*** parameters in the KOMAoptions command.

Probably, this produced empty lines being broken, thereby producing an error exactly at the \opening{...} line. Removing the unused from*** options did the trick for me.


Time and again I get this error after a \vspace , it might also be worth looking for them:

\vspace{1cm} \\\vspace{1cm}


Supplemental Answer

Stefan Kottwitz already mentioned looking for \\ or \newline. Here is a real-world example that took me awhile to track down. Let's say you have a template setup with some commands separated by new lines \\.

\fancyhead[LE,RO]{\insertvarA\\\insertvarB\vfill} % from fancyhdr package

If the value of \insertvarA is an empty string, then the following \\ will cause an error, because TeX will not switch to horizontal mode (it will stay in vertical mode).

Stefan's solution works. Just force TeX out of vertical mode regardless of \insertvarA's string.

\fancyhead[LE,RO]{\insertvarA\leavevmode\\\insertvarB\vfill} % from fancyhdr package

I had the same massage appearing, too.

In my case the problem was in the graphic files I included in the latex file. One can draw in Inkscape and then convert the pictures to latex files. This way whenever you write something between $ $ in the graphic file, it can be converted to latex type math text and included in the latex file as nice math pictures. The problem occurs if you add another paragraph in the text box in the Inkscape file. Then the conversion gets slightly wrong, i.e. after including it in a latex file and compiling it the picture will look correct, but the program will give you the error :

! Latex Error: There is no line here to end.

The problem is that the line indicated by the Latex compiler is nowhere near the picture that is causing the problems, so you have to find it on your own (I found it moving \end{document} up and down the latex file and checking the compilation messages). Deleting the paragraph in the text box in the graphic file solves the problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.