【问题标题】:how to see xtable results directly to latex如何直接查看 xtable 结果到乳胶
【发布时间】:2020-04-11 16:03:09
【问题描述】:

我的 R 环境中有类似的东西

myoutput <-  xtable(mtcars)

我想在乳胶中自动看到更新的myoutput,这可能吗?

非常感谢,

【问题讨论】:

  • 不清楚问题,你不能运行脚本吗?或许你可以用代码写一个markdown文件
  • 你的意思是你想看到它呈现而不是作为乳胶代码?
  • 是否需要另存为tex print(myoutput, file = 'file.tex')

标签: r latex


【解决方案1】:

您可以使用texPreview 包。

library(xtable)
library(texPreview)

LaTeX <- xtable(mtcars)
tex_preview(LaTeX)

此代码在 RStudio 查看器中显示 LaTeX 表格。

【讨论】:

    【解决方案2】:

    如果您正在谈论 somefile.rmd(或者只是在 R Studio 中创建一个 - .rmd - 扩展名),请尝试以下操作:

    ---
    title: "Somefile"
    subtitle: "Somefile subtitle"
    author: "Your Name"
    output:
       beamer_presentation:
          slide_level: 2
          pandoc_args: "--latex-engine=xelatex"
          fig_width: 5
          fig_height: 5
    header-includes:
    - \usepackage{tikz, graphicx, multirow, colortbl, schemabloc}
    - \usepackage[11pt]{moresize}
    - ... # something else
    ---
    
    
    
    ## Overview of someproject
    ```{r echo = FALSE, message = FALSE, warning = FALSE, fig.align = "center", ...}
    
    d <-
        read.csv2("somefile.csv", header = TRUE, sep = ";", dec = ".") %>%
        head(.)
    

    使用此代码,您可以执行以下操作:

    1. 您创建了一个投影仪演示文稿(类似于ppt
    2. --- ... --- 之间的部分中,您可以设置演示文稿的"global configuration"
    3. 使用## 创建新幻灯片
    4. 使用{r echo = FALSE, message = FALSE, ...},您可以插入将出现在该幻灯片上的R code

    【讨论】:

      猜你喜欢
      • 2014-06-20
      • 2012-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多