

PDF images often have better qualities than raster images in LaTeX/PDF output.
#Rmarkdown figure code
For example, a figure caption that contains _italic text_ will not work when the output format is LaTeX/PDF, since the underscore is a special character in LaTeX, but if you use text references, _italic text_ will be translated to LaTeX code when the output is LaTeX.įIGURE 2.4: Three knitr logos included in the document from an external PNG image file. To take advantage of Markdown formatting within the figure caption, you will need to use text references (see Section 2.2.4). To reference a figure, use the syntax 6 where label is the figure label, e.g., fig:foo.

The label of a figure environment is generated from the label of the code chunk, e.g., if the chunk label is foo, the figure label will be fig:foo (the prefix fig: is added before foo). If we assign a figure caption to a code chunk via the chunk option fig.cap, R plots will be put into figure environments, which will be automatically labeled and numbered, and can also be cross-referenced. This issue does not exist in HTML, however, since everything can be placed continuously on one single page (presumably with infinite height), and there is no need to split anything across multiple pages of the same page size. This is simply a natural consequence of having to typeset things on multiple pages of fixed sizes.

That is, readers may have to jump to a different page to find the figure mentioned on the current page. There is also a disadvantage of floating things forward or backward, though. That is basically why there are “floating environments” in LaTeX: elements that cannot be split over multiple pages (like figures) are put in floating environments, so they can float to a page that has enough space to hold them. The disadvantage of typesetting figures in this way is that when there is not enough space on the current page to place a figure, it may either reach the bottom of the page (hence exceeds the page margin), or be pushed to the next page, leaving a large white margin at the bottom of the current page. 6.2.6 Optional: change the default subdomain.6.2.1 The build-and-deploy pipeline sequence.
