I added to the GitHub repository Examples of use of rmarkdown for creating pdf-files an example of the use of bookdown to create with one Rmd file both html and pdf documents. The inputs can be found in the input_bookdown folder and the results in the output_bookdown folder. In the description in the .Rmd
file I wrote down my objectives:
- produce a text that would display well in both
html
andpdf
format. I could not do this without including some switches related to the output format usingknitr::is_latex_output
andknitr::is_html_output
- produce tables and figure with a caption below the table or figure with a possiblity to reference them
- use
css
files to ensure that the table entries are not too close to the borders and that the tables with caption are centered in thehtml
output. See themycss.css
file - use text references to refer to a text (optionally with special
html
orlatex
characters). This is used here only for the tables. Note that a text reference must be in a separate paragraph with empty lines above and below it - integrate the possibilities that the
myknit
function (from the HOQCutil package) offers to produce documents with a version number - use references to a bibliography and sections of text (see the files
book.bib
andpackages.bib
) - change the font of the
pdf
document to a non-serif one (see thepreamble.tex
file) - try out methods to make the document self describing concerning the creation of tables and figures. In doing this I relied heavily on the concept of zero-width space. See the
.Rmd
file in a text editor that is capable of showing zero-width spaces such as the RStudio IDE