fName = 'slides.Rmd'
Makefile = system.file('src','knitrMakefile', package='Pmisc')
toCompile = paste("make -f ", Makefile, ' ', gsub("Rmd$","pdf", fName), sep='')
toCompile

# packages
library('knitr')
library('Pmisc')

# hook for multicolumn plots
knitr::knit_hooks$set(plot=Pmisc::hook_plot_beamer) 

# hook for smaller plot margins
knitr::knit_hooks$set(
    margins = Pmisc::hook_plot_margins
)

# hook for half width
knitr::opts_hooks$set(half = function(options) {
  options$tidy.opts = list(width.cutoff = options$tidy.opts$width.cutoff/2)
  options
})

# default chunk options
knitr::opts_chunk$set(echo=FALSE, prompt=TRUE, comment=NA,
        dev='pdf', margins=1, fig.start='#',
        fig.width=8, fig.height=4.5, half=NULL,
        tidy=TRUE,tidy.opts=list(indent=2, width.cutoff=55)
)

options(width=80)

# write a bibliography
knitr::write_bib(
    c('geostatsp', 'knitr'),
    file='myBib.bib'
)
Pmisc::markdownHeader(
    title="Pmisc slides example",       
    author='Patrick Brown',
    bibliography='myBib.bib',
    theme='Singapore',
    beamer=TRUE,
    classoption=c(
        aspectratio=169,
        xcolor='dvipsnames'),
    biblatexoptions = c(
        maxbibnames=20,
        maxcitenames=2,doi='false'),
    headerincludes =c(
        '\\usecolortheme[named=MidnightBlue]{structure}',
        '\\DeclareMathOperator{\\var}{var}',
        '\\DeclareMathOperator{\\E}{E}')
)
cat(
        Pmisc::markdownHeader(
                title="Pmisc slides example",       
                author='Patrick Brown',
                bibliography='myBib.bib',
                theme='Singapore',
                beamer=TRUE,
                classoption=c(
                        aspectratio=169,
                        xcolor='dvipsnames'),
                biblatexoptions = c(
                        maxbibnames=20,
                        maxcitenames=2,doi='false'),
                headerincludes =c(
                        '\\usecolortheme[named=MidnightBlue]{structure}',
                        '\\DeclareMathOperator{\\var}{var}',
                        '\\DeclareMathOperator{\\E}{E}')
        )
)

Some references

Markdown citations

plot(1:10)

plot(1:10+2)


plot(1:10-4)


plot(1:10+4)

A few more plots

\bcolb{Code}

plot(rnorm(10), xlab='index', ylab='value', pch=1:10)

plot(runif(10), xlab='index', ylab='value', pch=1:10)

\newcolb{Output}


\ecolb



Try the Pmisc package in your browser

Any scripts or data that you put into this service are public.

Pmisc documentation built on Feb. 14, 2024, 3 a.m.