| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/ioslides_presentation.R |
| 3 |
\name{ioslides_presentation} |
| 4 |
\alias{ioslides_presentation} |
| 5 |
\title{Convert to an ioslides Presentation} |
| 6 |
\usage{ |
| 7 |
ioslides_presentation( |
| 8 |
number_sections = FALSE, |
| 9 |
logo = NULL, |
| 10 |
slide_level = 2, |
| 11 |
incremental = FALSE, |
| 12 |
fig_width = 7.5, |
| 13 |
fig_height = 4.5, |
| 14 |
fig_retina = 2, |
| 15 |
fig_caption = TRUE, |
| 16 |
dev = "png", |
| 17 |
df_print = "default", |
| 18 |
smart = TRUE, |
| 19 |
self_contained = TRUE, |
| 20 |
widescreen = FALSE, |
| 21 |
smaller = FALSE, |
| 22 |
transition = "default", |
| 23 |
math_method = "mathjax", |
| 24 |
mathjax = "default", |
| 25 |
analytics = NULL, |
| 26 |
template = NULL, |
| 27 |
css = NULL, |
| 28 |
includes = NULL, |
| 29 |
keep_md = FALSE, |
| 30 |
lib_dir = NULL, |
| 31 |
md_extensions = NULL, |
| 32 |
pandoc_args = NULL, |
| 33 |
extra_dependencies = NULL, |
| 34 |
... |
| 35 |
) |
| 36 |
} |
| 37 |
\arguments{ |
| 38 |
\item{number_sections}{\code{TRUE} to number section headings} |
| 39 |
|
| 40 |
\item{logo}{Path to file that includes a logo for use in the presentation |
| 41 |
(should be square and at least 128x128).} |
| 42 |
|
| 43 |
\item{slide_level}{Header level to consider as slide separator (Defaults to |
| 44 |
header 2).} |
| 45 |
|
| 46 |
\item{incremental}{\code{TRUE} to render slide bullets incrementally. |
| 47 |
Note that if you want to reverse the default incremental behavior for an |
| 48 |
individual bullet you can preceded it with \code{>}. |
| 49 |
For example: \emph{\verb{> - Bullet Text}}.} |
| 50 |
|
| 51 |
\item{fig_width}{Default width (in inches) for figures} |
| 52 |
|
| 53 |
\item{fig_height}{Default height (in inches) for figures} |
| 54 |
|
| 55 |
\item{fig_retina}{Scaling to perform for retina displays (defaults to 2, which |
| 56 |
currently works for all widely used retina displays). Set to \code{NULL} to |
| 57 |
prevent retina scaling. Note that this will always be \code{NULL} when |
| 58 |
\code{keep_md} is specified (this is because \code{fig_retina} relies on |
| 59 |
outputting HTML directly into the markdown document).} |
| 60 |
|
| 61 |
\item{fig_caption}{\code{TRUE} to render figures with captions} |
| 62 |
|
| 63 |
\item{dev}{Graphics device to use for figure output (defaults to png)} |
| 64 |
|
| 65 |
\item{df_print}{Method to be used for printing data frames. Valid values |
| 66 |
include "default", "kable", "tibble", and "paged". The "default" method |
| 67 |
uses a corresponding S3 method of \code{print}, typically |
| 68 |
\code{print.data.frame}. The "kable" method uses the |
| 69 |
\code{\link[knitr:kable]{knitr::kable}} function. The "tibble" method uses |
| 70 |
the \pkg{tibble} package to print a summary of the data frame. The "paged" |
| 71 |
method creates a paginated HTML table (note that this method is only valid |
| 72 |
for formats that produce HTML). In addition to the named methods you can |
| 73 |
also pass an arbitrary function to be used for printing data frames. You |
| 74 |
can disable the \code{df_print} behavior entirely by setting the option |
| 75 |
\code{rmarkdown.df_print} to \code{FALSE}. See |
| 76 |
\href{https://yihui.org/rmarkdown/html-document.html#data-frame-printing}{Data |
| 77 |
frame printing section} in bookdown book for examples.} |
| 78 |
|
| 79 |
\item{smart}{Produce typographically correct output, converting straight |
| 80 |
quotes to curly quotes, \verb{---} to em-dashes, \verb{--} to en-dashes, and |
| 81 |
\code{...} to ellipses.} |
| 82 |
|
| 83 |
\item{self_contained}{Produce a standalone HTML file with no external |
| 84 |
dependencies, using data: URIs to incorporate the contents of linked |
| 85 |
scripts, stylesheets, images, and videos. Note that even for self contained |
| 86 |
documents MathJax is still loaded externally (this is necessary because of |
| 87 |
its size).} |
| 88 |
|
| 89 |
\item{widescreen}{Display presentation with wider dimensions.} |
| 90 |
|
| 91 |
\item{smaller}{Use smaller text on all slides. You can also enable this for |
| 92 |
individual slides by adding the \code{.smaller} attribute to the slide |
| 93 |
header (see \emph{Presentation Size} below for details).} |
| 94 |
|
| 95 |
\item{transition}{Speed of slide transitions. This can be "default", |
| 96 |
"slower", "faster", or a numeric value with a number of seconds (e.g. 0.5).} |
| 97 |
|
| 98 |
\item{math_method}{Math rendering engine to use. This will define the math method to use with Pandoc. |
| 99 |
\itemize{ |
| 100 |
\item It can be a string for the engine, one of "mathjax", "mathml", "webtex", "katex", "gladtex", or "r-katex" |
| 101 |
or "default" for \code{mathjax}. |
| 102 |
\item It can be a list of |
| 103 |
\itemize{ |
| 104 |
\item \code{engine}: one of |
| 105 |
"mathjax", "mathml", "webtex", "katex", or "gladtex". |
| 106 |
\item \code{url}: A specific url to use with \code{mathjax}, \code{katex} or \code{webtex}. |
| 107 |
Note that for \code{engine = "mathjax"}, \code{url = "local"} will use a local version of MathJax (which is |
| 108 |
copied into the output directory). |
| 109 |
} |
| 110 |
} |
| 111 |
|
| 112 |
For example, |
| 113 |
|
| 114 |
\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{output: |
| 115 |
html_document: |
| 116 |
math_method: |
| 117 |
engine: katex |
| 118 |
url: https://cdn.jsdelivr.net/npm/[email protected]/dist/ |
| 119 |
}\if{html}{\out{</div>}} |
| 120 |
|
| 121 |
See \href{https://pandoc.org/MANUAL.html#math-rendering-in-html}{Pandoc's Manual about Math in HTML} for the details |
| 122 |
about Pandoc supported methods. |
| 123 |
|
| 124 |
Using \code{math_method = "r-katex"} will opt-in server side rendering using |
| 125 |
KaTeX thanks to \href{https://docs.ropensci.org/katex/}{katex} R package. This is |
| 126 |
useful compared to \code{math_method = "katex"} to have no JS dependency, only a |
| 127 |
CSS dependency for styling equation.} |
| 128 |
|
| 129 |
\item{mathjax}{Include mathjax. The "default" option uses an https URL from a |
| 130 |
MathJax CDN. The "local" option uses a local version of MathJax (which is |
| 131 |
copied into the output directory). You can pass an alternate URL or pass |
| 132 |
\code{NULL} to exclude MathJax entirely.} |
| 133 |
|
| 134 |
\item{analytics}{A Google analytics property ID.} |
| 135 |
|
| 136 |
\item{template}{Pandoc template to use for rendering. Pass "default" to use |
| 137 |
the rmarkdown package default template; pass \code{NULL} to use pandoc's |
| 138 |
built-in template; pass a path to use a custom template that you've created. |
| 139 |
Note that if you don't use the "default" template then some features of |
| 140 |
\code{html_document} won't be available (see the Templates section below for |
| 141 |
more details).} |
| 142 |
|
| 143 |
\item{css}{One or more css files to include.} |
| 144 |
|
| 145 |
\item{includes}{Named list of additional content to include within the |
| 146 |
document (typically created using the \code{\link{includes}} function).} |
| 147 |
|
| 148 |
\item{keep_md}{Keep the markdown file generated by knitting.} |
| 149 |
|
| 150 |
\item{lib_dir}{Directory to copy dependent HTML libraries (e.g. jquery, |
| 151 |
bootstrap, etc.) into. By default this will be the name of the document with |
| 152 |
\verb{_files} appended to it.} |
| 153 |
|
| 154 |
\item{md_extensions}{Markdown extensions to be added or removed from the |
| 155 |
default definition of R Markdown. See the \code{\link{rmarkdown_format}} for |
| 156 |
additional details.} |
| 157 |
|
| 158 |
\item{pandoc_args}{Additional command line options to pass to pandoc} |
| 159 |
|
| 160 |
\item{extra_dependencies}{Extra dependencies as a list of the |
| 161 |
\code{html_dependency} class objects typically generated by |
| 162 |
\code{\link[htmltools:htmlDependency]{htmltools::htmlDependency()}}.} |
| 163 |
|
| 164 |
\item{...}{Additional function arguments to pass to the base R Markdown HTML |
| 165 |
output formatter \code{\link{html_document_base}}} |
| 166 |
} |
| 167 |
\value{ |
| 168 |
R Markdown output format to pass to \code{\link[=render]{render()}}. |
| 169 |
} |
| 170 |
\description{ |
| 171 |
Format for converting from R Markdown to an |
| 172 |
\href{https://code.google.com/archive/p/io-2012-slides/}{ioslides} presentation. |
| 173 |
} |
| 174 |
\details{ |
| 175 |
See the \href{https://yihui.org/rmarkdown/ioslides-presentation.html}{ online documentation} for additional details on using the |
| 176 |
\code{ioslides_presentation} format. |
| 177 |
|
| 178 |
Note that, if a \code{before_body} include is specified in \code{includes}, |
| 179 |
then it will replace the standard title slide entirely. |
| 180 |
|
| 181 |
Regarding previewing slide in RStudio IDE, \code{ioslides_presentation()} will |
| 182 |
always open preview in a new Window and the RStudio IDE configuration "Open in Viewer |
| 183 |
Pane" will have no effect for this format. |
| 184 |
} |
| 185 |
\section{Slide Basics}{ |
| 186 |
|
| 187 |
You can create a slide show broken up into sections by using the # and ## |
| 188 |
heading tags (you can also create a new slide without a header using a |
| 189 |
horizontal rule (\verb{----------}). For example here's a simple slide show: |
| 190 |
|
| 191 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{--- |
| 192 |
title: "Habits" |
| 193 |
author: John Doe |
| 194 |
date: March 22, 2005 |
| 195 |
output: ioslides_presentation |
| 196 |
--- |
| 197 |
|
| 198 |
# In the morning |
| 199 |
|
| 200 |
## Getting up |
| 201 |
|
| 202 |
- Turn off alarm |
| 203 |
- Get out of bed |
| 204 |
|
| 205 |
## Breakfast |
| 206 |
|
| 207 |
- Eat eggs |
| 208 |
- Drink coffee |
| 209 |
|
| 210 |
# In the evening |
| 211 |
|
| 212 |
## Dinner |
| 213 |
|
| 214 |
- Eat spaghetti |
| 215 |
- Drink wine |
| 216 |
|
| 217 |
---------- |
| 218 |
|
| 219 |
 |
| 220 |
|
| 221 |
## Going to sleep |
| 222 |
|
| 223 |
- Get in bed |
| 224 |
- Count sheep |
| 225 |
}\if{html}{\out{</div>}} |
| 226 |
|
| 227 |
You can add a subtitle to a slide or section by including text after the |
| 228 |
pipe (|) character. For example: |
| 229 |
|
| 230 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## Getting up | What I like to do first thing |
| 231 |
}\if{html}{\out{</div>}} |
| 232 |
} |
| 233 |
|
| 234 |
\section{Display Modes}{ |
| 235 |
|
| 236 |
The following single character keyboard shortcuts enable alternate display |
| 237 |
modes: |
| 238 |
\describe{ |
| 239 |
\item{\code{'f'} }{enable fullscreen mode} |
| 240 |
\item{\code{'w'} }{toggle widescreen mode} |
| 241 |
\item{\code{'o'} }{enable overview mode} |
| 242 |
\item{\code{'h'} }{enable code highlight mode} |
| 243 |
\item{\code{'p'} }{show presenter notes} |
| 244 |
} |
| 245 |
Pressing \code{Esc} exits all of these modes. See the sections below on |
| 246 |
\emph{Code Highlighting} and \emph{Presenter Mode} for additional |
| 247 |
detail on those modes. |
| 248 |
} |
| 249 |
|
| 250 |
\section{Incremental Bullets}{ |
| 251 |
|
| 252 |
You can render bullets incrementally by adding the \code{incremental} |
| 253 |
option: |
| 254 |
|
| 255 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{--- |
| 256 |
output: |
| 257 |
ioslides_presentation: |
| 258 |
incremental: true |
| 259 |
--- |
| 260 |
}\if{html}{\out{</div>}} |
| 261 |
|
| 262 |
If you want to render bullets incrementally for some slides but not |
| 263 |
others you can use this syntax: |
| 264 |
|
| 265 |
\if{html}{\out{<div class="sourceCode">}}\preformatted{> - Eat eggs |
| 266 |
> - Drink coffee |
| 267 |
}\if{html}{\out{</div>}} |
| 268 |
} |
| 269 |
|
| 270 |
\section{Presentation Size}{ |
| 271 |
|
| 272 |
You can display the presentation using a wider form factor using the |
| 273 |
\code{widescreen} option. You can specify that smaller text be used with |
| 274 |
the \code{smaller} option. For example: |
| 275 |
|
| 276 |
\if{html}{\out{<div class="sourceCode yaml">}}\preformatted{--- |
| 277 |
output: |
| 278 |
ioslides_presentation: |
| 279 |
widescreen: true |
| 280 |
smaller: true |
| 281 |
--- |
| 282 |
}\if{html}{\out{</div>}} |
| 283 |
|
| 284 |
You can also enable the \code{smaller} option on a slide-by-slide basis |
| 285 |
by adding the \code{.smaller} attribute to the slide header: |
| 286 |
|
| 287 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## Getting up \{.smaller\} |
| 288 |
}\if{html}{\out{</div>}} |
| 289 |
} |
| 290 |
|
| 291 |
\section{Adding a Logo}{ |
| 292 |
|
| 293 |
You can add a logo to the presentation using the \code{logo} option (the |
| 294 |
logo should be square and at least 128x128). For example: |
| 295 |
|
| 296 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{--- |
| 297 |
output: |
| 298 |
ioslides_presentation: |
| 299 |
logo: logo.png |
| 300 |
--- |
| 301 |
}\if{html}{\out{</div>}} |
| 302 |
|
| 303 |
A 128x128 version of the logo graphic will be added to the title slide and |
| 304 |
an icon version of the logo will be included in the bottom-left footer of |
| 305 |
each slide. |
| 306 |
} |
| 307 |
|
| 308 |
\section{Build Slides}{ |
| 309 |
|
| 310 |
Slides can also have a \code{.build} attribute that indicate that their |
| 311 |
content should be displayed incrementally. For example: |
| 312 |
|
| 313 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## Getting up \{.build\} |
| 314 |
}\if{html}{\out{</div>}} |
| 315 |
|
| 316 |
Slide attributes can be combined if you need to specify more than one, |
| 317 |
for example: |
| 318 |
|
| 319 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## Getting up \{.smaller .build\} |
| 320 |
}\if{html}{\out{</div>}} |
| 321 |
} |
| 322 |
|
| 323 |
\section{Code Highlighting}{ |
| 324 |
|
| 325 |
It's possible to select subsets of code for additional emphasis by adding a |
| 326 |
special "highlight" comment around the code. For example: |
| 327 |
|
| 328 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{### <b> |
| 329 |
x <- 10 |
| 330 |
y <- x * 2 |
| 331 |
### </b> |
| 332 |
}\if{html}{\out{</div>}} |
| 333 |
|
| 334 |
The highlighted region will be displayed with a bold font. When you want to |
| 335 |
help the audience focus exclusively on the highlighted region press the |
| 336 |
\code{'h'} key and the rest of the code will fade away. |
| 337 |
} |
| 338 |
|
| 339 |
\section{Tables}{ |
| 340 |
|
| 341 |
The ioslides template has an attractive default style for tables so you |
| 342 |
shouldn't hesitate to add tables for presenting more complex sets of |
| 343 |
information. Pandoc markdown supports several syntaxes for defining |
| 344 |
tables which are described in the |
| 345 |
\href{https://pandoc.org/MANUAL.html}{pandoc online documentation}. |
| 346 |
} |
| 347 |
|
| 348 |
\section{Advanced Layout}{ |
| 349 |
|
| 350 |
You can center content on a slide by adding the \code{.flexbox} |
| 351 |
and \code{.vcenter} attributes to the slide title. For example: |
| 352 |
|
| 353 |
\if{html}{\out{<div class="sourceCode markdown">}}\preformatted{## Dinner \{.flexbox .vcenter\} |
| 354 |
}\if{html}{\out{</div>}} |
| 355 |
|
| 356 |
You can horizontally center content by enclosing it in a \code{div} tag |
| 357 |
with class \code{centered}. For example: |
| 358 |
|
| 359 |
\if{html}{\out{<div class="sourceCode html">}}\preformatted{<div class="centered"> |
| 360 |
This text is centered. |
| 361 |
</div> |
| 362 |
}\if{html}{\out{</div>}} |
| 363 |
|
| 364 |
You can do a two-column layout using the \code{columns-2} class. |
| 365 |
For example: |
| 366 |
|
| 367 |
\if{html}{\out{<div class="sourceCode">}}\preformatted{<div class="columns-2"> |
| 368 |
 |
| 369 |
|
| 370 |
- Bullet 1 |
| 371 |
- Bullet 2 |
| 372 |
- Bullet 3 |
| 373 |
</div> |
| 374 |
}\if{html}{\out{</div>}} |
| 375 |
|
| 376 |
Note that content will flow across the columns so if you want to |
| 377 |
have an image on one side and text on the other you should make |
| 378 |
sure that the image has sufficient height to force the text to |
| 379 |
the other side of the slide. |
| 380 |
} |
| 381 |
|
| 382 |
\section{Text Color}{ |
| 383 |
|
| 384 |
You can color content using base color classes red, blue, green, yellow, |
| 385 |
and gray (or variations of them e.g. red2, red3, blue2, blue3, etc.). |
| 386 |
For example: |
| 387 |
|
| 388 |
\if{html}{\out{<div class="sourceCode html">}}\preformatted{<div class="red2"> |
| 389 |
This text is red |
| 390 |
</div> |
| 391 |
}\if{html}{\out{</div>}} |
| 392 |
} |
| 393 |
|
| 394 |
\section{Presenter Mode}{ |
| 395 |
|
| 396 |
A separate presenter window can also be opened (ideal for when you are |
| 397 |
presenting on one screen but have another screen that's private to you). |
| 398 |
The window stays in sync with the main presentation window and also |
| 399 |
shows presenter notes and a thumbnail of the next slide. To enable |
| 400 |
presenter mode add \code{?presentme=true} to the URL of the presentation, |
| 401 |
for example: |
| 402 |
|
| 403 |
\if{html}{\out{<div class="sourceCode">}}\preformatted{mypresentation.html?presentme=true |
| 404 |
}\if{html}{\out{</div>}} |
| 405 |
|
| 406 |
The presenter mode window will open and will always re-open with the |
| 407 |
presentation until it's disabled with: |
| 408 |
|
| 409 |
\if{html}{\out{<div class="sourceCode">}}\preformatted{mypresentation.html?presentme=false |
| 410 |
}\if{html}{\out{</div>}} |
| 411 |
|
| 412 |
To add presenter notes to a slide you include it within a "notes" |
| 413 |
\code{div}. For example: |
| 414 |
|
| 415 |
\if{html}{\out{<div class="sourceCode">}}\preformatted{<div class="notes"> |
| 416 |
This is my *note*. |
| 417 |
|
| 418 |
- It can contain markdown |
| 419 |
- like this list |
| 420 |
|
| 421 |
</div> |
| 422 |
}\if{html}{\out{</div>}} |
| 423 |
} |
| 424 |
|
| 425 |
\section{Printing and PDF Output}{ |
| 426 |
|
| 427 |
You can print an ioslides presentation from within browsers that have |
| 428 |
good support for print CSS (i.e. as of this writing Google Chrome |
| 429 |
has the best support). Printing maintains most of the visual styles |
| 430 |
of the HTML version of the presentation. |
| 431 |
|
| 432 |
To create a PDF version of a presentation you can use Print to PDF |
| 433 |
from Google Chrome. |
| 434 |
} |
| 435 |
|