Rmarkdown won't recognize latex line breaks in pdf

Viewed 3056

I am using rmarkdown to generate my homework which also involves including some equations in latex, but rmarkdown will not recognize line endings if I create a pdf file.

\[
Y = f(X) \\
X \in [0,1]
\]

If I specify the output as html, this will appear correctly as two lines, but when outputting to pdf, it will put the entire latex block on the same line. I have tried \newline and that still does not work.

2 Answers

You can do

\begin{align*}
Y = f(X) \\
X \in [0,1]
\end{align*}

This works for html and pdf.

Maybe give the following a try:

\begin{aligned}
 Y = f(x) \\
 X \in [0,1]
\end{aligned} 
Related