Isoslides presentation, incremental bullet points for subsections - r

In an isoslides_presentation, creating incremental (in terms of time: one after another) bullet points can be done by following code:
> - point 1
> - point 2
But how do I achieve this for lower hierarchy points?
Something like this (both not working):
> - point 1
> - subpoint 1.1
> - subpoint 1.2
> - point 2
> - subpoint 2.1
> - subpoint 2.2
or this
> - point 1
> - subpoint 1.1
> - subpoint 1.2
> - point 2
> - subpoint 2.1
> - subpoint 2.2
I found a reference (https://rpubs.com/eli_3357/ioslides), that states:
A section can also be incremental
using > * for the first line, and >tab* for the following lines"
But I can not get it to run.
In reply to the comment, here is a more complete RepEx:
---
title: "Test"
subtitle: "I do tests"
output:
ioslides_presentation:
smaller: yes
slidy_presentation: default
---
# Slide 1
> - Point 1: to show after first click
> - point 1.1: to show after second click
> - point 1.2: to show after third click
> - Point 2: to show after fourth click
> - and so on ...
#######################################
# Slide 2 {.build}
> - I'm, aware of the build-option...
> - ...but this also gives not the intended result ...
> - ... and all sub-bullets appear at once

This worked for me.
---
title: "Untitled"
date: "18/10/2022"
output: ioslides_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Slide with Bullets
- Bullet 1
- Sub-bullet 1
- Sub-bullet 2
- Bullet 2
- Bullet 3

Related

Error in YAML when knitting RMarkdown document - Scanner error

I'm trying to knit an RMD file in RStudio but I get the following error
Error in yaml::yaml.load(string, ...) : Scanner error: while scanning a plain scalar at line 31, column 5 found a tab character
that violate intendation at line 34, column 1 Calls: ...
parse_yaml_front_matter -> yaml_load_utf8 -> Execution
halted
The header of the rmd file is as following:
> ---
> title: "Homework 4"
> author: NAME OF THE AUTHOR, Fall 2018
> date: Due Friday, September 30, 11:59pm
> subparagraph: yes
> output:
> pdf_document:
> number_sections: true header-includes:
> - \setcounter{secnumdepth}{1}
> - \pagenumbering{gobble}
> - \sloppy
> - \hypersetup{ breaklinks=true,
> pdftitle={\#title},
> pdfauthor={\#author},
> colorlinks=true,
> breaklinks=true,
> urlcolor= blue,
> linkcolor= blue,
> citecolor=blue,
> bookmarksopen=false,
> pdftoolbar=false,
> pdfmenubar=false
> }
> - \usepackage{titlesec}
> - \renewcommand{\thesection}{\arabic{section}.}
> - \usepackage{mathpazo}
> - \usepackage{etoolbox}
> - \usepackage{geometry}
> - \usepackage{graphicx}
> - \newcommand{\protectbracket}[1]{#1}
> - \makeatletter
> \protectbracket{\preto\Gin#extensions{svg,}}
> \DeclareGraphicsRule{.svg}{pdf}{.pdf}{\noexpand\Gin#base.pdf} \makeatother
> - \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
> - \usepackage[most]{tcolorbox}
> - \definecolor{block-gray}{gray}{0.85}
> - \newtcolorbox{darkquote}{colback=block-gray,grow to right by=-10mm,grow to left by=-10mm, boxrule=0pt,boxsep=0pt,breakable}
> - \renewenvironment{quote}{\begin{darkquote}}{\end{darkquote}\ignorespacesafterend}
> ---
Any ideas what is causing this? The error is pointing to character "n" in line 31 which I am not sure how to fix it. any help or suggestion is highly appreciated.
I have tried this with both RStudio installed on both mac and PC.
Assuming those > at the beginning of the line are left-overs from copy and paste (they for sure should not be in the file), you have a YAML document that starts like:
---
title: "Homework 4"
author: NAME OF THE AUTHOR, Fall 2018
date: Due Friday, September 30, 11:59pm
subparagraph: yes
output:
pdf_document:
number_sections: true header-includes:
- \setcounter{secnumdepth}{1}
and that is invalid as you you cannot have both a mapping as value for the key pdf_document as well as a sequence (less indented in addition).
That, probably combined with the combination of the inline colon-space and end-of-line-colon on one line, confuses that parser
You probably want to change that to something beginning with:
---
title: "Homework 4"
author: NAME OF THE AUTHOR, Fall 2018
date: Due Friday, September 30, 11:59pm
subparagraph: yes
output:
pdf_document:
number_sections: true
header-includes:
- \setcounter{secnumdepth}{1}

Increase header levels of child documents

I want to create a single PDF document from many .Rmd child documents using pdf_document2().
I have a wrapper file pdf_wrapper.Rmd that looks as follows
---
title: "title"
author: "author"
output:
bookdown::pdf_document2:
number_sections: true
---
# Header1
```{r child = 'child1.Rmd'}
```
With child1.Rmd having the following content
---
title: "Title2"
output: rmarkdown::html_document
---
## Title 3
Now when I render pdf_wrapper.Rmd, I get the following:
# Header 1
## Title 3
I want to end up with
# Header 1
## Title 2
### Title 3
I put all level 2 headers manually in the main document pdf_wrapper.Rmd, e.g. Title2.
Additionally, I decreased all remaining headers in all child documents by one level using the following bash call:
for i in *.Rmd; do
sed -i '# /## /g' $i
done
The main document then looks as follows:
---
title: "title"
author: "author"
output:
bookdown::pdf_document2:
number_sections: true
---
# Header1
## Title2
```{r child = 'child1.Rmd'}
```
Initially I though that the <title> fields in the YAML metadata of the child documents get processed as level 1 headers but this is not the case.

Creating lists and sub items in R markdown not working any longer?

I'm following the following cheat sheet:
https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf
And trying to make some lists using the following code (copy pasted from the cheat sheet)
---
title: "Test"
author: "Test"
date: "7 August 2017"
output: html_document # or pdf_document
---
* unordered list
* item 2
+ sub-item 1
+ sub-item 2
1. ordered list
2. item 2
+ sub-item 1
+ sub-item 2
But the results are not the same as in the cheat sheet, the circles are not the same and the sub items do not get indented.
For everyone that has problems showing simple list, markdown need an Empty line before a list.
This will not work
* Item 1
* Item 2
* Item 3
The output will look something like this.
This will not work
* Item 1
* Item 2
* Item 3
To fix this;
INSERT EMPTY LINE HERE, BEFORE LIST.
* Item 1
* Item 2
* Item 3
should output like this
Item 1
Item 2
Item 3
Try using tab or double tab separation instead of spacebar for sub items
---
title: "Test"
author: "Test"
date: "7 August 2017"
output: html_document # or pdf_document
---
* unordered list
* item 2
+ sub-item 1
+ sub-item 2
1. ordered list
2. item 2
+ sub-item 1
+ sub-item 2

How to print git history in rmarkdown?

I am writing an analysis report with rmarkdown and would like to have a "document versions" section in which I would indicate the different versions of the document and the changes made.
Instead of writing it down manually, I was thinking about using git history and inserting it automatically in the markdown document (formatting it in a table).
How can I do that? Is it possible?
Install git2r, https://github.com/ropensci/git2r then you can do stuff like:
> r = repository(".")
> cs = commits(r)
> cs[[1]]
[02cf9a0] 2017-02-02: uses Rcpp attributes instead of inline
So now I have a list of all the commits on this repo. You can get the info out of each commit and format as per your desire into your document.
> summary(cs[[1]])
Commit: 02cf9a0ff92d3f925b68853374640596530c90b5
Author: barryrowlingson <b.rowlingson#gmail.com>
When: 2017-02-02 23:03:17
uses Rcpp attributes instead of inline
11 files changed, 308 insertions, 151 deletions
DESCRIPTION | - 0 + 2 in 2 hunks
NAMESPACE | - 0 + 2 in 1 hunk
R/RcppExports.R | - 0 + 23 in 1 hunk
R/auxfunctions.R | - 1 + 1 in 1 hunk
R/skewt.r | - 0 + 3 in 1 hunk
R/update_params.R | - 1 + 1 in 1 hunk
R/update_params_cpp.R | -149 + 4 in 2 hunks
src/.gitignore | - 0 + 3 in 1 hunk
src/RcppExports.cpp | - 0 + 76 in 1 hunk
src/hello_world.cpp | - 0 + 13 in 1 hunk
src/update_params.cpp | - 0 +180 in 1 hunk
So if you just want the time and the commit message then you can grab it out of the object.
> cs[[3]]#message
[1] "fix imports etc\n"
> cs[[3]]#committer#when
2017-01-20 23:26:20
I don't know if there's proper accessor functions for these rather than using #-notation to get slots. Need to read the docs a bit more...
You can make a data frame from your commits this way:
> do.call(rbind,lapply(cs,function(cs){as(cs,"data.frame")}))
which converts the dates to POSIXct objects, which is nice. Creating a markdown table from the data frame should be trivial!
You can manually convert git log to markdown with pretty=format [1]
Something like
git log --reverse --pretty=format:'| %H | %s |'
This will output something like this:
| a8d5defb511f1e44ddea21b42aec9b03ee768253 | initial commit |
| fdd9865e9cf01bd53c4f1dc106ee603b0a730f48 | fix tests |
| 10b58e8dd9cf0b9bebbb520408f0b342df613627 | add Dockerfile |
| d039004e8073a20b5d6eab1979c1afa213b78fa3 | update README.md |
1: https://git-scm.com/docs/pretty-formats

Incosistency between RMardkown preview and pdf output

I have this latex code in an RMarkdown file in R studio:
---
title: "matrix"
date: "November 2, 2016"
output:
pdf_document: default
---
$$
\mathbf{y} = \left[\begin{array}
{rrr}
y_{1,1} \\
y_{4,3}
\end{array}\right]
\mathbf{X} = \left[\begin{array}
{rrr}
1 & 0 & 0 & 0 \\
1 & 0 & 0 & 0
\end{array}\right]
$$
The preview shows up fine in Rstudio:
But when I knit to pdf I get this error message:
! LaTeX Error: \mathbf allowed only in math mode.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.88 \$\$ \mathbf{y}
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted
How can I fix it?
Works okay if you change to an explicit math environment:
---
title: "matrix"
date: "November 2, 2016"
output:
pdf_document: default
---
\begin{equation}
\mathbf{y} = \left[\begin{array}
{r}
y_{1,1} \\
y_{4,3}
\end{array}\right]
\mathbf{X} = \left[\begin{array}
{rrrr}
1 & 0 & 0 & 0 \\
1 & 0 & 0 & 0
\end{array}\right]
\end{equation}
except you also want to fix your array alignments, otherwise
Extra alignment tab has been changed to \cr.
(you need just {r} for the first, and {rrrr} for the second)

Resources