AnthonyC
AnthonyC

Reputation: 695

rmarkdown: new behaviour when knitting pdf documents

I tried to knit an old rmarkdown document to pdf recently. In the document, I had used the tilde symbol to denote a non-breaking space, e.g. 'Figure~2'. This syntax now seems to behave differently, now it prints 'Figure~2' verbatim, with the tilde printed in the document. There are many other differences, for instance % would once be interpreted as a comment, now it is printed.

I'm using Debian stretch with RStudio-1.2.1335. I can't find any documentation of this change in rmarkdown, pandoc or RStudio. Does anyone know what caused this change? Or how to revert to the old behaviour? Thanks.

Upvotes: 0

Views: 157

Answers (1)

Martin Schmelzer
Martin Schmelzer

Reputation: 23909

  1. The pandoc solution is to simply escape a space:

    This is a short\ sentence.

    Then a tilde will appear in the tex output.

  2. What might work as well is $nbsp;:

    This is a short sentence.

  3. And if you really like your TeX then use \protect{~}:

    This is a short\protect{~}sentence.

Upvotes: 2

Related Questions