similar to: need settings for the listings package

Displaying 20 results from an estimated 1000 matches similar to: "need settings for the listings package"

2006 Sep 25
3
Best use of LaTeX listings package for pretty printing R code
This is what I have been using. Does anyone have a better way? In particular I would like to see letters in comment strings not stretched so much. Thanks -Frank \documentclass{article} \usepackage{listings,relsize} \lstloadlanguages{R} \newcommand{\lil}[1]{\lstinline|#1|} \begin{document} \lstset{language=R,basicstyle=\smaller,commentstyle=\rmfamily\smaller, showstringspaces=false,%
2012 Nov 01
1
How to nicely display R code with the LaTeX package 'listings'?
Dear expeRts, What's a 'good' (nice-looking, easy-to-read) setup for the LaTeX package 'listings' to display R code? The two versions below are partly inspired by the settings of the package SweaveListingUtils and http://r.789695.n4.nabble.com/R-How-to-format-R-code-in-LaTex-documents-td816055.html Any suggestions, comments, or improvements are welcome. Cheers, Marius ###
2004 Oct 04
4
Off-Topic: LaTeX package listings
Hola! I ask here since I learnt from this list that the LaTeX package listings should be good for typesetting R code. I encountered one problem: \begin{lstlisting} X %*% V \end{lstlisting} in the output the * in %*% disappears! same with %/%, etc, the / disappears. Any ideas? Kjetil -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. --
2008 Oct 17
1
R-code in Latex --- $ sign causes error
hi, here's what i have: \lstset{ basicstyle=\ttfamily, keywordstyle=\bfseries, showstringspaces=false, columns = fullflexible, mathescape = true, language=R } \begin{lstlisting} lst$val<-val \end{lstlisting} ./software.tex:16:Extra }, or forgotten \endgroup. lst$ the culprit here is the $ sign. thanks. ps: i'm posting here rather than Latex is bec i guess an R user is
2011 Nov 23
1
R-latex syntax highlighting?
Hello, Can anyone provide or point me to a good setup for the listings latex package that would produce nice R-syntax highlighting? I am using an example I found in internet for setting up listings like this: \lstset{ language=R, basicstyle=\scriptsize\ttfamily, commentstyle=\ttfamily\color{gray}, numbers=left, numberstyle=\ttfamily\color{red}\footnotesize, stepnumber=1, numbersep=5pt,
2003 Apr 05
3
slides in linux R
Hello, In S-Plus Windows you can transform graphics to Powerpoint very easily, in R Windows you can use enhanced metafiles (.emf) and Powerpoint almost as easy. Is there a simular way with R in Linux to transform to the presentation program in StarOffice or OpenOffice or are you stuck with the pdf device? Fredrik Lundgren
2003 Jul 12
2
using cut on matrices
Dear list, I'd like to use the function cut() on matrices, ie that when I apply it to a matrix, it would return a matrix of the same dimensions instead of a vector. I wonder if there is a better (more elegant) solution than matrix(cut(a, ...), ncol=ncol(a), nrow=nrow(a)) because I would like to use cut on both vectors and matrices and avoid testing whether a is a matrix. Thanks, Tamas
2003 Apr 23
1
Setting up Xemacs + Sweave
Dear list, I have tried to setup my Xemacs for use with Sweave, which I indend to learn. I have followed the instructions in the Sweave FAQ, that is to say, I put (defun Rnw-mode () (require 'ess-noweb) (noweb-mode) (if (fboundp 'R-mode) (setq noweb-default-code-mode 'R-mode))) (add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode)) (add-to-list
2004 Jul 05
1
general questions about R on debian/powerpc
Hi, I am about to but a laptop, and have narrowed the choices down to a Dell Latitude 600 and an Apple Powerbook G4 Aluminium (Princeton provides these models at a discount for grad students). I am biased towards the Powerbook, and would like to run Debian on it. I have only used debian on i386 platforms so far. I use R quite frequently, so I would be interested in your experience of running R
2003 Jul 11
1
metapost device in R (again ;-)
Hi, I read the 2000 thread on a MetaPost device in R. If I understand correctly, the main problem with the concept is that R wants the device driver to give back information on the size of strings/labels. To the bet of my knowledge, MetaPost _does_ make it possible to measure the bounding box of text (see section 7.3: Measuring text in the MetaPost manual). For example, one could get the size of
2003 Oct 06
1
visualizing transition probability matrices
Dear List, I have a couple of (~200) 3x3 transition probability matrices (ie each defines a Markov chain). They are all estimated from the same underlying process, so it ie meaningful to take their elemetwise mean and standard deviation. [1] First question: supposing that they are given in a list l, how do I get their elementwise mean and standard deviation? Fortunately, the mean of trans. prob.
2004 Apr 10
4
(offtopic) I need two sets of 5 different color scales
Hi, I am plotting a policy function (result from a dynamic stochastic optimization problem, discretized approximation). The policy function maps from an 2 x 2 x 2 x 3 x B x F state space to a B x F state space (B and F are usually between 4-6, and represent domestic and foreign savings. The other variables are income (Y), inflation (Pi), domestic and foreign interest rates (R and Z)). I
2004 Mar 31
1
extracting values from a 3d array using a matrix from indices
Suppose I have A, an n x m matrix, each element is an integer (an index). I also have B, an n x l x m array. I need C, where C[n,m] = B[n, A[n, m], m] I am currently using loops, what would be the "R way" to do this? Another question: let A[n, m] <- argmax_l B[n, l, m] what would be the nicest way of doing this? Currently I am using max.col and a single loop, going though the
2003 Oct 01
3
fitting Markov chains
I need to find a computationally simple process for the movement of interest rates. In this simplified model, an interest rate can have 3--5 possible values, and its movement is characterized by a matrix of transition probabilities (ie, it is a Markov process). I would like to estimate this process from a given set of data. For example, let the interest rate time series be: 7 3 8 2 5 9 6
2004 Mar 31
2
array addition doesn't recycle!
Hi, I have noticed the following: > a <- array(1:4, c(2, 2)) > A <- array(1:4, c(2,2,2)) > A + a Error in A + a : non-conformable arrays It works with a matrix + a vector, why doesn't it work with arrays? Am I missing something? How would you do the above operation efficiently (ie I need to add a matrix to each "plane" of 3-dim array)? At the moment I am using
2003 Apr 17
1
Testing for whole numbers
Is there a way in R to test if a given number is an integer, ie a whole number? I am not referring to the data type of a number, but to its value. That is to say, is.whole(pi-pi+2) would be TRUE, whereas is.whole(4/3) would be false. At the moment I am using is.whole <- function(a) { floor(a)==a } which is OK for real numbers, but not for complex ones (a+bi would be a whole number if both a
2007 Jan 15
4
How to format R code in LaTex documents
Hi, I am planning on putting some R script in an appendix of a LaTex document. Can anyone recommend me a way of how to format it? Is there a way to keep all line breaks without having to insert \\ in every single line? Thank you! Benjamin
2004 Apr 21
2
resetting the interpreter
Hi, Sometimes I want to "reset" the R interpreter (as if I quit and started it again, with everything starting from scratch). The main reason for this is when I expreriment with calculations, and later form them into general functions, sometimes I forget to include variables or reset some settings which I don't notice because they are already set. This causes problems during batch
2003 Mar 09
1
strings spanning multiple lines
I'd like to specify strings spanning multiple lines (ie too long to fit in a single line without spoiling pretty-printed R code). I tried the following way: > a <- "multiple \ + lines" but > print(a) [1] "multiple \nlines" How could I avoid the extra linebreak ("\n")? Regards, Tamas Papp -- Tam?s K. Papp E-mail: tpapp at axelero.hu (preferred,
2004 Apr 27
5
parsing a data file
Hi, I need to parse a data file (output of a measuring device) of the following format: BEGIN RECORD [first record data] RECORD [second record data] RECORD [third record data] END Line breaks can (and do ;-() occur anywhere. White space behaves very much like TeX, eg it is not important whether there are one or more spaces or linebreaks as long as there is one of them. It is a text file, not