Let’s summarize what we have seen so far and preview what is to come. Rendering R Markdown documents with rmarkdown consists of converting .Rmd to .md with knitr , and then .m...
As mentioned in Section 7.4 , we can fold source code chunks via the option code_folding: hide in the html_document format. Currently it is not possible to fold output blocks, b...
LaTeX and HTML are two commonly used output formats. The function knitr::is_latex_output() tells you if the output format is LaTeX (including Pandoc output formats latex and bea...
Using an R function to write raw HTML or LaTeX code Using a Pandoc Lua filter (*) The Markdown syntax has no built-in method for changing text colors. We can use HTML and LaTeX ...
References You can add line numbers to either source code blocks, via the chunk option attr.source = ".numberLines" , or text output blocks, via attr.output = ".numberLines" (se...
References We strongly recommend that you learn some CSS and JavaScript if you wish to customize the appearance of HTML documents. Appendix B of the blogdown book (Xie, Hill, a...
We mentioned LaTeX templates in Section 6.10 . You can also specify a custom HTML template for Pandoc to convert Markdown to HTML. Below is a brief example template: <html> ...
Show a verbatim inline expression Typically we write code chunks and inline expressions that we want to be parsed and evaluated by knitr . However, if you are trying to write a t...
Sometimes the text output printed from R code may be too wide. If the output document has a fixed page width (e.g., PDF documents), the text output may exceed the page margins. Se...
References[] One main advantage of R Markdown is that it can create multiple output formats from a single source, which could be one or multiple Rmd documents. For example, this ...