2012-10-04 39 views

回答

1

您可以使用空的代碼塊。它將創建跳轉菜單條目的生成,從而允許快速跳轉並啓用摺疊而不改變輸出。

Jump Menu

這裏的玩具內容...

\documentclass{article} 
\usepackage{Sweave} 
\SweaveOpts{concordance=TRUE} 

\title{Sample Sweave Document} 
\author{Thell Fowler} 

\begin{document} 

\maketitle 

\section*{Introduction} 
<<\section*{Introduction}>>= 
@ 
Some actual content. 


\section{Concept} 
<<\section{Concept}>>= 
@ 
Some other content. 


\subsection*{Algorithm} 
<<\subsection*{Algorithm}>>= 
@ 
<<HelperFunctions>>= 
HelperFunction1 <- function() { 
    print("That helped!") 
} 
HelperFunction2 <- function() { 
    print("Oh, that helped too!") 
} 
@ 

<<MainFunction>>= 
main <- function() { 
    print("I need some help!") 
    HelperFunction1() 
    cat("\tbut not enough! Let's get more help...\n") 
    HelperFunction2() 
    cat("That's much better!\n") 
} 
@ 

\subsection*{Example} 
<<\subsection*{Example}>>= 
@ 

<<Example>>= 
# We can get help. 
main() 
@ 

\subsubsection*{Pros} 
<<\subsubsection*{Pros}>>= 
@ 

\subsubsection*{Cons} 
<<\subsubsection*{Cons}>>= 
@ 

\end{document} 

它可能看起來像一個痛苦,但它很直接和簡單。
其次VIM模式鍵

  1. 創建部分使用格式下拉列表中,或只需鍵入它保持手在鍵盤上。
  2. 複製該行,或者您想要的任何部分。
    ýË
  3. 創建/輸入編碼塊。
    CTRL + Alt鍵 +
  4. 內<之間>的文本粘貼。
    P
  5. 刪除函數中的空行或將echo = FALSE添加到定義中。
    Ĵdd
0

對不起,這不是在RStudio中爲Sweave/TeX文檔實現的。

+0

它應該是,P –