2

Back when I was using sweave, I could make my inline code look like R code by using \texttt{whatever} or \verb@whatever@. I am trying out knitr, and the format of the code chunks sure is pretty. But how do I get the format of the inline code to match the code chunks? Mostly I want to say things like

The \someformattingcommand{lm} function fits linear regression models $y = X'\beta+\epsilon$

What is that formatting command?

generic_user
  • 721
  • 1
  • 6
  • 12
  • Have you considered posting this question on the SO site for R? – lawyeR Dec 10 '15 at 22:41
  • @lawyeR what site is that? – Tyler Dec 11 '15 at 16:32
  • What exactly do you want for your inline code? Using the same font and background as the code chunks, or do you want the syntax highlighting too? – Tyler Dec 11 '15 at 16:33
  • @Tyler. I realize I have bookmarked http://stackoverflow.com/questions/tagged/r and think of that as a site. – lawyeR Dec 11 '15 at 16:50
  • @Tyler Syntax highlighting would be more informative for readers, if that is possible. Tx – lawyeR Dec 11 '15 at 16:51
  • @Tyler just the font and highlighting. Though if the background is easy to do or not do, such an answer might be good for posterity. – generic_user Dec 11 '15 at 20:32
  • The font should just be \texttt{} I think. I've looked around and I don't know if you can get the syntax highlighting outside of a code block (which is provided via the listings package). tcolorbox allows you to change the background color inline, that might help: http://tex.stackexchange.com/questions/136742/changing-background-color-of-text-in-latex?rq=1 – Tyler Dec 11 '15 at 22:42

0 Answers0