Home Comments Thread
New Thread

5 Comments

giscus-bot giscus-bot 2022-12-16 22:28:02
Guest *Sepehr Akhavan* @ 2012-07-05 18:43:00 originally posted:

Hi Yihui,
You often times use options() in your setup chunk. Is it a function from the base package? I don't see any knitr::options. I wanted to understand what arguments of the function mean (like replace.assign) and I couldn't find it in R help.

Best,
-Sepehr 

yihui yihui 2022-12-16 22:28:07

It is a function in the base package; see ?options.

However, replace.assign is not part of base R options. I added it to my formatR package; see formatR::tidy.source. BTW, if you want the replace.assign option to be robust, you need the development version of formatR: https://github.com/yihui/formatR#readme

Originally posted on 2012-07-05 19:01:39

giscus-bot giscus-bot 2022-12-16 22:28:07
Guest *Sepehr Akhavan* @ 2012-07-05 19:08:22 originally posted:

Thank you very much :)

giscus-bot giscus-bot 2022-12-16 22:28:03
Guest *JJ* @ 2013-05-08 01:50:34 originally posted:

Hi Yihui,
May I know how to change font in the R input code? By using render_listings(), the font has slightly changed and the assignment sign(<-) looks like arrow key now. Thanks in advance.

Best,
JJ

yihui yihui 2022-12-16 22:28:08

You can redefine the listings styles. See the .tex file generated. I do not have the time to write the details.

Originally posted on 2013-05-25 07:16:04

giscus-bot giscus-bot 2022-12-16 22:28:04
Guest *mreq* @ 2014-12-09 09:31:25 originally posted:

Is there a way how to create a single listing? Same as a single verbatim is produced by default.

I've redefined kframe to use mdframed but couldn't find a way to simply replace verbatim with a single listing in a similar way.

ifdefinedkframe  
renewenvironment{kframe}{begin{customMdframed}}{end{customMdframed}}  
else  
fi  
giscus-bot giscus-bot 2022-12-16 22:28:05
Guest *David Forrest* @ 2015-09-15 20:52:29 originally posted:

How do you reset to default? I currently am using 'knit_hooks$set(input=unlisting,output=unlisting,chunk=unlisting)' to disable listings so I can use xtable and apsrtable latex output.

giscus-bot giscus-bot 2022-12-16 22:28:06
Guest *David Scott* @ 2017-06-04 01:05:13 originally posted:

How do I stop knitr from evaluating the inside of a listings environment? Here is a bit of code

begin{lstlisting}
<<plot1, echo="FALSE," fig.cap="Histogram of Data" ,="" fig.pos="h">>=
x <- rnorm(100)
hist(x)
@
end{lstlisting}

but I don't want knitr to evaluate it, just pass it through verbatim with listings decoration. I included render_listings() prior to this code snippet

Sign in to join the discussion

Sign in with GitHub