【问题标题】:Shortcuts to \section in RStudioRStudio 中 \section 的快捷方式
【发布时间】:2012-10-04 11:38:56
【问题描述】:

是否可以在 RStudio 的 Tex 部分中为部分、小节等创建“快捷方式”?类似于 R 部分,在 ##### Title ##### 中包含“标题”会在控制台窗口正上方创建一个下拉窗帘。

【问题讨论】:

    标签: latex rstudio


    【解决方案1】:

    您可以使用空代码块。它将创建跳转菜单条目的生成,允许快速跳转并启用折叠而不改变输出。

    这是玩具内容...

    \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. 复制该行或您想要的任何部分。
      0yE
    3. 创建/插入代码块。
      CTRL+Alt+I
    4. 在之间粘贴文本。
      P
    5. 删除函数中的空白行,或在定义中添加 echo=FALSE。
      jdd

    【讨论】:

      【解决方案2】:

      抱歉,不,这在 RStudio for Sweave/TeX 文档中没有实现。

      【讨论】:

        猜你喜欢
        • 2016-08-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-15
        相关资源
        最近更新 更多