Reputation: 509
I have reproduced a simple example of an R Markdown presentation (PDF). I am trying to figure out the best way to change the color of inline code. Specifically, the first line is just for reference (format), the second line with \color
gives the output I want to achieve, however its specification seems a bit cumbersome to me, and the third line (which would be my preferred specification) with \textcolor
unfortunately gives the wrong formatting.
---
output:
beamer_presentation
---
---
- `code` and no color
- \color{red} `code` \color{black} and color
- \textcolor{red}{`code`} and wrong format
The current output is as follows:
Upvotes: 3
Views: 540
Reputation: 38793
You can't use markdown syntax like ` ... ` in the argument of a latex macro. However you can simplify the syntax of your second item by placing the colour change inside a group, this avoids the need to switch back to the normal font colour, which might not always be black
---
output:
beamer_presentation:
keep_tex: true
---
---
- `code`, and no color
- \begingroup\color{red}`code`\endgroup, and color
Upvotes: 3