Question: I want to write something in an R Sweave document so that the following appears in the compiled PDF:

> 
> When you write "\beta" and compile the document, you see "β".
> 
> 
> 

However, when I escape the backslash for beta, I'm getting a line break, which is not desired.

How do I get "\beta" rather than a line break?

---

Example from file test.rnw:

```
\documentclass{article}

\begin{document}

When you write ``\\beta'' and compile the document, you see ``$\beta$''.

\end{document}

```

---

Result:

[![enter image description here](https://i.stack.imgur.com/kfchf.png)](https://i.stack.imgur.com/kfchf.png)

---

Setup:

Macbook Pro, R 4.1.0, RStudio 1.4.1717, rmarkdown 2.9, and some version of MacTex installed. RStudio is set to compile using knitr and pdflatex.

Answer: 
The double blackslash in text mode induces a linebreak (see [here](https://www.overleaf.com/learn/latex/Line_breaks_and_blank_spaces#Line_breaks) for a simple explanation).

You may use also `verb"\beta"` to better distinguish the Latex command from normal text.

```
When you write \verb"\beta" and compile the document, you see $\beta$.

```

[![enter image description here](https://i.stack.imgur.com/Qb7HY.png)](https://i.stack.imgur.com/Qb7HY.png)
Use `\textbackslash`

```
When you write ``\textbackslash beta'' and compile the document, you see ``$\beta$''.

```