0

I am writing text in RMarkdown that includes equations that I type in LaTeX. However, rather than including them on the same line within the text, it breaks the line and centres the equation. How can I write LaTeX equations on the same line within text in RMarkdown?

Here is an example of how I wrote my text in Rmd:

The slope of the least squares line is 1.4083\[\approx\]1.4. It is meaningful over the range \[x \in [113.082, 1262.274]\] where the regression line exists along the x-axis.

And here's an image of the result after knitting the Rmd file.

And here's an image of the result after knitting the Rmd file.

1 Answer 1

0

You are using the "display math mode". For the "inline math mode" use \( ... \) or $ ... $.

---
output:
  pdf_document: default
---

The slope of the least squares line is
\(1.4083\approx1.4\).
It is meaningful over the range
\(x \in [113.082, 1262.274]\)
where the regression line exists along the x-axis.

mwe

1

You must log in to answer this question.

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