Reputation: 6755
I'm trying to knit a document that has an equation in it and I would like the equation to respect linebreaks. This works fine when I knit to HTML but does not when I knit to pdf.
$$
x_1 - ? +\\
x_2 - ? +\\
x_3 - ? +\\
$$
I've also tried \newline
and even \hfill \break
. I also tried the different latex engines listed on the RMarkdown cheat sheet at RStudio.
Upvotes: 19
Views: 15993
Reputation: 10352
Use Latex
code:
\begin{aligned}
x_1 - ? + \\
x_2 - ? + \\
x_3 - ? +
\end{aligned}
If you do not want a numbered equation, use
\begin{aligned}
x_1 - ? + \nonumber \\
x_2 - ? + \nonumber \\
x_3 - ? + \nonumber
\end{aligned}
This works in HTML and PDF.
Upvotes: 18