

If you don’t specify scap too addCap the short caption will be taken as the fig-scap: markup, or if that is missing, the full caption. The full caption is taken as the fig-cap: markup.
KNITR TO PDF SHRINK FIGURE SIZE CODE
To use those, put addCap() or addCap(scap="short caption for figure") as the first line of code in the chunk. The reptools repository has helper functions for building a table of figures. If you don’t need to caption or cross-reference the figure use e.g. To include an existing image while making use of Quarto for sizing and captioning etc. If the code produces multiple plots you can combine them into one with a single overall caption and include subcaptions for the individual panels: #| fig-cap: “An example caption (use one long line for caption)” The figure can be cross-referenced elsewhere in the document using for example See Figure will be placed in front of the figure number automatically.

Captions are ignored unless a figure is given a label. One can specify sizes, layouts, captions, and more using Quarto markup. Knit_print <- knitr ::normal_print 4.1 Quarto Syntax for Figures inline is more for printing character strings.Īn example of something that may not render correctly due to results='asis' being in the chunk header (needed for html(.)): If you specify inline=x the object x is printed with cat() instead of print(). If the argument obj to pr is a data frame or data table, variables will be rounded to the value given in the argument dec (default dec=3) before printing.

pr is defined in the marksupSpecs$markdown$pr object, so you can bring it to your session by copying into a local function pr as shown below, which has a chunk option results='asis' to show that verbatim output appears anyway. If so, the object is surrounded by the markdown verbatim indicator-three consecutive back ticks. To do that a simple function pr can sense if results='asis' is in effect for the current chunk. To prevent this from happening you either need to split the chunks into multiple chunks (some with results='asis' and some not) or you need to make it clear that parts of the output are to be typeset verbatim. This process works smoothly but creates one complication: if you print an object that produces plain text in the same code chunk, the system will try to typeset it in html or \(\LaTeX\). To make use of specialized functions that produce html or \(\LaTeX\) markup, one often has to put results='asis' in the code chunk header to keep the system from disturbing the generated html or \(\LaTeX\) markup so that it will be typeset correctly in the final document.
