I am trying to use mermaid library in Quarto however the text in the boxes do not fit - they cut off the last letter or two.
Can anyone provide a solution?
I have already checked out two open questions below but they are different than my question
Mermaid diagram in Quarto/Rmarkdown: narrow and blurry
How to prevent mermaid flow charts overflowing in quarto
Code below:
---
format: revealjs
---
## Example
Blah Blah
```{mermaid}
flowchart LR
A[real time insights] --> B{Classification}
B --> C[Threat]
B --> D[Opportunity]
C --> E[Defend Value]
D --> F[Capture Value]
```
this doesn't solve the issue but just simply adding some spaces (1-3) after your text will move the border of the box so that your text isn't cut off.
There is the list of possible R-Markdown templates for beamer_presentation in R-Markdown.
And most of them include a kind of a "Navigation bar" at the top (or left/right) of each slide, like that:
While I do understand how to create a TOC in R-Markdown (by providing a toc: true in the header, I cannot figure out how to add this navigation to each slide.
I also understand how to create a floating TOC for the R-Markdown for HTML format (via toc_float: true as it is described here) but still cannot figure out how to make it in a beamer format. Any hint will be appreciated.
The headline with the navigation bar is automatically inserted in every frame if you use a suitable beamer theme. The one you show in your questions is called Antibes
---
title: test title
output:
beamer_presentation:
theme: "Antibes"
header-includes:
- \usepackage{tikzlings}
---
# Section name
## Subsection name
### Slide 1
\begin{tikzpicture}
\pig[scale=2]
\end{tikzpicture}
I am using RMarkdown to create an ioslide presentation with shiny.
Some of my slides do not actually fit on one page and are truncated.
Since this is a HTML output, I would like to add a scroll bar to make my long slides scrollable.
I have been googling a lot and found a partial solution to make R code chunks scrollable. However I want to make my slides scrollable regardless of the content.
This is a toy Rmd example giving slides not fitting on one page:
---
title: "Untitled"
date: "30 October 2018"
output: ioslides_presentation
runtime: shiny
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Shiny Presentation
- A very long
- and boring
- list of
- bullet points
- just a
- toy example
- obviously
- not over yet
- almost
- not quite
- finally
- out of frame!
I would like to make this slide scrollable since it does not fit on one page.
Edit: I am not sure why this is being heavily downvoted - would appreciate a constructive comment :) In the meantime, I did remove the css tag which may have brought people not familiar with rmarkdown.
Self-answer:
The bit of CSS that will make the slide scrollable (both horizontally and vertically but you just have to remove one line if only vertical scrolling is needed) is:
slides > slide {
overflow-x: auto !important;
overflow-y: auto !important;
}
Note that the slide gets a height from ioslide so there is no need to specify a height (and in fact it seems to introduce visual glitches if you do). Using auto instead of scroll makes sure a scrollbar only appears when there is a need.
You can either add this CSS directly in the Rmd in between <style> tags or put the CSS in a separate file (e.g. scrollable_slides.css).
The CSS file can then be added to the Rmd like this (assuming scrollable_slides.css is in the same directory as the Rmd):
---
title: "..."
output:
ioslides_presentation:
css: 'scrollable_slides.css'
runtime: shiny
---
I am putting together an Rmarkdown PDF document with the following YAML settings:
---
output:
pdf_document:
fig_caption: true
fig_crop: true
toc_depth: 3
header-includes:
- \usepackage{hyperref}
---
Within the body of the document I've inserted a few PNG images, using the following syntax
Paragraph 1..........
![Caption](path/image.png)
Paragraph 2....
And when the document is rendered, the image appears as expected within the text, between Paragraph 1 and Paragraph 2. However, I am getting some unpredictable results where the rendered image appears after Paragraph 2 in some cases and I can't manage to solve it.
I have run into the same problem. It appears if you wrap the image in "paragraph" tags, the image will be in-line with the text.
Paragraph 1...
<p>
![](image.png)
</p>
Paragraph 2...
When tackling similar issues, I've used \FloatBarrier (from the placeins package) to control positioning. I'm not the most experienced knitr rmarkdown LaTeX user, but I've had success with that before.
Basically, the images "float"; you can control what the can't float past by inserting a barrier. That description is crude, but you might find the technique effective.
\newline seems to work.
History and Overview of R
![R programming](Images/R.PNG)\newline
will insert vertical space
to keep your figure captions make sure the ![] is still in a separate paragraph (separated by blank lines above and below) in the Rmarkdown document
### Heading 1 ![This is my figure caption](`r fig_var`){width=400px}
### Heading 2
where fig_var is an r variable that contains the full path to the figure image
One option is to add
\newpage
to act in a similar way as the Floatbarrier. It is not to elegant but seems to work.
For greater clarity consider the example from above:
Paragraph 1..........
![Caption](path/image.png)
Paragraph 2....
To avoid the image to move in front of the second paragraph, you could do the following:
Paragraph 1..........
![Caption](path/image.png)
\newpage
Paragraph 2....
There is no correct answer to this.
Try adding fig.show='hold' to keep your images where they should be
The paragraphs might be skipped because Latex will try and fit the text/images with least space.
I sorted my issue out using (1) and to "work with" (2), you can use
\pagebreak in an appropriate position depending on what is before and after paragraphs 1 and 2.
This can be done only after seeing the pdf result, by better fitting of the image in question into potentially a next page (more space). Of course, it would also mean adding the page break elsewhere (e.g before or after any of the p1, p2 or the image).
What are possible ways of adding table of contents in html output of knitr::knit2html()?
I am familiar with the markdownHTMLOptions solution. However the result is not the good-looking one? For me it is important to have such table of contents so that it follows the webpage while scrolling and i could possibly navigate anytime I want.
A floating table of contents is now supported by Rmarkdown! It moves with you as you scroll, you click to navigate... such an improvement :)
The directions are very good: http://rmarkdown.rstudio.com/html_document_format.html
In short, add this at the top of your rmd script, where toc stands for table of contents, and float means that it stays visible on the left as the page scrolls:
---
title: "Bla"
output:
html_document:
toc: true
toc_float: true
---