Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

r-markdown: German quotation marks break bold text in HTML document

Tags:

When German quotation marks („ and “ or HTML code „ and “, see https://unicode-table.com/de/201E/ and https://unicode-table.com/de/201C/) are in between bold text markers **...**, then pandoc does not render the text bold when I knit in RStudio. Even worse, the **s are printed verbatim in the HTML document.

Example:

---
output: html_document
lang: de
---

This is a **„Test“**.

Another **„Test“**.

This **"just works"**.

Result:

German quotation marks break the bold text

Are there any pandoc options or workarounds for solving this problem?

Note that a similar question was answered for PDF output in r-markdown: German quotation marks. But I need HTML output.

like image 528
sgrubsmyon Avatar asked Oct 01 '18 22:10

sgrubsmyon


People also ask

How do you produce bold text in R Markdown?

To make the formatted text into bold type, you can simply use a pair of ** around the marked up text with no space. For example **bold** in the . Rmd file generates bold in the output document.

How do you add quotation marks in Markdown?

The correct way to write quotes in Markdown is to just write quotes literally, i.e., use " " . They will be converted to the correct LaTeX code (i.e., `` '' ) when Markdown is converted to LaTeX (via Pandoc). The same thing applies to single quotes.

How do you bold and italicize in R?

Italic, bold, and headersTo write text in italic font, use a single underscore or asterix before and after the text. To write text in bold font, use a double asterix or underscores before and after the text.

How do you underline text in R Markdown?

If you really want to underline text you can use <span style="text-decoration:underline">underline this text</span> for HTML output or $\text{\underline{This sentence underlined using \LaTeX}}$ for pdf output.


1 Answers

The issue tracking input of localized quotes is https://github.com/jgm/pandoc/issues/661.

Meanwhile, I recommend using non-typographic quotes (") and for HTML-output use the --html-q-tags option and some CSS, like:

q {
  quotes: '„' '“';
}
like image 83
mb21 Avatar answered Nov 11 '22 05:11

mb21