Overleaf provides an integration with knitr, which allows you to add R code to your LaTeX document to generate a dynamic output.Documents that contain R code must be saved with the extension .Rtex or .Rnw, otherwise the code won’t work. Let’s see an example:
\documentclass{article}\begin{document}You can type R commands in your \LaTeX{} document which will be processed and their output included in the document:<<>>=# Create a sequence of numbersX = 2:10# Display basic statistical measuressummary(X)@\end{document}
Open this knitr example on OverleafAs you can see, the text in between the characters <<>>= and @ is R code. This code and its output is printed in a listing-like format. This chunk of code can take some extra parameters to customize the dynamic output, as described in the next section.
Chunks of code
A code block like the one presented in the previous section is usually called a chunk. You can set some extra options in knitr chunks. See the example below:
\documentclass{article}\begin{document}You can type R commands in your \LaTeX{} document which will be processed and their output included in the document:<<echo=FALSE, cache=TRUE>>=# Create a sequence of numbersX = 2:10# Display basic statistical measuressummary(X)@\end{document}
It is possible to access objects generated in a chunk and print them in-line.
\documentclass{article}\begin{document}You can type R commands in your \LaTeX{} document which will be processed and their output included in the document:<<echo=FALSE, cache=TRUE>>=# Create a sequence of numbersX = 2:10# Display basic statistical measuressummary(X)@So, the mean of the data is $\Sexpr{mean(X)}$\end{document}
Open this knitr example on OverleafThe command \Sexpr{mean(X)} prints the output returned by the R code mean(X). Inside the braces, any R command can be passed.
Plots
Plots can also be added to a knitr document, as in this example:
Open this knitr example on OverleafThis histogram uses data stored in “data.txt”, saved in the current working directory. A few figure-related options are passed to the chunk.plot1This is the label used to reference the plot. The prefix “fig:” is mandatory. You can see in the example that the figure is referenced with \ref{fig:plot1}.fig.pos="t" positioning parameter. This is the same used in the figure environment.fig.height=4, fig.width=4Figure width and height.fig.cap="First plot"Caption for the figure.
External R scripts
You can import parts of an external R script into a knitr document. This is very helpful since it is fairly common to write and debug the script in an external program prior to including it in your document.Suppose we have the following R code in a file called mycode.R which we include in our LaTeX document:
## ---- myrcode1# Create a sequence of numbers X = 2:10## ---- myrcode2# Display basic statistical measuressummary(X)
Notice the lines:
## ---- myrcode1
and
## ---- myrcode2
These mark the beginning of a chunk of code and are mandatory if you want to use this script in our document, as shown in the following code fragment:
The chunk below will not be printed<<echo=FALSE, cache=FALSE>>=read_chunk("mycode.R")@The code must show up here<<myrcode2>>=@
The first chunk is not printed and is only used to import the script with the command read_chunk("mycode.R") . That’s why the option echo=FALSE is set. Also, scripts must not be cached. Once the script is imported, you can print a chunk using the label you set after ## ----. In this case it’s myrcode2.We have put all the article code fragments into a project that you can Open on Overleaf .
Reference guide
Some chunk options:
results. Changes the behavior of the results generated by the R code. Possible values are:
markup Use LaTeX to format the output.
asis Print raw results from R.
hold Hold the output results and push them to the end of the chunk.
hide Hide results.
echo. Whether to include the R source code. Other parameters include:
echo=2:3 prints only the second and third lines;
echo=-2:-3 excludes the second and third lines only.
cache. Whether to cache the code chunk. Possible values are: TRUE and FALSE
highlight. Whether to highlight the source code. Possible values are: TRUE and FALSE
background. Background color of the chunk. rgb and HTML formats can be used. The default value is “#F7F7F7”.
Last modified on October 4, 2026
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Ayakaleaf Pro","description":"Overleaf Community Edition enhanced with all Pro features: open source, free to use, self-hostable.","colors":{"primary":"#0E0E0E","light":"#D4A27F","dark":"#0E0E0E"},"logo":{"light":"https://mintcdn.com/ayakaleaf-pro/JetHeEeglWIIXNds/logo/light.png?fit=max\u0026auto=format\u0026n=JetHeEeglWIIXNds\u0026q=85\u0026s=7f1abd8dcc74dd3b7cdafac9e6e82092","dark":"https://mintcdn.com/ayakaleaf-pro/JetHeEeglWIIXNds/logo/dark.png?fit=max\u0026auto=format\u0026n=JetHeEeglWIIXNds\u0026q=85\u0026s=4e369d29a8c5a6cd8b4b7697ddb1f7e2","href":"/"},"favicon":"https://mintcdn.com/ayakaleaf-pro/x9kfDjtWlyyhG_mR/favicon.png?fit=max\u0026auto=format\u0026n=x9kfDjtWlyyhG_mR\u0026q=85\u0026s=832c6bfafce5eb69ebc83783083a4a85","background":{"color":{"light":"#FDFDF7","dark":"#09090B"}},"navbar":{"links":[{"href":"https://github.com/ayaka-notes/ayakaleaf-pro-playground","label":"Playground"},{"href":"https://github.com/orgs/ayaka-notes/packages/container/package/overleaf-pro","label":"Docker Image"},{"href":"https://github.com/ayaka-notes/texlive-full","label":"TeXLive Full"}],"primary":{"type":"button","label":"Open GitHub","href":"https://github.com/ayaka-notes/ayakaleaf-pro"}},"footer":{"socials":{"github":"https://github.com/ayaka-notes"}},"styling":{"latex":true},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode","assistant","download-pdf","download-spec"],"display":"header"},"metadata":{"timestamp":true},"navigation":{"languages":[{"language":"en","default":true,"href":""},{"language":"zh-CN","href":"zh-CN"},{"language":"zh-TW","href":"zh-TW"},{"language":"ja","href":"ja"},{"language":"de","href":"de"},{"language":"fr","href":"fr"},{"language":"es","href":"es"},{"language":"it","href":"it"},{"language":"ko","href":"ko"},{"language":"ru","href":"ru"},{"language":"nl","href":"nl"},{"language":"pt","href":"pt"},{"language":"tr","href":"tr"},{"language":"uk","href":"uk"},{"language":"pl","href":"pl"},{"language":"cs","href":"cs"},{"language":"sv","href":"sv"},{"language":"fi","href":"fi"},{"language":"ar","href":"ar"},{"language":"vi","href":"vi"},{"language":"no","href":"no"},{"language":"da","href":"da"},{"language":"id","href":"id"},{"language":"zh-Hans","href":"zh-Hans"},{"language":"zh-Hant","href":"zh-Hant"}]}},"deployment":{"deploymentMetadataValue":{"subdomain":"ayakaleaf-pro","hasAudioNarration":false,"actualSubdomain":"ayakaleaf-pro","customDomains":[],"gitSource":{"type":"github","owner":"ayaka-notes","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":false,"mountPath":"","label":""},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b015084275034e27381e646","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"en","tag":"On-Premises","count":159},{"language":"ar","tag":"الاستضافة المحلية","count":141},{"language":"cs","tag":"On-Premises","count":141},{"language":"da","tag":"On-premises","count":141},{"language":"de","tag":"On-Premises","count":141},{"language":"es","tag":"Local","count":141},{"language":"fi","tag":"Paikallinen asennus","count":141},{"language":"fr","tag":"Sur site","count":141},{"language":"id","tag":"On-Premises","count":141},{"language":"it","tag":"On-premise","count":141},{"language":"ja","tag":"オンプレミス","count":141},{"language":"ko","tag":"온프레미스","count":141},{"language":"nl","tag":"On-premises","count":141},{"language":"no","tag":"Lokal drift","count":141},{"language":"pl","tag":"On-Premises","count":141},{"language":"pt","tag":"On-Premises","count":141},{"language":"ru","tag":"Локальное развертывание","count":141},{"language":"sv","tag":"On-Premises","count":141},{"language":"tr","tag":"Şirket İçi Kurulum","count":141},{"language":"uk","tag":"Локальне розгортання","count":141},{"language":"vi","tag":"Tự triển khai (On-Premises)","count":141},{"language":"zh-CN","tag":"本地部署","count":141},{"language":"zh-Hans","tag":"本地部署","count":141},{"language":"zh-Hant","tag":"本地部署","count":141},{"language":"zh-TW","tag":"本地部署","count":141},{"language":"ar","tag":"الإعداد","count":66},{"language":"en","tag":"Configuration","count":66},{"language":"cs","tag":"Konfigurace","count":66},{"language":"da","tag":"Konfiguration","count":66},{"language":"de","tag":"Konfiguration","count":66},{"language":"es","tag":"Configuración","count":66},{"language":"fi","tag":"Määritys","count":66},{"language":"fr","tag":"Configuration","count":66},{"language":"id","tag":"Konfigurasi","count":66},{"language":"it","tag":"Configurazione","count":66},{"language":"ja","tag":"設定","count":66},{"language":"ko","tag":"구성","count":66},{"language":"nl","tag":"Configuratie","count":66},{"language":"no","tag":"Konfigurasjon","count":66},{"language":"pl","tag":"Konfiguracja","count":66},{"language":"pt","tag":"Configuração","count":66},{"language":"ru","tag":"Настройка","count":66},{"language":"sv","tag":"Konfiguration","count":66},{"language":"tr","tag":"Yapılandırma","count":66},{"language":"uk","tag":"Конфігурація","count":66},{"language":"vi","tag":"Cấu hình","count":66},{"language":"zh-CN","tag":"配置","count":66},{"language":"zh-Hans","tag":"配置","count":66},{"language":"zh-Hant","tag":"設定","count":66},{"language":"zh-TW","tag":"設定","count":66},{"language":"en","tag":"Developer","count":57},{"language":"ar","tag":"التثبيت","count":40},{"language":"en","tag":"Installation","count":40},{"language":"cs","tag":"Instalace","count":40},{"language":"da","tag":"Installation","count":40},{"language":"de","tag":"Installation","count":40},{"language":"es","tag":"Instalación","count":40},{"language":"fi","tag":"Asennus","count":40},{"language":"fr","tag":"Installation","count":40},{"language":"id","tag":"Instalasi","count":40},{"language":"it","tag":"Installazione","count":40},{"language":"ja","tag":"インストール","count":40},{"language":"ko","tag":"설치","count":40},{"language":"nl","tag":"Installatie","count":40},{"language":"no","tag":"Installasjon","count":40},{"language":"pl","tag":"Instalacja","count":40},{"language":"pt","tag":"Instalação","count":40},{"language":"ru","tag":"Установка","count":40},{"language":"sv","tag":"Installation","count":40},{"language":"tr","tag":"Kurulum","count":40},{"language":"uk","tag":"Встановлення","count":40},{"language":"vi","tag":"Cài đặt","count":40},{"language":"zh-CN","tag":"安装","count":40},{"language":"zh-Hans","tag":"安装","count":40},{"language":"zh-Hant","tag":"安裝","count":40},{"language":"zh-TW","tag":"安裝","count":40},{"language":"en","tag":"Data Model","count":37},{"language":"ar","tag":"Docker Compose","count":34},{"language":"en","tag":"Docker Compose","count":34},{"language":"cs","tag":"Docker Compose","count":34},{"language":"da","tag":"Docker Compose","count":34},{"language":"de","tag":"Docker Compose","count":34},{"language":"es","tag":"Docker Compose","count":34},{"language":"fi","tag":"Docker Compose","count":34},{"language":"fr","tag":"Docker Compose","count":34},{"language":"id","tag":"Docker Compose","count":34},{"language":"it","tag":"Docker Compose","count":34},{"language":"ja","tag":"Docker Compose","count":34},{"language":"ko","tag":"Docker Compose","count":34},{"language":"nl","tag":"Docker Compose","count":34},{"language":"no","tag":"Docker Compose","count":34},{"language":"pl","tag":"Docker Compose","count":34},{"language":"pt","tag":"Docker Compose","count":34},{"language":"ru","tag":"Docker Compose","count":34},{"language":"sv","tag":"Docker Compose","count":34},{"language":"tr","tag":"Docker Compose","count":34},{"language":"uk","tag":"Docker Compose","count":34},{"language":"vi","tag":"Docker Compose","count":34},{"language":"zh-CN","tag":"Docker Compose","count":34},{"language":"zh-Hans","tag":"Docker Compose","count":34},{"language":"zh-Hant","tag":"Docker Compose","count":34},{"language":"zh-TW","tag":"Docker Compose","count":34},{"language":"ar","tag":"Kubernetes","count":32},{"language":"en","tag":"Kubernetes","count":32},{"language":"cs","tag":"Kubernetes","count":32},{"language":"da","tag":"Kubernetes","count":32},{"language":"de","tag":"Kubernetes","count":32},{"language":"es","tag":"Kubernetes","count":32},{"language":"fi","tag":"Kubernetes","count":32},{"language":"fr","tag":"Kubernetes","count":32},{"language":"id","tag":"Kubernetes","count":32},{"language":"it","tag":"Kubernetes","count":32},{"language":"ja","tag":"Kubernetes","count":32},{"language":"ko","tag":"Kubernetes","count":32},{"language":"nl","tag":"Kubernetes","count":32},{"language":"no","tag":"Kubernetes","count":32},{"language":"pl","tag":"Kubernetes","count":32},{"language":"pt","tag":"Kubernetes","count":32},{"language":"ru","tag":"Kubernetes","count":32},{"language":"sv","tag":"Kubernetes","count":32},{"language":"tr","tag":"Kubernetes","count":32},{"language":"uk","tag":"Kubernetes","count":32},{"language":"vi","tag":"Kubernetes","count":32},{"language":"zh-CN","tag":"Kubernetes","count":32},{"language":"zh-Hans","tag":"Kubernetes","count":32},{"language":"zh-Hant","tag":"Kubernetes","count":32},{"language":"zh-TW","tag":"Kubernetes","count":32},{"language":"ar","tag":"استخدام Docker Compose","count":27},{"language":"en","tag":"Using Docker Compose","count":27},{"language":"cs","tag":"Použití Docker Compose","count":27},{"language":"da","tag":"Brug af Docker Compose","count":27},{"language":"de","tag":"Docker Compose verwenden","count":27},{"language":"es","tag":"Uso de Docker Compose","count":27},{"language":"fi","tag":"Docker Composen käyttö","count":27},{"language":"fr","tag":"Utiliser Docker Compose","count":27},{"language":"id","tag":"Menggunakan Docker Compose","count":27},{"language":"it","tag":"Utilizzo di Docker Compose","count":27},{"language":"ja","tag":"Docker Compose の使用","count":27},{"language":"ko","tag":"Docker Compose 사용","count":27},{"language":"nl","tag":"Docker Compose gebruiken","count":27},{"language":"no","tag":"Bruke Docker Compose","count":27},{"language":"pl","tag":"Korzystanie z Docker Compose","count":27},{"language":"pt","tag":"Usando o Docker Compose","count":27},{"language":"ru","tag":"Использование Docker Compose","count":27},{"language":"sv","tag":"Använda Docker Compose","count":27},{"language":"tr","tag":"Docker Compose kullanımı","count":27},{"language":"uk","tag":"Використання Docker Compose","count":27},{"language":"vi","tag":"Sử dụng Docker Compose","count":27},{"language":"zh-CN","tag":"使用 Docker Compose","count":27},{"language":"zh-Hans","tag":"使用 Docker Compose","count":27},{"language":"zh-Hant","tag":"使用 Docker Compose","count":27},{"language":"zh-TW","tag":"使用 Docker Compose","count":27},{"language":"ar","tag":"المطوّرون","count":24},{"language":"en","tag":"User guide","count":24},{"language":"cs","tag":"Vývojáři","count":24},{"language":"da","tag":"Udvikler","count":24},{"language":"de","tag":"Entwickler","count":24},{"language":"es","tag":"Desarrollador","count":24},{"language":"fi","tag":"Kehittäjä","count":24},{"language":"fr","tag":"Développeur","count":24},{"language":"id","tag":"Pengembang","count":24},{"language":"it","tag":"Sviluppatore","count":24},{"language":"ja","tag":"開発者","count":24},{"language":"ko","tag":"개발자","count":24},{"language":"nl","tag":"Ontwikkelaar","count":24},{"language":"no","tag":"Utvikler","count":24},{"language":"pl","tag":"Dla deweloperów","count":24},{"language":"pt","tag":"Desenvolvedor","count":24},{"language":"ru","tag":"Разработчикам","count":24},{"language":"sv","tag":"Utvecklare","count":24},{"language":"tr","tag":"Geliştirici","count":24},{"language":"uk","tag":"Розробникам","count":24},{"language":"vi","tag":"Nhà phát triển","count":24},{"language":"zh-CN","tag":"开发者","count":24},{"language":"zh-Hans","tag":"开发者","count":24},{"language":"zh-Hant","tag":"開發者","count":24},{"language":"zh-TW","tag":"開發者","count":24},{"language":"ar","tag":"التكاملات","count":22},{"language":"en","tag":"Integrations","count":22},{"language":"cs","tag":"Integrace","count":22},{"language":"da","tag":"Integrationer","count":22},{"language":"de","tag":"Integrationen","count":22},{"language":"es","tag":"Integraciones","count":22},{"language":"fi","tag":"Integraatiot","count":22},{"language":"fr","tag":"Intégrations","count":22},{"language":"id","tag":"Integrasi","count":22},{"language":"it","tag":"Integrazioni","count":22},{"language":"ja","tag":"連携","count":22},{"language":"ko","tag":"통합","count":22},{"language":"nl","tag":"Integraties","count":22},{"language":"no","tag":"Integrasjoner","count":22},{"language":"pl","tag":"Integracje","count":22},{"language":"pt","tag":"Integrações","count":22},{"language":"ru","tag":"Интеграции","count":22},{"language":"sv","tag":"Integrationer","count":22},{"language":"tr","tag":"Entegrasyonlar","count":22},{"language":"uk","tag":"Інтеграції","count":22},{"language":"vi","tag":"Tích hợp","count":22},{"language":"zh-CN","tag":"集成","count":22},{"language":"zh-Hans","tag":"集成","count":22},{"language":"zh-Hant","tag":"整合","count":22},{"language":"zh-TW","tag":"整合","count":22},{"language":"ar","tag":"المصادقة","count":14},{"language":"cs","tag":"Ověřování","count":14},{"language":"da","tag":"Godkendelse","count":14},{"language":"de","tag":"Authentifizierung","count":14},{"language":"es","tag":"Autenticación","count":14},{"language":"fi","tag":"Todennus","count":14},{"language":"fr","tag":"Authentification","count":14},{"language":"id","tag":"Autentikasi","count":14},{"language":"it","tag":"Autenticazione","count":14},{"language":"ja","tag":"認証","count":14},{"language":"ko","tag":"인증","count":14},{"language":"nl","tag":"Authenticatie","count":14},{"language":"no","tag":"Autentisering","count":14},{"language":"pl","tag":"Uwierzytelnianie","count":14},{"language":"pt","tag":"Autenticação","count":14},{"language":"ru","tag":"Аутентификация","count":14},{"language":"sv","tag":"Autentisering","count":14},{"language":"tr","tag":"Kimlik Doğrulama","count":14},{"language":"uk","tag":"Автентифікація","count":14},{"language":"vi","tag":"Xác thực","count":14},{"language":"zh-CN","tag":"身份验证","count":14},{"language":"zh-Hans","tag":"身份验证","count":14},{"language":"zh-Hant","tag":"身分驗證","count":14},{"language":"zh-TW","tag":"身分驗證","count":14},{"language":"ar","tag":"واجهات برمجة الخدمات","count":13},{"language":"cs","tag":"API služeb","count":13},{"language":"da","tag":"Tjeneste-API","count":13},{"language":"de","tag":"Service-API","count":13},{"language":"es","tag":"API de servicios","count":13},{"language":"fi","tag":"Palvelujen API","count":13},{"language":"fr","tag":"API des services","count":13},{"language":"id","tag":"API layanan","count":13},{"language":"it","tag":"API dei servizi","count":13},{"language":"ja","tag":"サービス API","count":13},{"language":"ko","tag":"서비스 API","count":13},{"language":"nl","tag":"Service-API","count":13},{"language":"no","tag":"Tjeneste-API","count":13},{"language":"pl","tag":"API usług","count":13},{"language":"pt","tag":"API dos serviços","count":13},{"language":"ru","tag":"API сервисов","count":13},{"language":"sv","tag":"Tjänste-API","count":13},{"language":"tr","tag":"Hizmet API'si","count":13},{"language":"uk","tag":"API сервісів","count":13},{"language":"vi","tag":"API dịch vụ","count":13},{"language":"zh-CN","tag":"服务 API","count":13},{"language":"zh-Hans","tag":"服务 API","count":13},{"language":"zh-Hant","tag":"服務 API","count":13},{"language":"zh-TW","tag":"服務 API","count":13}],"searchSettings":{"maxResults":6}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":true,"enableContextualStarterQuestions":true,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":"@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-Regular-Static.otf\") format(\"opentype\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-RegularItalic-Static.otf\") format(\"opentype\");font-weight:400;font-style:italic;font-display:swap}@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-Medium-Static.otf\") format(\"opentype\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-MediumItalic-Static.otf\") format(\"opentype\");font-weight:500;font-style:italic;font-display:swap}@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-Semibold-Static.otf\") format(\"opentype\");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-SemiboldItalic-Static.otf\") format(\"opentype\");font-weight:600;font-style:italic;font-display:swap}@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-Bold-Static.otf\") format(\"opentype\");font-weight:700;font-style:normal;font-display:swap}@font-face{font-family:\"Site Sans\";src:url(\"/fonts/SiteSans-Text-BoldItalic-Static.otf\") format(\"opentype\");font-weight:700;font-style:italic;font-display:swap}@font-face{font-family:\"Site Serif Display\";src:url(\"/fonts/SiteSerif-Display-Regular-Static.otf\") format(\"opentype\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif Display\";src:url(\"/fonts/SiteSerif-Display-RegularItalic-Static.otf\") format(\"opentype\");font-weight:400;font-style:italic;font-display:swap}@font-face{font-family:\"Site Serif Display\";src:url(\"/fonts/SiteSerif-Display-Medium-Static.otf\") format(\"opentype\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif Display\";src:url(\"/fonts/SiteSerif-Display-Semibold-Static.otf\") format(\"opentype\");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif Display\";src:url(\"/fonts/SiteSerif-Display-Bold-Static.otf\") format(\"opentype\");font-weight:700;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-Regular-Static.otf\") format(\"opentype\");font-weight:400;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-RegularItalic-Static.otf\") format(\"opentype\");font-weight:400;font-style:italic;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-Medium-Static.otf\") format(\"opentype\");font-weight:500;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-MediumItalic-Static.otf\") format(\"opentype\");font-weight:500;font-style:italic;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-Semibold-Static.otf\") format(\"opentype\");font-weight:600;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-SemiboldItalic-Static.otf\") format(\"opentype\");font-weight:600;font-style:italic;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-Bold-Static.otf\") format(\"opentype\");font-weight:700;font-style:normal;font-display:swap}@font-face{font-family:\"Site Serif\";src:url(\"/fonts/SiteSerif-Text-BoldItalic-Static.otf\") format(\"opentype\");font-weight:700;font-style:italic;font-display:swap}:root{--always-white: 0 0% 100%;--always-black: 0 0% 0%;--constant-book-cloth: 15 55% 80%;--constant-clay: 15 60% 85%;--constant-kraft: 25 40% 83%;--constant-manilla: 40 20% 92%;--constant-slate-000: 0 0% 100%;--constant-slate-050: 48 33.3% 97.1%;--constant-slate-100: 53 28.6% 94.5%;--constant-slate-150: 48 25% 92.2%;--constant-slate-200: 50 20.7% 88.6%;--constant-slate-250: 51 16.5% 84.5%;--constant-slate-300: 50 11.5% 79.6%;--constant-slate-350: 50 9% 73.7%;--constant-slate-400: 49 6.5% 66.9%;--constant-slate-450: 48 4.8% 59.2%;--constant-slate-500: 53 3.2% 51.4%;--constant-slate-550: 51 3.1% 43.7%;--constant-slate-600: 48 2.7% 35.9%;--constant-slate-650: 48 3.4% 29.2%;--constant-slate-700: 60 2.5% 23.3%;--constant-slate-750: 60 2.1% 18.4%;--constant-slate-800: 60 2.7% 14.5%;--constant-slate-850: 30 3.3% 11.8%;--constant-slate-900: 30 4% 9.8%;--constant-slate-950: 60 2.6% 7.6%;--constant-slate-1000: 60 3.4% 5.7%}:root:not(.dark){--accent-brand: 15 63.1% 59.6%;--accent-main-000: 15 55.6% 52.4%;--accent-main-100: 15 55.6% 52.4%;--accent-main-200: 15 63.1% 59.6%;--accent-main-900: 0 0% 0%;--accent-pro-000: 251 34.2% 33.3%;--accent-pro-100: 251 40% 45.1%;--accent-pro-200: 251 61% 72.2%;--accent-pro-900: 253 33.3% 91.8%;--accent-secondary-000: 210 73.7% 40.2%;--accent-secondary-100: 210 70.9% 51.6%;--accent-secondary-200: 210 70.9% 51.6%;--accent-secondary-900: 211 72% 90%;--bg-000: 0 0% 100%;--bg-100: 48 33.3% 97.1%;--bg-200: 53 28.6% 94.5%;--bg-300: 48 25% 92.2%;--bg-400: 50 20.7% 88.6%;--bg-500: 50 20.7% 88.6%;--border-100: 30 3.3% 11.8%;--border-200: 30 3.3% 11.8%;--border-300: 30 3.3% 11.8%;--border-400: 30 3.3% 11.8%;--danger-000: 0 61.4% 22.4%;--danger-100: 0 58.6% 34.1%;--danger-200: 0 58.6% 34.1%;--danger-900: 0 50% 95%;--oncolor-100: 0 0% 100%;--oncolor-200: 60 6.7% 97.1%;--oncolor-300: 60 6.7% 97.1%;--text-000: 60 2.6% 7.6%;--text-100: 60 2.6% 7.6%;--text-200: 60 2.5% 23.3%;--text-300: 60 2.5% 23.3%;--text-400: 51 3.1% 43.7%;--text-500: 51 3.1% 43.7%}:root.dark{--accent-brand: 15 63.1% 59.6%;--accent-main-000: 15 55.6% 52.4%;--accent-main-100: 15 63.1% 59.6%;--accent-main-200: 15 63.1% 59.6%;--accent-main-900: 0 0% 0%;--accent-pro-000: 251 84.6% 74.5%;--accent-pro-100: 251 40.2% 54.1%;--accent-pro-200: 251 40% 45.1%;--accent-pro-900: 250 25.3% 19.4%;--accent-secondary-000: 210 71.1% 62%;--accent-secondary-100: 210 70.9% 51.6%;--accent-secondary-200: 210 70.9% 51.6%;--accent-secondary-900: 210 55.9% 24.6%;--bg-000: 60 2.1% 18.4%;--bg-100: 60 2.7% 14.5%;--bg-200: 30 3.3% 11.8%;--bg-300: 60 2.6% 7.6%;--bg-400: 60 3.4% 5.7%;--bg-500: 60 3.4% 5.7%;--border-100: 51 16.5% 84.5%;--border-200: 51 16.5% 84.5%;--border-300: 51 16.5% 84.5%;--border-400: 51 16.5% 84.5%;--danger-000: 0 73.1% 66.5%;--danger-100: 0 58.6% 34.1%;--danger-200: 0 58.6% 34.1%;--danger-900: 0 23% 15.6%;--oncolor-100: 0 0% 100%;--oncolor-200: 60 6.7% 97.1%;--oncolor-300: 60 6.7% 97.1%;--text-000: 48 33.3% 97.1%;--text-100: 48 33.3% 97.1%;--text-200: 50 9% 73.7%;--text-300: 50 9% 73.7%;--text-400: 48 4.8% 59.2%;--text-500: 48 4.8% 59.2%}#home-header{font-family:\"Site Sans\", system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;font-weight:400!important;font-size:50px;line-height:1.2;margin-bottom:1rem;color:--text-000;display:flex;align-items:baseline;justify-content:center;flex-wrap:nowrap}#localization-select-trigger>:has(img[src*=\"flags\"]){display:none}div[id^=\"localization-select-item\"]>:has(img[src*=\"flags\"]){display:none}@media (min-width: 768px){#home-header{justify-content:center}}.build-with{font-family:\"Site Sans\", system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;letter-spacing:-0.02em}.claude-wordmark-wrapper{display:inline-flex;align-items:baseline;margin-left:10px}.claude-wordmark{height:40px;width:auto;position:relative}.dark #home-header{color:white}.description-text{color:black}.dark .description-text{color:white}.dark .claude-wordmark{filter:invert(1)}:root{--bg-color: #f0efea}.dark{--bg-color: #2b2b2b}body,input,#category-select,.dropdown-item,#table-of-contents{font-family:\"Site Sans\", system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif}.eyebrow{font-family:\"Site Sans\", system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif;text-transform:uppercase;letter-spacing:0.02rem}#content-container{font-family:\"Site Sans\", system-ui, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif}#content-container h1,#content-container h2,#content-container h3,#content-container h4,#content-container h5,#content-container h6{font-family:\"Site Serif Display\", Georgia, \"Times New Roman\", Times, serif;font-weight:400;letter-spacing:0;word-spacing:0.1em}#content-container p{font-size:1rem;line-height:1.65rem}.font-extrabold{font-weight:600!important}.wide-table{width:100%;overflow-x:auto}.wide-table table{width:175%;margin-bottom:0}#prompt-library-container{margin:4rem auto;max-width:48rem;padding-left:1.25rem;padding-right:1.25rem}.prompt-library-title{font-size:24px;text-align:center;font-weight:700;color:#1f2937}.dark .prompt-library-title{color:#e5e7eb}.prompt-library-description{margin-top:1rem;text-align:center}.main-content{margin-bottom:10rem;max-width:64rem;margin-left:auto;margin-right:auto;padding-left:1.25rem;padding-right:1.25rem}.prompt-controllers{display:flex;gap:0.5rem}.prompt-search-container{position:relative;flex:1 1 0%}.prompt-search-icon-container{display:flex;position:absolute;top:0;bottom:0;left:0;align-items:center;padding-left:0.75rem}.prompt-search-icon{margin-left:0.25rem;margin-right:0.75rem;flex:none;width:1rem;height:1rem;background-color:#6b7280;mask-image:url(https://mintlify.b-cdn.net/v6.5.1/solid/magnifying-glass.svg);mask-repeat:no-repeat;mask-position:center center}input.prompt-search-bar{display:block;height:2.5rem;padding-left:2.5rem;border-radius:0.75rem;border-width:1px;background-color:#ffffff;width:100%;color:#111827;box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.05)}.dark input.prompt-search-bar{color:#ffffff;background-color:rgb(var(--background-dark));border-color:#d1d5db1a}input.prompt-search-bar:focus{outline-color:rgb(var(--primary))}.dark input.prompt-search-bar:focus{outline-color:rgb(var(--primary-light))}.dark .prompt-search-icon{background-color:#ffffff80}#category-select{padding-left:1rem;padding-right:2.5rem;height:2.5rem;display:flex;align-items:center;border-radius:0.75rem;border-width:1px;color:#111827;background-color:#ffffff;cursor:pointer;box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.05);white-space:nowrap}.dark #category-select{background-color:rgb(var(--background-dark));border-color:#d1d5db1a;color:#ffffff}#category-select:hover{background-color:#f9fafb}.dark #category-select:hover{background-color:#ffffff0d}#category-select:focus{outline-color:rgb(var(--primary))}.dark #category-select:focus{outline-color:rgb(var(--primary-light))}#categories-dropdown{top:calc(100% + 4px);padding:0.5rem 0.5rem;display:none;position:absolute;z-index:10;border-radius:0.75rem;border-width:1px;width:100%;color:#111827;background-color:#ffffff;box-shadow:0 1px 2px 0 rgba(0, 0, 0, 0.05)}.dark #categories-dropdown{background-color:rgb(var(--background-dark));border-color:#d1d5db1a;color:#ffffff}#categories-dropdown-clickout{position:fixed;top:0;right:0;bottom:0;left:0;z-index:0}.dropdown-icon-container{display:flex;position:absolute;top:0;bottom:0;right:0;align-items:center;padding-right:0.25rem}.dropdown-icon{margin-left:0.25rem;margin-right:0.75rem;flex:none;width:0.75rem;height:0.75rem;background-color:#6b7280;mask-image:url(https://mintlify.b-cdn.net/v6.5.1/solid/caret-down.svg);mask-repeat:no-repeat;mask-position:center center}.dark .dropdown-icon{background-color:#ffffff80}#prompts-container{grid-template-columns:repeat(1, minmax(0, 1fr));gap:2rem}.dropdown-item{padding:0.25rem 0.5rem;border-radius:0.375rem;display:flex;align-items:center;cursor:pointer}.dropdown-item:hover{background-color:#f9fafb}.dark .dropdown-item:hover{background-color:#ffffff0d}.check-icon{mask-image:url(https://mintlify.b-cdn.net/v6.5.1/solid/check.svg);height:0.875rem;width:1rem;background-color:rgb(var(--primary-light));mask-repeat:no-repeat;mask-position:center center}.prompt-card{margin:-0.75rem;padding:0.75rem;display:flex;border-radius:1rem}.prompt-card:hover{background-color:#03071208}.dark .prompt-card:hover{background-color:#ffffff08}.prompt-icon-container{display:flex;flex:none;align-items:center;justify-content:center;margin-right:1.5rem;border-radius:0.75rem;height:4rem;width:4rem;background-color:#cb785c1a}.prompt-icon{height:1.5rem;width:1.5rem;background-color:rgb(var(--primary-light));mask-repeat:no-repeat;mask-position:center center}.prompt-title{color:rgb(31 41 55);font-weight:600}.dark .prompt-title{color:rgb(229 231 235)}.prompt-description{margin-top:0.25rem}#prompts-container{display:grid;margin-top:2.5rem}@media (min-width: 640px){#category-select{width:16rem}}@media (min-width: 1024px){#prompts-container{grid-template-columns:repeat(2, minmax(0, 1fr))}}.home-cards-custom{display:grid;grid-template-columns:repeat(3, 1fr);grid-template-rows:repeat(2, auto);gap:1.5rem}.home-cards-custom .card{background:transparent;border:0.5px solid hsl(var(--border-300));border-radius:12px;padding:0.25rem}@media (max-width: 1024px){.home-cards-custom{grid-template-columns:repeat(2, 1fr);grid-template-rows:repeat(3, auto)}}@media (max-width: 768px){.home-cards-custom{grid-template-columns:1fr;grid-template-rows:repeat(6, auto)}}.relative{position:relative}.flex-1{flex:1 1 0%}.mermaid{position:relative;background-color:#FDFDFB;background-image:linear-gradient(rgba(235, 219, 188, .25) 1px, transparent 1px), /* Secondary color #EBDBBC with low opacity */\n linear-gradient(90deg, rgba(235, 219, 188, .25) 1px, transparent 1px),\n linear-gradient(rgba(235, 219, 188, .1) 1px, transparent 1px),\n linear-gradient(90deg, rgba(235, 219, 188, .1) 1px, transparent 1px);background-size:20px 20px,\n 20px 20px,\n 4px 4px,\n 4px 4px;background-position:-1px -1px,\n -1px -1px,\n -1px -1px,\n -1px -1px;padding:20px;border-radius:8px;border:1px solid rgba(235, 219, 188, .4);box-shadow:0 2px 4px rgba(64, 64, 62, 0.08)}.dark .mermaid{background-color:#1a1918;background-image:linear-gradient(rgba(212, 162, 127, .15) 1px, transparent 1px), /* Tertiary color #D4A27F with low opacity */\n linear-gradient(90deg, rgba(212, 162, 127, .15) 1px, transparent 1px),\n linear-gradient(rgba(212, 162, 127, .08) 1px, transparent 1px),\n linear-gradient(90deg, rgba(212, 162, 127, .08) 1px, transparent 1px);border:1px solid rgba(102, 102, 99, .5);box-shadow:0 2px 4px rgba(0, 0, 0, 0.2)}.digest-meta{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:0.5rem 1rem;padding:0.75rem 1rem;margin:1.5rem 0 2.5rem;border:1px solid hsl(var(--border-300) / 0.15);background:hsl(var(--bg-200));font-variant-numeric:tabular-nums;font-size:0.875rem;color:hsl(var(--text-400))}#content-container .digest-meta a{color:hsl(var(--accent-main-100));font-weight:500;text-decoration:none;border-bottom:none}#content-container .digest-meta a:hover{text-decoration:underline}.digest-feature{position:relative;margin:2.5rem 0;padding:1.875rem 1.875rem 1.625rem;background:radial-gradient(circle, hsl(var(--text-000) / 0.025) 1px, transparent 1px) 0 0 / 18px 18px,\n linear-gradient(180deg, hsl(var(--constant-manilla) / 0.55), hsl(var(--constant-manilla) / 0.38));border:1px solid hsl(var(--border-300) / 0.12);box-shadow:inset 0 1px 0 hsl(var(--text-000) / 0.04),\n 0 1px 2px hsl(var(--always-black) / 0.04)}.digest-feature::before{content:\"\";position:absolute;inset:0 auto 0 0;width:4px;background:hsl(var(--accent-brand))}.dark .digest-feature{background:radial-gradient(circle, hsl(var(--text-000) / 0.02) 1px, transparent 1px) 0 0 / 18px 18px,\n linear-gradient(180deg, hsl(var(--bg-000) / 0.75), hsl(var(--bg-000) / 0.5));border-color:hsl(var(--border-300) / 0.1);box-shadow:inset 0 1px 0 hsl(var(--text-000) / 0.03),\n 0 1px 2px hsl(var(--always-black) / 0.25)}.digest-feature>:first-child{margin-top:0}.digest-feature>:last-child{margin-bottom:0}.digest-feature-header{display:flex;align-items:center;flex-wrap:wrap;gap:0.625rem;margin:0 0 0.75rem}#content-container .digest-feature-title{font-family:\"Site Serif Display\", Georgia, serif;font-size:1.75rem;line-height:1.15;font-weight:500;letter-spacing:-0.015em;color:hsl(var(--text-000));margin:0}#content-container .digest-feature-pill{font-family:ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;font-size:0.75rem;line-height:1;letter-spacing:0.01em;padding:0.3rem 0.6rem;border-radius:999px;background:hsl(var(--accent-brand) / 0.12);color:hsl(var(--accent-main-000));border:1px solid hsl(var(--accent-brand) / 0.25);white-space:nowrap;transform:translateY(1px)}#content-container .digest-feature-lede{font-size:1.0625rem;line-height:1.65;color:hsl(var(--text-100));margin:0 0 1.25rem;max-width:none}#content-container .digest-feature-lede code{font-size:0.875em;padding:0.1em 0.35em}#content-container .digest-feature-try{font-size:0.875rem;color:hsl(var(--text-400));margin:1.25rem 0 0.5rem}#content-container .digest-feature .frame{margin:1rem 0;border-radius:0;padding:0}#content-container .digest-feature .frame>*{border-radius:0}#content-container .digest-feature pre,#content-container .digest-feature [class*=\"CodeBlock\"]{border-radius:0}#content-container .digest-feature-link{display:inline-flex;align-items:center;gap:0.35rem;font-size:0.875rem;font-weight:500;color:hsl(var(--accent-main-100));text-decoration:none;border-bottom:none;margin-top:0.75rem}#content-container .digest-feature-link::after{content:\"→\";transition:transform 120ms ease-out}#content-container .digest-feature-link:hover::after{transform:translateX(3px)}.digest-wins{margin:2.5rem 0;padding:1.5rem 1.75rem 1.25rem;background:hsl(var(--bg-200));border:1px solid hsl(var(--border-300) / 0.1)}.dark .digest-wins{background:hsl(var(--bg-200) / 0.6)}#content-container .digest-wins-title{font-family:\"Site Serif Display\", Georgia, serif;font-size:1.25rem;font-weight:500;color:hsl(var(--text-000));margin:0 0 0.75rem}.digest-wins-grid{display:grid;grid-template-columns:repeat(auto-fit, minmax(16rem, 1fr));column-gap:2rem}#content-container .digest-wins-grid>div{position:relative;font-size:0.875rem;line-height:1.5;color:hsl(var(--text-300));padding:0.5rem 0 0.5rem 1.125rem;border-top:1px solid hsl(var(--border-300) / 0.06);margin:0}#content-container .digest-wins-grid>div::before{content:\"+\";position:absolute;left:0;top:0.5rem;font-family:ui-monospace, \"SF Mono\", Menlo, Consolas, monospace;font-size:0.8125rem;font-weight:600;color:hsl(var(--accent-brand))}#content-container .digest-wins-grid>div:first-child,#content-container .digest-wins-grid>div:nth-child(2){border-top:none;padding-top:0}#content-container .digest-wins-grid>div:first-child::before,#content-container .digest-wins-grid>div:nth-child(2)::before{top:0}#content-container .digest-wins-grid code{font-size:0.8125rem;padding:0.1em 0.3em}:root{--toc-wrapper-max: 92rem;--toc-wrapper-pad: 2rem;--toc-col: 19rem;--toc-side: 28rem;--toc-btn-size: 1.75rem}#toc-collapse-toggle{display:none;align-items:center;justify-content:center;position:fixed;top:10rem;right:calc(\n max((100% - var(--toc-wrapper-max)) / 2, 0px) + var(--toc-wrapper-pad) +\n var(--toc-col) - var(--toc-btn-size) - 0.35rem\n );transition:right 200ms ease-out;z-index:30;width:var(--toc-btn-size);height:var(--toc-btn-size);border-radius:9999px;border:1px solid hsl(var(--border-300) / 0.15);background:hsl(var(--bg-100));color:hsl(var(--text-400));cursor:pointer}#toc-collapse-toggle:hover{background:hsl(var(--bg-300));color:hsl(var(--text-100))}#toc-collapse-toggle svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}#toc-collapse-toggle .toc-glyph{display:none;stroke-width:2}@media print{#toc-collapse-toggle{display:none!important}}@media (prefers-reduced-motion: reduce){#toc-collapse-toggle{transition:none}}@media (min-width: 1280px){html:has(#table-of-contents-layout) #toc-collapse-toggle{display:flex}html.toc-collapsed #toc-collapse-toggle .toc-chevron{transform:rotate(180deg)}html.toc-collapsed #toc-collapse-toggle{right:0.5rem;width:auto;padding:0 0.5rem;gap:0.25rem}html.toc-collapsed #toc-collapse-toggle .toc-glyph{display:block}html.toc-collapsed #table-of-contents-layout{display:none!important}html.toc-collapsed #content-side-layout:has(#table-of-contents-layout){display:none!important}html.toc-collapsed #content-container:has(#table-of-contents-layout) #content-area{width:100%!important}html.toc-collapsed #content-container:has(#table-of-contents-layout) #content-area>*{max-width:calc(var(--toc-wrapper-max) - var(--toc-side))}}@media (max-width: 640px){.digest-feature{padding:1.25rem 1rem 1rem;margin:1.5rem 0}#content-container .digest-feature-title{font-size:1.375rem}.digest-wins{padding:1.25rem 1rem 1rem}.digest-wins-grid{grid-template-columns:1fr}#content-container .digest-wins-grid>div:nth-child(2){border-top:1px solid hsl(var(--border-300) / 0.06);padding-top:0.5rem}#content-container .digest-wins-grid>div:nth-child(2)::before{top:0.5rem}}img[data-component-part=\"card-image\"]{aspect-ratio:16 / 9;height:auto;object-fit:cover;object-position:top center}"},{"filePath":"button.css","content":".btn{position:relative;display:inline-flex;gap:0.5rem;align-items:center;justify-content:center;flex-shrink:0;min-width:5rem;height:2.25rem;padding:0.5rem 1rem;white-space:nowrap;font-family:Styrene;font-weight:600;border-radius:0.5rem;\u0026:active{transform:scale(0.985)}\u0026.size-xs{height:1.75rem;min-width:3.5rem;padding:0 0.5rem;border-radius:0.25rem;font-size:0.75rem;gap:0.25rem}\u0026.size-sm{height:2rem;min-width:4rem;padding:0 0.75rem;border-radius:0.375rem;font-size:0.75rem}\u0026.size-lg{height:2.75rem;min-width:6rem;padding:0 1.25rem;border-radius:0.6rem}\u0026:disabled{pointer-events:none;opacity:0.5;box-shadow:none}\u0026:focus-visible{outline:none;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow)}\u0026.primary{font-weight:600;color:hsl(var(--oncolor-100));background-color:hsl(var(--accent-main-100));background-image:linear-gradient(\n to right,\n hsl(var(--accent-main-100)) 0%,\n hsl(var(--accent-main-200) / 0.5) 50%,\n hsl(var(--accent-main-200)) 100%\n );background-size:200% 100%;background-position:0% 0%;border:0.5px solid hsl(var(--border-300) / 0.25);box-shadow:inset 0 0.5px 0px rgba(255, 255, 0, 0.15),\n 0 1px 1px rgba(0, 0, 0, 0.05);text-shadow:0 1px 2px rgb(0 0 0 / 10%);transition:all 150ms cubic-bezier(0.4, 0, 0.2, 1);\u0026:hover{background-position:100% 0%;background-image:linear-gradient(\n to right,\n hsl(var(--accent-main-200)) 0%,\n hsl(var(--accent-main-200)) 100%\n )}\u0026:active{background-color:hsl(var(--accent-main-000));box-shadow:inset 0 1px 6px rgba(0, 0, 0, 0.2);transform:scale(0.985)}}\u0026.flat{font-weight:500;color:hsl(var(--oncolor-100));background-color:hsl(var(--accent-main-100));transition:background-color 150ms;\u0026:hover{background-color:hsl(var(--accent-main-200))}}\u0026.secondary{font-weight:600;color:hsl(var(--text-100) / 0.9);background-image:radial-gradient(\n ellipse at center,\n hsl(var(--bg-500) / 0.1) 50%,\n hsl(var(--bg-500) / 0.3) 100%\n );border:0.5px solid hsl(var(--border-400));transition:color 150ms, background-color 150ms;\u0026:hover{color:hsl(var(--text-000));background-color:hsl(var(--bg-500) / 0.6)}\u0026:active{background-color:hsl(var(--bg-500) / 0.5)}}\u0026.outline{font-weight:600;color:hsl(var(--text-200));background-color:transparent;border:1.5px solid currentColor;transition:color 150ms, background-color 150ms;\u0026:hover{color:hsl(var(--text-100));background-color:hsl(var(--bg-400));border-color:hsl(var(--bg-400))}}\u0026.ghost{color:hsl(var(--text-200));border-color:transparent;transition:color 150ms, background-color 150ms;\u0026:hover{color:hsl(var(--text-100));background-color:hsl(var(--bg-500) / 0.4)}\u0026:active{background-color:hsl(var(--bg-400))}}\u0026.underline{opacity:0.8;text-decoration-line:none;text-underline-offset:3px;transition:all 150ms;\u0026:hover{opacity:1;text-decoration-line:underline}\u0026:active{transform:scale(0.985)}}\u0026.danger{font-weight:600;color:hsl(var(--oncolor-100));background-color:hsl(var(--danger-100));transition:background-color 150ms;\u0026:hover{background-color:hsl(var(--danger-200))}}}"}]}
{"page":{"pagePath":"texlive/skills/r-code-knitr","slug":"/texlive/skills/r-code-knitr","pageMetadata":{"title":"R code (knitr)","icon":"binary","description":null,"href":"/texlive/skills/r-code-knitr"},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Info,OptimizedImage}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Info)_missingMdxReference(`Info`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Overleaf provides an integration with `,_jsx(_components.strong,{children:`knitr`}),`, which allows you to add R code to your LaTeX document to generate a dynamic output.`]}),`\n`,_jsxs(_components.p,{children:[`Documents that contain R code must be saved with the extension `,_jsx(_components.code,{children:`.Rtex`}),` or `,_jsx(_components.code,{children:`.Rnw`}),`, otherwise the code won’t work. Let’s see an example:`]}),`\n`,_jsx(CodeBlock,{filename:``,wrap:`true`,numberOfLines:`14`,language:`latex`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`latex`,children:_jsxs(_components.code,{language:`latex`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\\\\documentclass`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`article`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\begin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`You can type R commands in your `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\LaTeX`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{} document which will be processed and their output included in the document:`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c\u003c>>=`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`# Create a sequence of numbers`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`X = 2:10`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`# Display basic statistical measures`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`summary(X)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`@`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`]})})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo1.png?fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=4cd20c6acbeeab2b1ae2b115efece70d`,alt:`KnitrDemo1.png`,\"data-og-width\":`2150`,width:`2150`,\"data-og-height\":`681`,height:`681`,\"data-path\":`images/texlive/knitrdemo1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo1.png?w=280\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=5ac33cae632293f00f3df02cb532cfd9 280w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo1.png?w=560\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=749c19123bdf9b220a1fea5e64ea966c 560w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo1.png?w=840\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=f41a7cf0be3be97f01f8dd6d1caf8451 840w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=df7321f0e0e0a7777500281007039098 1100w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=23016c39c78f2d33f357012996ca4a9a 1650w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=73c3df08b477f3756840390d59880753 2500w`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.a,{href:`https://www.overleaf.com/project/new/template/20421?id=69881107\u0026templateName=Knitr+demo+1\u0026latexEngine=pdflatex\u0026texImage=texlive-full%3A2020.1\u0026mainFile=`,children:[`Open this `,_jsx(_components.code,{children:`knitr`}),` example on Overleaf`]})}),`\n`,_jsxs(_components.p,{children:[`As you can see, the text in between the characters `,_jsx(_components.code,{children:`\u003c\u003c>>=`}),` and `,_jsx(_components.code,{children:`@`}),` is R code. This code and its output is printed in a listing-like format. This chunk of code can take some extra parameters to customize the dynamic output, as described in the next section.`]}),`\n`,_jsx(Heading,{level:`3`,id:`chunks-of-code`,children:`Chunks of code`}),`\n`,_jsxs(_components.p,{children:[`A code block like the one presented in the previous section is usually called a `,_jsx(_components.em,{children:`chunk`}),`. You can set some extra options in knitr chunks. See the example below:`]}),`\n`,_jsx(CodeBlock,{filename:``,wrap:`true`,numberOfLines:`14`,language:`latex`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`latex`,children:_jsxs(_components.code,{language:`latex`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\\\\documentclass`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`article`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\begin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`You can type R commands in your `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\LaTeX`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{} document which will be processed and their output included in the document:`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c\u003cecho=FALSE, cache=TRUE>>=`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`# Create a sequence of numbers`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`X = 2:10`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`# Display basic statistical measures`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`summary(X)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`@`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`]})})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143420.png?fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=9c79c98b1894d1cd22f783c29356de1f`,alt:`KnitrDemo2.png`,\"data-og-width\":`1910`,width:`1910`,\"data-og-height\":`559`,height:`559`,\"data-path\":`images/texlive/screenshot-2025-12-16-143420.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143420.png?w=280\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=3a109461a4480e4ef37fe3507fdda8d1 280w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143420.png?w=560\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=3496f666e9ccfdb7792bb0d24d5dc745 560w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143420.png?w=840\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=fe03154a206a994691fc2c54bb686558 840w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143420.png?w=1100\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=6a4a687764f991b61cd147be4551cb1a 1100w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143420.png?w=1650\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=ab494e9e1d66fe00e4b897cd9a6ef9b5 1650w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143420.png?w=2500\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=1769bbc8a49dd01e1feb780c216eeb91 2500w`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.a,{href:`https://www.overleaf.com/project/new/template/20423?id=69885763\u0026templateName=Knitr+demo+2\u0026latexEngine=pdflatex\u0026texImage=texlive-full%3A2020.1\u0026mainFile=`,children:[`Open this `,_jsx(_components.code,{children:`knitr`}),` example on Overleaf`]})}),`\n`,_jsxs(_components.p,{children:[`There are two additional options passed inside `,_jsx(_components.code,{children:`\u003c\u003c`}),` and `,_jsx(_components.code,{children:`>>`}),`.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`echo=FALSE`}),`This hides the code and only prints the output generated by R.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`cache=TRUE`}),`If cache is set to true, the chunk is not run, only the objects generated by it. This saves time if the data in that chunk haven’t changed.`]}),`\n`,_jsx(Info,{children:_jsx(`em`,{children:`Note that the cache=TRUE option is not currently supported in Overleaf, but it should work locally.`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`See the `,_jsx(_components.a,{href:`https://learn.overleaf.com/learn/Knitr#Reference_guide`,children:`reference guide`}),` for more options.`]}),`\n`,_jsx(Heading,{level:`3`,id:`inline-commands`,children:`Inline commands`}),`\n`,_jsx(_components.p,{children:`It is possible to access objects generated in a chunk and print them in-line.`}),`\n`,_jsx(CodeBlock,{filename:``,wrap:`true`,numberOfLines:`16`,language:`latex`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`latex`,children:_jsxs(_components.code,{language:`latex`,numberOfLines:`16`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\\\\documentclass`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`article`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\begin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`You can type R commands in your `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\LaTeX`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{} document which will be processed and their output included in the document:`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c\u003cecho=FALSE, cache=TRUE>>=`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`# Create a sequence of numbers`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`X = 2:10`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`# Display basic statistical measures`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`summary(X)`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`@`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`So, the mean of the data is `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`$`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\Sexpr`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`{`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`mean`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`X`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`)`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`}`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`$`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\end`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`]})})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143647.png?fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=8b59926a477373b2787f884267d7c263`,alt:`KnitrDemo3.png`,\"data-og-width\":`1910`,width:`1910`,\"data-og-height\":`630`,height:`630`,\"data-path\":`images/texlive/screenshot-2025-12-16-143647.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143647.png?w=280\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=5bb883d74fd2ca1cc74d948184c91aa6 280w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143647.png?w=560\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=45f7874b73a5f3682552275b4f90c603 560w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143647.png?w=840\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=e1b9970062dc405269a6ddf559455f03 840w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143647.png?w=1100\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=eaddedfa41710cc5a1e60ad6bd9d9f2b 1100w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143647.png?w=1650\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=62f5be08045325b4503088afd00ab4b9 1650w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/screenshot-2025-12-16-143647.png?w=2500\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=3b3f5d4d6988a759fd209adbd6836cdc 2500w`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.a,{href:`https://www.overleaf.com/project/new/template/20425?id=69886866\u0026templateName=Knitr+demo+3\u0026latexEngine=pdflatex\u0026texImage=texlive-full%3A2020.1\u0026mainFile=`,children:[`Open this `,_jsx(_components.code,{children:`knitr`}),` example on Overleaf`]})}),`\n`,_jsxs(_components.p,{children:[`The command `,_jsx(_components.code,{children:`\\\\Sexpr{mean(X)}`}),` prints the output returned by the R code `,_jsx(_components.code,{children:`mean(X)`}),`. Inside the braces, any R command can be passed.`]}),`\n`,_jsx(Heading,{level:`3`,id:`plots`,children:`Plots`}),`\n`,_jsx(_components.p,{children:`Plots can also be added to a knitr document, as in this example:`}),`\n`,_jsx(CodeBlock,{filename:``,wrap:`true`,numberOfLines:`14`,language:`latex`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`latex`,children:_jsxs(_components.code,{language:`latex`,numberOfLines:`14`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`\\\\documentclass`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`article`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`\\\\begin`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`document`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c\u003cplot1, fig.pos=\"t\", fig.height=4, fig.width=4, fig.cap=\"First plot\">>=`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`xdata = read.csv(file=\"data.txt\", head=TRUE,sep=\" \")`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`hist(xdata`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`$`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`data, main=\"Overleaf histogram\", xlab=\"Data\")`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`@`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`The figure \\\\ref{fig:plot`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`1`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`} is simple histogram.`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`\\\\end{document}`})}),`\n`]})})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/ayakaleaf-pro/GmaXa-Cu4QQRFT4C/images/texlive/screenshot-2025-12-16-143811.png?fit=max\u0026auto=format\u0026n=GmaXa-Cu4QQRFT4C\u0026q=85\u0026s=af1985b1e5b5ce56b777c5d9e3066420`,alt:`KnitrDemo4.png`,\"data-og-width\":`1915`,width:`1915`,\"data-og-height\":`756`,height:`756`,\"data-path\":`images/texlive/screenshot-2025-12-16-143811.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/ayakaleaf-pro/GmaXa-Cu4QQRFT4C/images/texlive/screenshot-2025-12-16-143811.png?w=280\u0026fit=max\u0026auto=format\u0026n=GmaXa-Cu4QQRFT4C\u0026q=85\u0026s=b0112dcf5e744fdf70d9bb8eea0c0a3e 280w, https://mintcdn.com/ayakaleaf-pro/GmaXa-Cu4QQRFT4C/images/texlive/screenshot-2025-12-16-143811.png?w=560\u0026fit=max\u0026auto=format\u0026n=GmaXa-Cu4QQRFT4C\u0026q=85\u0026s=c435859c25158db86e1b57f81f2c72e2 560w, https://mintcdn.com/ayakaleaf-pro/GmaXa-Cu4QQRFT4C/images/texlive/screenshot-2025-12-16-143811.png?w=840\u0026fit=max\u0026auto=format\u0026n=GmaXa-Cu4QQRFT4C\u0026q=85\u0026s=7cd3be9260d1c4e25e617c1cea3cd54d 840w, https://mintcdn.com/ayakaleaf-pro/GmaXa-Cu4QQRFT4C/images/texlive/screenshot-2025-12-16-143811.png?w=1100\u0026fit=max\u0026auto=format\u0026n=GmaXa-Cu4QQRFT4C\u0026q=85\u0026s=6ff41e28d3c5fa153f728289f3e3852a 1100w, https://mintcdn.com/ayakaleaf-pro/GmaXa-Cu4QQRFT4C/images/texlive/screenshot-2025-12-16-143811.png?w=1650\u0026fit=max\u0026auto=format\u0026n=GmaXa-Cu4QQRFT4C\u0026q=85\u0026s=cc67b86863364a07777b06acc99b535e 1650w, https://mintcdn.com/ayakaleaf-pro/GmaXa-Cu4QQRFT4C/images/texlive/screenshot-2025-12-16-143811.png?w=2500\u0026fit=max\u0026auto=format\u0026n=GmaXa-Cu4QQRFT4C\u0026q=85\u0026s=b2480f88307eaefd71e3ea8ab810d81f 2500w`}),`\n`,_jsx(_components.p,{children:_jsxs(_components.a,{href:`https://www.overleaf.com/project/new/template/20427?id=69890965\u0026templateName=Knitr+demo+3\u0026latexEngine=pdflatex\u0026texImage=texlive-full%3A2020.1\u0026mainFile=`,children:[`Open this `,_jsx(_components.code,{children:`knitr`}),` example on Overleaf`]})}),`\n`,_jsx(_components.p,{children:`This histogram uses data stored in “data.txt”, saved in the current working directory. A few figure-related options are passed to the chunk.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`plot1`}),`This is the label used to reference the plot. The prefix “fig:” is mandatory. You can see in the example that the figure is referenced with `,_jsx(_components.code,{children:`\\\\ref{fig:plot1}`}),`.`,_jsx(_components.code,{children:`fig.pos=\"t\"`}),` positioning parameter. This is the same used in `,_jsx(_components.a,{href:`https://learn.overleaf.com/learn/Positioning_images_and_tables#The_figure_environment`,children:`the figure environment`}),`.`,_jsx(_components.code,{children:`fig.height=4, fig.width=4`}),`Figure width and height.`,_jsx(_components.code,{children:`fig.cap=\"First plot\"`}),`Caption for the figure.`]}),`\n`,_jsx(Heading,{level:`3`,id:`external-r-scripts`,children:`External R scripts`}),`\n`,_jsx(_components.p,{children:`You can import parts of an external R script into a knitr document. This is very helpful since it is fairly common to write and debug the script in an external program prior to including it in your document.`}),`\n`,_jsxs(_components.p,{children:[`Suppose we have the following R code in a file called `,_jsx(_components.code,{children:`mycode.R`}),` which we include in our LaTeX document:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`r`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`r`,children:_jsxs(_components.code,{language:`r`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`## ---- myrcode1`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Create a sequence of numbers`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` X`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:`10`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`## ---- myrcode2`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`# Display basic statistical measures`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`summary`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`X`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Notice the lines:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`r`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`r`,children:_jsxs(_components.code,{language:`r`,numberOfLines:`1`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`## ---- myrcode1`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`and`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`r`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`r`,children:_jsxs(_components.code,{language:`r`,numberOfLines:`1`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`## ---- myrcode2`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`These mark the beginning of a chunk of code and are mandatory if you want to use this script in our document, as shown in the following code fragment:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`r`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`r`,children:_jsxs(_components.code,{language:`r`,numberOfLines:`11`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`The`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` chunk`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` below`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` will`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` not`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` be`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` printed`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`echo`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`FALSE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`,`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` cache`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`FALSE`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>>=`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`read_chunk`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"mycode.R\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`@`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`The`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` code`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` must`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` show`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` up`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` here`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`\u003c\u003c`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`myrcode2`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`>>=`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`@`})}),`\n`]})})}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo5.png?fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=0f1fd4088c9359058547a7c58f121bd5`,alt:`KnitrDemo5.png`,\"data-og-width\":`1544`,width:`1544`,\"data-og-height\":`436`,height:`436`,\"data-path\":`images/texlive/knitrdemo5.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo5.png?w=280\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=8e6c0d5a019c2fe93af07db577d2fc91 280w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo5.png?w=560\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=7a4f434dc1e21b79b3426dda482f10d9 560w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo5.png?w=840\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=37848f2fb05b5e2e374433876210002e 840w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo5.png?w=1100\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=05d00dcda278d7563f597680c7929eb1 1100w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo5.png?w=1650\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=7fa6d8db17cd14c02a28c55fadbc6258 1650w, https://mintcdn.com/ayakaleaf-pro/v5p5w9EX1_dka_GD/images/texlive/knitrdemo5.png?w=2500\u0026fit=max\u0026auto=format\u0026n=v5p5w9EX1_dka_GD\u0026q=85\u0026s=b69ad6e4fe09fcbe84d2a502903d7d73 2500w`}),`\n`,_jsxs(_components.p,{children:[`The first chunk is not printed and is only used to import the script with the command `,_jsx(_components.code,{children:`read_chunk(\"mycode.R\")`}),` . That’s why the option `,_jsx(_components.code,{children:`echo=FALSE`}),` is set. Also, scripts must not be cached. Once the script is imported, you can print a chunk using the label you set after `,_jsx(_components.code,{children:`## ----`}),`. In this case it’s `,_jsx(_components.code,{children:`myrcode2`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`We have put all the article code fragments into a project that `,_jsx(_components.a,{href:`https://www.overleaf.com/project/new/template/20429?id=69894649\u0026templateName=Knitr+full+demo\u0026latexEngine=pdflatex\u0026texImage=texlive-full%3A2020.1\u0026mainFile=`,children:`you can Open on Overleaf`}),` .`]}),`\n`,_jsx(Heading,{level:`3`,id:`reference-guide`,children:`Reference guide`}),`\n`,_jsx(_components.p,{children:`Some chunk options:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`results`}),`. Changes the behavior of the results generated by the R code. Possible values are:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`markup`}),` Use LaTeX to format the output.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`asis`}),` Print raw results from R.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`hold`}),` Hold the output results and push them to the end of the chunk.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`hide`}),` Hide results.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`echo`}),`. Whether to include the R source code. Other parameters include:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`echo=2:3`}),` prints only the second and third lines;`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`echo=-2:-3`}),` excludes the second and third lines only.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`cache`}),`. Whether to cache the code chunk. Possible values are: `,_jsx(_components.code,{children:`TRUE`}),` and `,_jsx(_components.code,{children:`FALSE`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`highlight`}),`. Whether to highlight the source code. Possible values are: `,_jsx(_components.code,{children:`TRUE`}),` and `,_jsx(_components.code,{children:`FALSE`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`background`}),`. Background color of the chunk. rgb and HTML formats can be used. The default value is `,_jsx(_components.em,{children:`“#F7F7F7”`}),`.`]}),`\n`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"R code (knitr)","icon":"binary","description":null,"href":"/texlive/skills/r-code-knitr"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Chunks of code","slug":"chunks-of-code","depth":3,"children":[]},{"title":"Inline commands","slug":"inline-commands","depth":3,"children":[]},{"title":"Plots","slug":"plots","depth":3,"children":[]},{"title":"External R scripts","slug":"external-r-scripts","depth":3,"children":[]},{"title":"Reference guide","slug":"reference-guide","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"ayakaleaf-pro","siteName":"Ayakaleaf Pro","title":"R code (knitr) - Ayakaleaf Pro","contextualStarterQuestions":[{"_id":"6aeffa1d601aeb1eca9e06ec","deploymentId":"6ab947b94ecd4e13d0332f05","questionText":"What file extensions work with knitr?","status":"active","generatedBy":"contextual","path":"texlive/skills/r-code-knitr","createdAt":"2026-11-08T04:27:09.811Z","updatedAt":"2026-11-08T04:27:09.811Z","__v":0},{"_id":"6aeffa1d601aeb1eca9e06ed","deploymentId":"6ab947b94ecd4e13d0332f05","questionText":"How do I embed R code in LaTeX?","status":"active","generatedBy":"contextual","path":"texlive/skills/r-code-knitr","createdAt":"2026-11-08T04:27:09.811Z","updatedAt":"2026-11-08T04:27:09.811Z","__v":0},{"_id":"6aeffa1d601aeb1eca9e06ee","deploymentId":"6ab947b94ecd4e13d0332f05","questionText":"What does knitr output to my document?","status":"active","generatedBy":"contextual","path":"texlive/skills/r-code-knitr","createdAt":"2026-11-08T04:27:09.811Z","updatedAt":"2026-11-08T04:27:09.811Z","__v":0}],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/texlive/skills/r-code-knitr","matchLevel":0},"zh-CN":{"href":"/zh-CN/texlive/skills/r-code-knitr","matchLevel":1},"zh-TW":{"href":"/zh-TW/texlive/skills/r-code-knitr","matchLevel":1},"ja":{"href":"/ja/texlive/skills/r-code-knitr","matchLevel":1},"de":{"href":"/de/texlive/skills/r-code-knitr","matchLevel":1},"fr":{"href":"/fr/texlive/skills/r-code-knitr","matchLevel":1},"es":{"href":"/es/texlive/skills/r-code-knitr","matchLevel":1},"it":{"href":"/it/texlive/skills/r-code-knitr","matchLevel":1},"ko":{"href":"/ko/texlive/skills/r-code-knitr","matchLevel":1},"ru":{"href":"/ru/texlive/skills/r-code-knitr","matchLevel":1},"nl":{"href":"/nl/texlive/skills/r-code-knitr","matchLevel":1},"pt":{"href":"/pt/texlive/skills/r-code-knitr","matchLevel":1},"tr":{"href":"/tr/texlive/skills/r-code-knitr","matchLevel":1},"uk":{"href":"/uk/texlive/skills/r-code-knitr","matchLevel":1},"pl":{"href":"/pl/texlive/skills/r-code-knitr","matchLevel":1},"cs":{"href":"/cs/texlive/skills/r-code-knitr","matchLevel":1},"sv":{"href":"/sv/texlive/skills/r-code-knitr","matchLevel":1},"fi":{"href":"/fi/texlive/skills/r-code-knitr","matchLevel":1},"ar":{"href":"/ar/texlive/skills/r-code-knitr","matchLevel":1},"vi":{"href":"/vi/texlive/skills/r-code-knitr","matchLevel":1},"no":{"href":"/no/texlive/skills/r-code-knitr","matchLevel":1},"da":{"href":"/da/texlive/skills/r-code-knitr","matchLevel":1},"id":{"href":"/id/texlive/skills/r-code-knitr","matchLevel":1},"zh-Hans":{"href":"/zh-Hans/texlive/skills/r-code-knitr","matchLevel":1},"zh-Hant":{"href":"/zh-Hant/texlive/skills/r-code-knitr","matchLevel":1}}},"lastModified":"2026-11-05T07:47:37.962Z","gitLastModified":"2026-10-04T07:53:39.000Z","originalFileLocation":"texlive/skills/r-code-knitr.mdx","locale":"en"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"application-name\" content=\"Ayakaleaf Pro\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"R code (knitr) - Ayakaleaf Pro\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Ayakaleaf Pro\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://ayakaleaf-pro.mintlify.site/_mintlify/api/og/v2?division=Skills\u0026amp;title=R+code+%28knitr%29\u0026amp;theme=a85f2ba202ff92d99974cf6c\u0026amp;signature=4c3323463bffa9848506022ab37899b427ed63a804baf4cd585ea42d012a2a86\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"R code (knitr) - Ayakaleaf Pro\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://ayakaleaf-pro.mintlify.site/_mintlify/api/og/v2?division=Skills\u0026amp;title=R+code+%28knitr%29\u0026amp;theme=a85f2ba202ff92d99974cf6c\u0026amp;signature=4c3323463bffa9848506022ab37899b427ed63a804baf4cd585ea42d012a2a86\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/ayakaleaf-pro/o_LAbiVNKQm96Y75/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Ayakaleaf Pro\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#0E0E0E\">\u003clink data-mint-head rel=\"canonical\" href=\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/texlive/skills/r-code-knitr.md\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"en\" href=\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh-CN\" href=\"https://ayakaleaf-pro.mintlify.app/zh-CN/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh-TW\" href=\"https://ayakaleaf-pro.mintlify.app/zh-TW/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ja\" href=\"https://ayakaleaf-pro.mintlify.app/ja/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"de\" href=\"https://ayakaleaf-pro.mintlify.app/de/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"fr\" href=\"https://ayakaleaf-pro.mintlify.app/fr/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"es\" href=\"https://ayakaleaf-pro.mintlify.app/es/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"it\" href=\"https://ayakaleaf-pro.mintlify.app/it/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ko\" href=\"https://ayakaleaf-pro.mintlify.app/ko/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ru\" href=\"https://ayakaleaf-pro.mintlify.app/ru/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"nl\" href=\"https://ayakaleaf-pro.mintlify.app/nl/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"pt\" href=\"https://ayakaleaf-pro.mintlify.app/pt/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"tr\" href=\"https://ayakaleaf-pro.mintlify.app/tr/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"uk\" href=\"https://ayakaleaf-pro.mintlify.app/uk/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"pl\" href=\"https://ayakaleaf-pro.mintlify.app/pl/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"cs\" href=\"https://ayakaleaf-pro.mintlify.app/cs/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"sv\" href=\"https://ayakaleaf-pro.mintlify.app/sv/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"fi\" href=\"https://ayakaleaf-pro.mintlify.app/fi/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"ar\" href=\"https://ayakaleaf-pro.mintlify.app/ar/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"vi\" href=\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"no\" href=\"https://ayakaleaf-pro.mintlify.app/no/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"da\" href=\"https://ayakaleaf-pro.mintlify.app/da/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"id\" href=\"https://ayakaleaf-pro.mintlify.app/id/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh-Hans\" href=\"https://ayakaleaf-pro.mintlify.app/zh-Hans/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"zh-Hant\" href=\"https://ayakaleaf-pro.mintlify.app/zh-Hant/texlive/skills/r-code-knitr\">\u003clink data-mint-head rel=\"alternate\" hreflang=\"x-default\" href=\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://ayakaleaf-pro.mintlify.app/#organization\",\"name\":\"Ayakaleaf Pro\",\"url\":\"https://ayakaleaf-pro.mintlify.app\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/ayakaleaf-pro/JetHeEeglWIIXNds/logo/light.png?fit=max\u0026auto=format\u0026n=JetHeEeglWIIXNds\u0026q=85\u0026s=7f1abd8dcc74dd3b7cdafac9e6e82092\"}},{\"@type\":\"WebSite\",\"@id\":\"https://ayakaleaf-pro.mintlify.app#website\",\"name\":\"Ayakaleaf Pro\",\"url\":\"https://ayakaleaf-pro.mintlify.app\",\"publisher\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr#webpage\",\"url\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr\",\"name\":\"R code (knitr)\",\"dateModified\":\"2026-10-04T07:53:39.000Z\",\"isPartOf\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Skills\",\"item\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/adding-latex-dependencies\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R code (knitr)\",\"item\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr#article\",\"headline\":\"R code (knitr)\",\"name\":\"R code (knitr)\",\"url\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr\",\"mainEntityOfPage\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app/texlive/skills/r-code-knitr#webpage\"},\"dateModified\":\"2026-10-04T07:53:39.000Z\",\"publisher\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app/#organization\"},\"isPartOf\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Ayakaleaf Pro\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Ayakaleaf Pro\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/texlive/skills/r-code-knitr.md","siteName":"Ayakaleaf Pro","nav":{"global":null,"languages":[{"language":"en","default":true,"tabs":[{"tab":"Home","icon":"house-chimney","pages":[{"title":"Home","href":""}]},{"tab":"On-Premises","icon":"server","pages":[{"title":"On-Premises","href":"/on-premises"}]},{"tab":"Blog","icon":"rss","pages":[{"title":"Blog","href":"/blog"}]},{"tab":"TeXLive","icon":"compact-disc","groups":[{"group":"Overview","pages":[{"title":"TeX Live","icon":"compact-disc","href":"/texlive"},{"title":"TeX Live in Docker","icon":"https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/docker.svg","href":"/texlive/texlive-in-docker"}]},{"group":"Release","pages":[{"title":"TeX Live 2026 is now available","icon":"box-isometric","href":"/texlive/release/tex-live-2026-is-now-available"}]},{"group":"Skills","pages":[{"title":"Adding LaTeX dependencies","icon":"https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/codepen.svg","href":"/texlive/skills/adding-latex-dependencies"},{"title":"Creating accessible PDFs","icon":"universal-access","description":null,"href":"/texlive/skills/creating-accessible-pdfs"},{"title":"R code (knitr)","icon":"binary","href":"/texlive/skills/r-code-knitr"}]},{"group":"LaTeX basics","pages":[{"title":"Learn LaTeX in 30 minutes","description":null,"href":"/texlive/latex-basics/learn-latex-in-30-minutes"}]},{"group":"Package Related","pages":[{"title":"{Minted}","icon":"code","href":"/texlive/package-related/minted"}]}]},{"tab":"Developer","icon":"rectangle-terminal","pages":[{"title":"Developer","href":"/dev"}]}]},{"language":"zh-CN","pages":[{"title":"zh-CN","href":"/zh-CN/texlive/skills/r-code-knitr"}]},{"language":"zh-TW","pages":[{"title":"zh-TW","href":"/zh-TW/texlive/skills/r-code-knitr"}]},{"language":"ja","pages":[{"title":"ja","href":"/ja/texlive/skills/r-code-knitr"}]},{"language":"de","pages":[{"title":"de","href":"/de/texlive/skills/r-code-knitr"}]},{"language":"fr","pages":[{"title":"fr","href":"/fr/texlive/skills/r-code-knitr"}]},{"language":"es","pages":[{"title":"es","href":"/es/texlive/skills/r-code-knitr"}]},{"language":"it","pages":[{"title":"it","href":"/it/texlive/skills/r-code-knitr"}]},{"language":"ko","pages":[{"title":"ko","href":"/ko/texlive/skills/r-code-knitr"}]},{"language":"ru","pages":[{"title":"ru","href":"/ru/texlive/skills/r-code-knitr"}]},{"language":"nl","pages":[{"title":"nl","href":"/nl/texlive/skills/r-code-knitr"}]},{"language":"pt","pages":[{"title":"pt","href":"/pt/texlive/skills/r-code-knitr"}]},{"language":"tr","pages":[{"title":"tr","href":"/tr/texlive/skills/r-code-knitr"}]},{"language":"uk","pages":[{"title":"uk","href":"/uk/texlive/skills/r-code-knitr"}]},{"language":"pl","pages":[{"title":"pl","href":"/pl/texlive/skills/r-code-knitr"}]},{"language":"cs","pages":[{"title":"cs","href":"/cs/texlive/skills/r-code-knitr"}]},{"language":"sv","pages":[{"title":"sv","href":"/sv/texlive/skills/r-code-knitr"}]},{"language":"fi","pages":[{"title":"fi","href":"/fi/texlive/skills/r-code-knitr"}]},{"language":"ar","pages":[{"title":"ar","href":"/ar/texlive/skills/r-code-knitr"}]},{"language":"vi","pages":[{"title":"vi","href":"/vi/texlive/skills/r-code-knitr"}]},{"language":"no","pages":[{"title":"no","href":"/no/texlive/skills/r-code-knitr"}]},{"language":"da","pages":[{"title":"da","href":"/da/texlive/skills/r-code-knitr"}]},{"language":"id","pages":[{"title":"id","href":"/id/texlive/skills/r-code-knitr"}]},{"language":"zh-Hans","pages":[{"title":"zh-Hans","href":"/zh-Hans/texlive/skills/r-code-knitr"}]},{"language":"zh-Hant","pages":[{"title":"zh-Hant","href":"/zh-Hant/texlive/skills/r-code-knitr"}]}]},"basePath":"","title":"R code (knitr) - Ayakaleaf Pro","deploymentId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","buildId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-BQ4tbj_9.js","lightbox-handle-r17bVUz3.js"]}