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.
To break a line in R Markdown and have it appear in your output, use two trailing spaces and then hit return .
To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
TEXT IN R MARKDOWN You may start with the most basic word processing—simply typing your text below the YAML header section. If you want to start a new paragraph, you can simply hit Enter twice on your key- board, and begin writing again.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With