The motivation for rmdplugr was first off to produce a cleaner latex output format for rmarkdown documents, given that the default settings modify standard latex template by introducing
All of these make changes to the, in my opinion, well-founded design choices and should be alternatives rather than the default. I understand the stance taken by the pandoc team that output should be made similar across different outputs, yet I believe that the vast majority of users—particularly of Rmarkdown—make use only of a single output format at a time.
As a secondary objective, I wanted to allow modifications of the standard latex template to allow for things such as headers and footers and author affiliations.
I did not, however, want to produce yet another custom latex template needing to be continuously updated along with the default templates, nor having to cater to different versions of pandoc, having to keep separate templates for different versions (as rmarkdown does).
rmdplugr was created to avoid such issues and does so by instead modifying the default latex template in a version-agnostic fashion. The default template is pulled by calling
The template is then modified with modifications in the form of plugins, which are merged into the latex template—sometimes replacing other material, but usually inserting new material, such as support for footers and headers.
In this way, rmdplugr doesn’t have to adapt to the pandoc version and can even be used with custom templates provided that some of the matter from the default template is left intact.
These plugins can be turned on and off via the
output
setting in the metadata block and their options are
controlled by metadata settings.
pdf_article()
Headers and footers are provided using fancyhdr for standard latex document classes and scrlayer-page for KOMA-script classes. Simply adding
in the metadata block will invoke the default settings using the
automark
option in scrlayer-page and the
default \pagestyle{fancy}
for fancyhdr.
More advanced settings can be provided by using
The default in pdf_article()
is to use indentations
rather than paragraph spacing. The trouble with this, however, is that
some of the latex environments will always be surrounded by empty lines
no matter how the text is formatted in the markdown document; this means
that the paragraph following such environments will always be indented,
which is not always wanted.
To circumvent this, the noindentafter
plugin loads the
noindentafter package, which makes sure that there is
to be no indentation after
environments. You can in fact see the result of this for the list
above, which would otherwise have required a \noindent
command before this paragraph.
The subfigs
plugin is a very small plugin that simply
makes sure that the subfigs package is loaded. It is
needed for subfigs in rmarkdown documents.
pdf_presentation()
This output format is based on the
rmarkdown::beamer_presentation()
format. It adds a couple
of plugins.
To enable frame numbering for your beamer presentations, setting
frame_numbering = TRUE
will invoke simple frame numbers at
the bottom-right of each slide.
See section @ref(subfigs).