---
title: "Discussion on \"Include R code in an Rmarkdown figure caption\" | Hashnode"
description: "Discussion on \"Include R code in an Rmarkdown figure caption\". Here how to include R code in an Rmarkdown with figure caption and then save to PDF file.\nUse fig_caption: true in your YAML and opts_knit$set(eval.after = \"fig.cap\")\n\ntitle: \"Example\"\noutput:\n  pdf_document:\n    fig_caption: true\n```{r parameters}\nl..."
url: "https://hashnode.com/posts/include-r-code-in-an-rmarkdown-figure-caption/64ac25f3395b682e51ab9cda"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Include R code in an Rmarkdown figure caption](https://testandoptimize.com/include-r-code-in-an-rmarkdown-figure-caption?utm_source=hashnode&utm_medium=feed)

Here how to include R code in an Rmarkdown with figure caption and then save to PDF file. Use fig\_caption: true in your YAML and opts\_knit$set(eval.after = "fig.cap") title: "Example" output: pdf\_document: fig\_caption: true \`\`\`{r parameters} l...

Jan 18, 2019 · 1 min read · testandoptimize.com  
Read the article

## Written by

[Mr. Yap](https://hashnode.com/@mryap)

@mryap · Singapore

  
[View profile](https://hashnode.com/@mryap)

Pivoting to Data Privacy and Governance after a decade helping organizations thrive through re-platforming, digital analytics, and marketing automation. I specialize in translating abstract frameworks into actionable practices ensuring growth and protection work in tandem.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
