How can I define the color for the \listings package to display R code in Latex to get the result exactly like in the R Studio platform (example like in the figure)?
[Tex/LaTex] Insert R code in Latex
r
Related Question
- [Tex/LaTex] the best way to include R code in the Latex paragraph
- [Tex/LaTex] R-code linebreaks AND themes in knitr
- [Tex/LaTex] Running R code from latex. (alternative to knitr)
- [Tex/LaTex] Display R code in Latex (with highlighted color)
- [Tex/LaTex] colour R code to match knitr theme using listings, minted, or other
Best Answer
I'm not going to find every possible case of how R studio styles code. But maybe this will get you started.
It may be easier to simply define a new language (or variant) that contains exactly what you want based off of
listings
's definition which is in lstlang3.sty. The definition for R is this.I suspect you don't want most of those keywords.