I'm having trouble permanently embedding images in my RStudio ioslides presentation.
Specifically, the problem occurs when I try to include local images via:
![](image.png)
The images will appear successfully when I knit the document and open it directly from its folder on my computer. But if I share the html file with anyone else or copy and paste to another directory on my computer, all images embedded via ![](image.png) disappear.
My YAML header looks like this:
---
title: 'Title'
subtitle: 'Subtitle'
author: "Harrison"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
ioslides_presentation:
self_contained: true
widescreen: true
smaller: true
css: custom.css
incremental: false
---
I thought that "self-contained" is supposed to accomplish what I want, that is, to create a fully self-contained html document.
Note: My images are successfully permanently embedded when I use the include_graphics() function from knitr to add a jpeg or png file.
Any idea what is going on?
I cannot reproduce your problem. Here is my reproducible example:
---
title: 'Title'
subtitle: 'Subtitle'
author: "Harrison"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output:
ioslides_presentation:
self_contained: true
keep_md: true
---
## First slide
```{r, test, dev='png'}
plot(1)
```
## Second slide
![](`r knitr::fig_chunk('test', 'png')`)
Both images are corrected embedded.
Please try to update your packages. If it still fails after updating all packages, please provide your xfun::session_info('rmarkdown').
Related
I've been using apostrophe, it shows metadata on the beginning of the file. Probably this is a new feature on Pandoc markdown.
I glanced many options but couldn't find any way to disable it.
How can I disable to printing YAML header on Markdown alongside entering this metadata which need to enter PDF info.
---
lang: En-GB
date: 15.06.2021
author: max
subtitle: 'How to disable YAML header printing as header'
title: "Markdown Tutorial"
geometry: margin=3cm
fontfamily: default
fontsize: 12pt
...
I want to add an image (an html file called "Logo.html") at the top of another html document.
for that i use "before_body":
I save my Logo.html in the same file as my Rmarkdown and i get the following error when "kniting" my rmd:
pandoc.exe: Logo.html: openFile: does not exist (No such file or directory)
is there a specific place to put my "Logo.html"? do you know what is incorrect in my code?
output:
html_document:
include:
before_body: Logo.html
fig_caption: true
code_folding: hide
You must be careful with the indentation and nesting of the YAML parameters.
This works for me:
---
output:
html_document:
includes:
before_body: Logo.html
fig_caption: true
code_folding: hide
---
I want to write a report in Markdown under Rstudio, I have already written several documents in Latex, from what I understood you can write latex commands under Markdown. I am on the first page where there is the title, name, ect.
I would like to know how:
put an image above the title.
make two columns one for the author and the other for the referents.
put a subtitle.
title: "titre"
author: "nom"
date: "r format(Sys.time(), '%d %B, %Y')"
output:
pdf_document:
latex_engine: pdflatex
#html_document:
#latex_engine: pdflatex
fontsize: 14pt
documentclass: report
Is it possible to specify in the YAML metablock a pdf header and/or footer?Something you could set to appear on every page. This is in rmarkdown and will then be rendered to a pdf (using pandoc and knitr). I have not been able to find anything (header: and footer: sadly did not work!)
---
title: testpdf | test
footer: "test footer"
theme: "zenburn"
date: "`r Sys.Date()`"
output: "pdf_document"
fig_width: 12
fig_height: 6
fig_caption: true
---
There is no native pandoc-markdown support of headers and footers. However, since pandoc generates pdf documents through latex, you can tweak your latex template to accommodate those.
Create a new template from the default one :
pandoc -D latex > footer_template.latex
Add the following lines in the latex preamble (this is a very basic example that should produce a centered footer, see the fancyhdr user manual if you need something more advanced)
$if(footer)$
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[C]{$footer$}
$endif$
Finally, add this to your document yaml header :
output:
pdf_document:
template: test.latex
Your template should either be in ~/.pandoc/templates or in the same directory as test.rmd for this to work.
I am trying to use a YAML metadata block to specify some document properties in a Markdown document for Pandoc that I am going to convert to LaTeX Beamer. I read the description here: http://johnmacfarlane.net/pandoc/README.html#extension-yaml_metadata_block and attempted the following document:
---
title: Some title
---
# This is a test slideshow.
## This should turn into a slide...
...with some content.
I convert the file to PDF using pandoc -t beamer file.md -V theme:SomeTheme -o file.pdf. It seems to work correctly with the theme etc., except that the YAML block at the beginning of the document is converted into a table in the first slide containing a top and bottom rule and the text "title: Some title". What am I doing wrong?
Not sure why your metadata doesn't work as mine works fine.
Try doing (with a space after the title):
---
title: Some title
---
# This is a test slideshow.
## This should turn into a slide...
...with some content.
Or (with periods):
---
title: Some title
...
# This is a test slideshow.
## This should turn into a slide...
...with some content.
Or (with quotes):
---
title: "Some title"
---
# This is a test slideshow.
## This should turn into a slide...
...with some content.
Do these all work?