ozanj / rclass

4 stars 3 forks source link

investigate whether possible to add grey background to `inline code` #3

Closed ozanj closed 5 years ago

ozanj commented 5 years ago

When typing text in .Rmd file [not in a code chunk] the text enclosed in single back ticks `` is formatted as code.

When creating an html_document in RMarkdown, inline code is given a grey background [and typewriter font] once the document is knit.

however, when creating a beamer_presentation (or pdf document), inline code is not given a grey background. instead it is just given typewriter font.

to get over this problem, I created a simple latex command \hlgc{} to give grey background. for several reasons, I don't won't to use this function anymore. rather, I just want to use backticks ``. My question is whether it is possible to write/modify some function such that code in back ticks is given typewriter font AND grey background? @cyouh95 @mpatricia01

mpatricia01 commented 5 years ago

Hi Ozan,

I've been trying to figure this out for hours and no luck. It also took me a while because I was receiving errors when I tried to knit to pdf when using latex code in file.

cyouh95 commented 5 years ago

Perhaps we could redefine the \texttt command:

\let\OldTexttt\texttt
\renewcommand{\texttt}[1]{\OldTexttt{\hlg{#1}}}