[Tex/LaTex] Display R code in Latex (with highlighted color)

coder

enter image description here

How can I type R syntax in Latex(with the color like green, blue, gray for text)? And also the symbol “`. Thank you

Best Answer

enter image description here

After I try listings package based on some previous answers, it turns out like this @@