Quantcast
Channel: What is the best way to include R code in the Latex paragraph - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

What is the best way to include R code in the Latex paragraph

0
0

I am a newbie in Latex. I have two simple questions regarding including R code in Latex.

Q1: For a block of R code, I use 'listings' package, as follows.

\documentclass[12pt]{report}\usepackage{listings}\begin{document}\begin{lstlisting}[language=R]> dpareto(4, 2, 3)[1] 0.09375> dpareto(4, -2, 3)[1] NaN> dpareto(seq(-1, 4, 1), 2, 3)[1] 0.0000000 0.0000000 0.0000000 0.0000000 0.2962963 0.0937500\end{lstlisting}\end{document}

I feel it's not professional. What is the best way to present the block of R code?

Q2: For code pieces in the paragraph, for example I wish to include a R function, or variable, or package name in my Latex context, what is the best way to do that?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images