I would like to distribute the HTML variant for the theme to be a self-contained HTML file. Is that possible? The following YAML header built the gorgeous file, but appears to have dependencies via the form of cache and files folders.
---
title: "Tufte Handout"
subtitle: "An implementation in R Markdown"
author: "JJ Allaire and Yihui Xie"
date: "`r Sys.Date()`"
output:
tufte::tufte_html:
self_contained: true
---
I think you may not be looking closely enough at this, or looking from the wrong angle:
Self-contained asks for just that;
what your question notes are cache files
which are "merely" used to produced said self-contained file more easily.
Should work for tufte, tint and everything else running through the same machinery.
Related
I'd like to make multiple bookdown projects that have particular chapters in common. For example I would like the content of a particular file content_in_common.Rmd to be merged in to two different books when they are built. How can I achieve this? I understand that bookdown requires the Rmd files to be in a common working directory, so having
rmd_files: ["index.Rmd", "path_where_common_content_is_stored/content_in_common.Rmd"]
in my _bookdown.yml doesn't work because it returns
Error: Input files not all in same directory, please supply explicit wd
Execution halted
Is there a solution to this (short of manually making duplicate versions of content_in_common.Rmd)?
I found this link that suggests you can use
{r child = 'chapter1.Rmd'}
such as
---
title: My Report
output:
pdf_document:
toc: yes
---
```{r child = 'chapter1.Rmd'}
```
```{r child = 'chapter2.Rmd'}
```
To use other .Rmd files inside your bookdown project hopefully
I am trying to use a PPT template to format a RStudio > RMarkdown > PPT file. Here's my testing file (saved as testing.Rmd):
---
title: "Aarduous Aardvarks"
author: "Aanonymous Aardvark"
date: "5/4/2019"
output: powerpoint_presentation
reference_doc: template.pptx
---
## My title
```{r myplot}
plot(mtcars)
```
When I first knit this, a PPT file was generated. I opened that file, made the Slide Master background red and the font blue (deliberately hideous for testing), saved it as "template.pptx" in the same folder as above.
However, when I re-knit the document, the background is still white and the font is still black. What do I need to get my template file recognized?
System:
Windows 7 Professional
Rstudio 1.2.1335
Rmarkdown 1.12
Pandoc: 2.6
PPT 2010 v14.0.6129.5000
Indentation in YAML is important. Use the structure as described in the official docs:
---
title: "Aarduous Aardvarks"
output:
powerpoint_presentation:
reference_doc: template.pptx
---
I have had this same problem, but it does not repair when the YAML above is inserted. The additional changes helped me solve the problem:
Save the reference_doc as a .potx file format, and refer to that extension in the YAML header
Go into View -> Slide Master to make sure the slides in the master are the format you expect (one time I thought I made the changes, but they showed up on the Home menu and not the Slide Master)
Under the Home menu, click the Dropdown under Layout and make sure AT THE LEAST that you see these four elements:
Title
Section Header
Title and Content
Two Content
When all three of these are taken care of, my slides knit fine from the Rmd.
I was facing a similar error when knitting to a powerpoint template- the indentation as documented (indenting 'reference_doc:...') was giving me an error: "Scanner error: mapping values are not allowed in this context", which suggested that the indentation was wrong in the YAML. I was able to resolve (through trial and error) with the following formatting:
---
title: "TITLE"
author: "Mike Harris"
date: "4/9/2021"
resource_files:
- template.pptx
output:
powerpoint_presentation:
reference_doc: template.pptx
---
Hopefully this saves someone a little extra time.
I`m aware how to use additional Latex-packages for pdf-format output from .Rmd files using
---
header-includes:
- \usepackage{mathtools}
---
in the YAML header.
However, this does (of course) not work if one specifies output: html_document.
---
output: html_document
header-includes:
- \usepackage{mathtools}
---
Using additional Latex-Packages could be of interest for output: html_document, too - especially in math expressions (MWE below)
---
title: "MWE"
output: html_document
header-includes:
- \usepackage{mathtools}
---
## Use "Defined by" Symbol
$$sin(x) \coloneqq \frac{opposite}{hypothenuse}$$
MathJax offer a number of extensions, and there are third-party extensions as well. If your desired package is not available in this way, then things get difficult.
Simple commands, such as \coloneqq, can be recreated using \newcommand. The simplest way is to add these via the include-before option. Using your MWE with a solution from Mathematics Meta SE, one gets:
---
title: "MWE"
output:
html_document: default
include-before:
- '$\newcommand{\coloneqq}{\mathrel{=}}$'
---
## Use "Defined by" Symbol
$$sin(x) \coloneqq \frac{opposite}{hypothenuse}$$
Output:
Background
RMarkdown is build around pandoc, which performs most of the format conversions. Pandoc creates PDF via LaTeX (by default), and will simply include any raw LaTeX commands which are given in the source. When seeing \usepackage{mathtools}, the package is not parsed, but the command is simply added verbatim to the intermediate LaTeX. However, when exporting to HTML, it wouldn't make sense to pass through LaTeX commands, so any such command will simply be omitted from the output, so any \usepackage in your document won't effect the HTML output.
Alternative solution
If you are using very complex LaTeX-packages, then you could consider setting up a complex pipeline to still use it: E.g, one could use a pandoc filter to extract all equations, compile each equation as a separate document, and then convert the resulting PDF to SVG. Finally, that SVG can then be included in the HTML output. This is non-trivial and probably not worth the effort. A similar approach is recommended to include TikZ pictures.
Hi at all i have the following Problem:
I'm using Rmarkdown to write a Dokument. I'm also using the komadown package to use some bookdown features for referencing and be able to use the scrartcl document Class (Latex Output). I want to specify a citation style using a .csl file.
Normaly a simple csl: FILENAME.csl in the YAML header does the trick. But with the Komadown package this doesn't work.
My YAML Header is as follows, it finds my bibliography but it doesn't find the .csl file :(
---
title: "Komadown Try"
bibliography: library.bib
csl: kaktus.csl
output: komadown::scrartcl
---
Furthermore i want to set the keep_tex option to TRUE or yes but this also doesn't work.
Many thanks in advance. Would be awesome if someone could help me out.
i just got an answer to my questions. Maybe It'll help others that run into the same problem.
I can specify the csl file now. There was a bug in the code and the developer has fixed it. Currently the latest Version isn't on Cran so you have to download the developer Version from Github:
# install.packages("devtools")
devtools::install_github("jolars/komadown")
If you have done that you can specify the csl and the keep_tex argument as follows:
---
title: "Thesis Template"
bibliography: library.bib
output:
komadown::scrartcl:
keep_tex: yes
csl: kaktus.csl
---
Is there a way to convert a Beamer presentation to a handout presentation and remove the pauses? In LaTeX, this can be accomplished by changing the heading from \documentclass{beamer} to \documentclass[handout]{beamer}. What is the analog in RMarkdown?
One note, I have some slides that are incremental and others that are not, so I have used > instead of incremental: true in the YAML header to insert my pauses.
Kindly refer to: https://rmarkdown.rstudio.com/beamer_presentation_format.html for more information.
Following this post, all you need to do is amend your YAML header at the top of your RMarkdown document. Specifically, use classoption: "your_usual_option" to pass whatever argument you would usually pass inside \documentclass[your_usual_option]{beamer}. Here is how I did it for your specific case:
output:
beamer_presentation:
keep_tex: true
classoption: "handout"
To make sure my suggestion is working, I added the keep_tex: true option in the YAML header above and indeed, my .tex file now shows \documentclass[10pt,ignorenonframetext,handout]{beamer}. If I remove the classoption: line, then the .tex file shows \documentclass[10pt,ignorenonframetext,]{beamer}
UPDATE:
I just found another solution, thanks to How can we pass pandoc_args to yaml header in rmarkdown? Probably more what you were looking for I am guessing?
You can alternatively adjust your YAML header with:
beamer_presentation:
pandoc_args: [
# "-M", "classoption=a4paper"
"-M", "classoption=a4paper,handout"
]
Your resulting .tex file will show the "updated" document class.