0

at the moment I get a pretty simple tex error, but I don't know how to handle it: the following code (an excerpt of a larger thing but with the same error) gives me those three errors:

6: LaTeX Error: There's no line here to end. [\end{frame}]  
6: Missing $ inserted. [\end{frame}]  
6: Missing $ inserted. [\end{frame}]

Here is the code, I really don't know what is wrong:

\documentclass{beamer}
\begin{document}
\begin{frame}
  $\langle\alpha v_1,\beta v_2\rangle=\alpha\beta-\alpha\beta=0\\
  \langle\alpha v_1,\beta v_4\rangle=\alpha\beta-\alpha\beta=0$
\end{frame}
\end{document}

Edit: it works if I replace \\ with \newline - but shouldn't \\ also work?

Thanks in advance!

4
  • 2
    No, you can't use \\ in inline math. Use align instead.
    – schtandard
    Jan 13, 2020 at 12:24
  • @schtandard align would be better but this is beamer specific, try the above in article class (with no frame) Jan 13, 2020 at 14:42
  • It is not clear what you like to obtain: in-line equations in two lines or displayed equations in two lines. In the second case is better to use gather environment from the amsmath package and not relay on beamer specific: \documentclass{beamer} \usepackage{amsmath} \begin{document} \begin{frame} \begin{gather} \langle\alpha v_1,\beta v_2\rangle=\alpha\beta-\alpha\beta=0 \\ \langle\alpha v_1,\beta v_4\rangle=\alpha\beta-\alpha\beta=0 \end{gather} \end{frame} \end{document}
    – Zarko
    Jan 13, 2020 at 16:05
  • the first thing, so just a linebreak within a simple math environment Jan 13, 2020 at 16:34

1 Answer 1

1

It's working with replacing \\ with \newline, so my problem is solved. The other option is with two separate math environments, credit to Zarko:

\documentclass{beamer}
\begin{document}
\begin{frame}
$\langle\alpha v_1,\beta v_2\rangle=\alpha\beta-\alpha\beta=0$\\
$\langle\alpha v_1,\beta v_4\rangle=\alpha\beta-\alpha\beta=0$
\end{frame}
\end{document}

Thanks!

3
  • I really doubt in "my problem is solved". At least this is bad practice. I will never do this. Rather write two separate in-line equation (if this is demand) , each in own text line.
    – Zarko
    Jan 13, 2020 at 16:53
  • well, for me the most important thing was to have the problem solved. that's why after I found a working fix after even more testing I posted it here - despite it not being the sexiest way. but I added your idea as well, as you can see. Jan 13, 2020 at 17:01
  • All is up to you. However, this is not an answer. This possibilities ayou already noted in your question (I didn't down vote it)
    – Zarko
    Jan 13, 2020 at 17:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .