Hi, I am wondering if there is any convenient way to comment out an entire region of a Sweave file which comprises R and Latex code. Currently I'm doing it for the R and Latex parts separately or transfer the unwanted part into a different file. But both are not great solutions. (I am doing this when updating old files and debugging) Is there a way to do this with an equivalent of \iffalse \fi or is there some "stop" command after which Sweave just stops processing? Thanks a lot for any suggestions. Werner
Duncan Murdoch
2010-Sep-11 11:21 UTC
[R] How to comment out entire code parts in Sweave files
On 11/09/2010 4:42 AM, Werner W. wrote:> Hi, > > I am wondering if there is any convenient way to comment out an entire region of > a Sweave file which comprises R and Latex code. Currently I'm doing it for the R > and Latex parts separately or transfer the unwanted part into a different file. > But both are not great solutions. (I am doing this when updating old files and > debugging) > > Is there a way to do this with an equivalent of \iffalse \fi or is there some > "stop" command after which Sweave just stops processing? >Prefixing each line with % should work, if you're starting in LateX mode. Duncan Murdoch
Hello Werner, good question. According to this source: http://devdaily.com/blog/post/latex/multi-line-comments-in-latex-begin-123- comment-125-verbatim this can be done with \usepackage{verbatim} and \begin{comment} This is my comment. Note that it can span multiple lines. This is very useful. \end{comment}\begin{comment} On Saturday 11 September 2010 10:42:52 am Werner W. wrote:> Hi, > > I am wondering if there is any convenient way to comment out an entire > region of a Sweave file which comprises R and Latex code. Currently I'm > doing it for the R and Latex parts separately or transfer the unwanted > part into a different file. But both are not great solutions. (I am doing > this when updating old files and debugging) > > Is there a way to do this with an equivalent of \iffalse \fi or is there > some "stop" command after which Sweave just stops processing? > > Thanks a lot for any suggestions. > Werner > > > > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html and provide commented, > minimal, self-contained, reproducible code. >-- ---- Friedrich Schuster Dompfaffenweg 6 69123 Heidelberg [[alternative HTML version deleted]]