r-markdown

How to number table with chapter number

家住魔仙堡 提交于 2021-02-07 20:40:29
问题 I inclue and cross-referencing a table in a Rmd file, and I want to add chapter number with the table title and referencing number, like "TABLE 1.1 test", but not "TABLE 1 test". I render the file using bookdown::word_document2. Here is a minimal example: --- title: test output: bookdown::word_document2: fig_caption: yes toc: yes --- ```{r} library(knitr) ``` # Heading 1 I'm cross-referencing a table table:\@ref(tab:test). ```{r test} test <- data.frame(a = 1:6, b = 2:7) kable(test, caption =

Linking to url with rmarkdown using Knit Word in Rstudio

随声附和 提交于 2021-02-07 14:40:55
问题 Is there an easy way to link to a webpage in rmarkdown without displaying the link? For example, putting "https://www.google.com/" in a .rmd file renders as the entire website, but I want something analogous to <a href="https://www.google.com/">ABC</a> instead. The html method above, i.e., <a href= ... works when I knit to html, but it does not work when I knit to a word document. 回答1: Markdown provides two ways to create a link as you mention (and I suppose that is supported on rmarkdown).

Linking to url with rmarkdown using Knit Word in Rstudio

久未见 提交于 2021-02-07 14:39:30
问题 Is there an easy way to link to a webpage in rmarkdown without displaying the link? For example, putting "https://www.google.com/" in a .rmd file renders as the entire website, but I want something analogous to <a href="https://www.google.com/">ABC</a> instead. The html method above, i.e., <a href= ... works when I knit to html, but it does not work when I knit to a word document. 回答1: Markdown provides two ways to create a link as you mention (and I suppose that is supported on rmarkdown).

Level 4 Heading issue in R Markdown

我的梦境 提交于 2021-02-07 14:20:56
问题 When I use #### for a level 4 heading, the output in pdf(latex) does not leave a line space before the paragraph begins. For example, #### Heading 4 Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Output only in pdf(latex) looks like this Heading 4 Lorem Ipsum is simply dummy text of the printing

How to use inline R code in a bookdown theorem or example environment

a 夏天 提交于 2021-02-07 12:23:31
问题 I use bookdown to generate documents in both html and PDF. How could I use results from inline R code in theorem and example environments? Here is what I tried: --- title: "Test" output: bookdown::pdf_book: toc: false html_document: toc: false --- ```{r} a <- 2 b <- 3 ``` If $a = `r a`$ and $b = `r b`$, then $a + b = `r a + b`$. ```{theorem} If $a = `r a`$ and $b = `r b`$, then $a + b = `r a + b`$. ``` ```{example} If $a = `r a`$ and $b = `r b`$, then $a + b = `r a + b`$. ``` and I get 回答1:

create references in each section in Rmarkdown

橙三吉。 提交于 2021-02-07 09:01:07
问题 I want to use Rmarkdown but what I've read is that when creating a bibliography using pandoc, references go at the end of the document: pandoc/citeproc issues: multiple bibliographies, nocite, citeonly So even if I have a parent document named thesis.Rmd, I assume that all references would go at the end of that file. I need that each thesis' chapter or section must have its own references, is there any other way to solve this than putting a bibliography header in each chapter I write and then

\xdef\@fontenc@load@list{\@fontenc@load@list undefined control sequence in Rmarkdown

六眼飞鱼酱① 提交于 2021-02-07 09:00:41
问题 I've tried to write a very simple Rmarkdown file to render as pdf, but got an error for an undefined control sequence . The file: --- title: "Untitled" author: "author" date: "3/2/2020" output: pdf_document --- # whatever fskjflsjflkj saved as test.Rmd and knit (with the button) produces the following output in the R markdown console: processing file: test.Rmd output file: test.knit.md ! Undefined control sequence. l.115 \xdef\@fontenc@load@list{\@fontenc@load@list Error: LaTeX failed to

\xdef\@fontenc@load@list{\@fontenc@load@list undefined control sequence in Rmarkdown

青春壹個敷衍的年華 提交于 2021-02-07 08:59:39
问题 I've tried to write a very simple Rmarkdown file to render as pdf, but got an error for an undefined control sequence . The file: --- title: "Untitled" author: "author" date: "3/2/2020" output: pdf_document --- # whatever fskjflsjflkj saved as test.Rmd and knit (with the button) produces the following output in the R markdown console: processing file: test.Rmd output file: test.knit.md ! Undefined control sequence. l.115 \xdef\@fontenc@load@list{\@fontenc@load@list Error: LaTeX failed to

\xdef\@fontenc@load@list{\@fontenc@load@list undefined control sequence in Rmarkdown

前提是你 提交于 2021-02-07 08:57:15
问题 I've tried to write a very simple Rmarkdown file to render as pdf, but got an error for an undefined control sequence . The file: --- title: "Untitled" author: "author" date: "3/2/2020" output: pdf_document --- # whatever fskjflsjflkj saved as test.Rmd and knit (with the button) produces the following output in the R markdown console: processing file: test.Rmd output file: test.knit.md ! Undefined control sequence. l.115 \xdef\@fontenc@load@list{\@fontenc@load@list Error: LaTeX failed to

Run RMarkdown with arguments on the command line

不打扰是莪最后的温柔 提交于 2021-02-07 05:21:59
问题 I'm trying to run a Rmarkdown file ( myfile.Rmd ) from the command line terminal. This file needs to take an argument to work. We can use this simple file as an example: --- title: "Simple example" output: pdf_document: default --- ```{r read_arg, include=FALSE} args = commandArgs(TRUE) VAR = args[1] ``` ```{r show_var} VAR ``` So, first of all, is it possible to run a Rmarkdown file by reading arguments as done for Rscripts? I mean, not by reading input files as described in this question.