Overleaf cung cấp tích hợp với knitr, cho phép bạn thêm mã R vào tài liệu LaTeX để tạo ra đầu ra động.Các tài liệu chứa mã R phải được lưu với phần mở rộng .Rtex hoặc .Rnw, nếu không mã sẽ không hoạt động. Hãy xem một ví dụ:
\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}
Mở ví dụ knitr này trên OverleafNhư bạn thấy, phần văn bản nằm giữa các ký tự <<>>= và @ là mã R. Mã này và kết quả đầu ra của nó được in theo định dạng giống như listing. Khối mã này có thể nhận thêm một số tham số để tùy chỉnh đầu ra động, như được mô tả trong phần tiếp theo.
Các khối mã (chunk)
Một khối mã như khối được trình bày ở phần trước thường được gọi là chunk. Bạn có thể đặt thêm một số tùy chọn trong các chunk của knitr. Xem ví dụ dưới đây:
\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}
echo=FALSE Tùy chọn này ẩn mã và chỉ in ra kết quả do R tạo ra.
cache=TRUE Nếu cache được đặt thành true, chunk sẽ không được chạy, chỉ sử dụng các đối tượng do nó tạo ra. Điều này giúp tiết kiệm thời gian nếu dữ liệu trong chunk đó không thay đổi.
Lưu ý rằng tùy chọn cache=TRUE hiện chưa được hỗ trợ trên Overleaf, nhưng nó sẽ hoạt động khi chạy cục bộ.
Có thể truy cập các đối tượng được tạo trong một chunk và in chúng ngay trong dòng văn bản.
\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}
Mở ví dụ knitr này trên OverleafLệnh \Sexpr{mean(X)} in ra kết quả trả về bởi mã R mean(X). Bên trong dấu ngoặc nhọn, bạn có thể truyền bất kỳ lệnh R nào.
Biểu đồ
Biểu đồ cũng có thể được thêm vào tài liệu knitr, như trong ví dụ sau:
Mở ví dụ knitr này trên OverleafBiểu đồ histogram này sử dụng dữ liệu được lưu trong “data.txt”, nằm trong thư mục làm việc hiện tại. Một vài tùy chọn liên quan đến hình được truyền vào chunk.plot1 Đây là nhãn dùng để tham chiếu đến biểu đồ. Tiền tố “fig:” là bắt buộc. Bạn có thể thấy trong ví dụ rằng hình được tham chiếu bằng \ref{fig:plot1}. fig.pos="t" Tham số định vị. Tham số này giống với tham số được dùng trong môi trường figure. fig.height=4, fig.width=4 Chiều rộng và chiều cao của hình. fig.cap="First plot" Chú thích cho hình.
Script R bên ngoài
Bạn có thể nhập các phần của một script R bên ngoài vào tài liệu knitr. Điều này rất hữu ích vì việc viết và gỡ lỗi script trong một chương trình bên ngoài trước khi đưa vào tài liệu là khá phổ biến.Giả sử chúng ta có đoạn mã R sau trong một tệp tên là mycode.R mà chúng ta đưa vào tài liệu LaTeX:
## ---- myrcode1# Create a sequence of numbers X = 2:10## ---- myrcode2# Display basic statistical measuressummary(X)
Hãy chú ý các dòng:
## ---- myrcode1
và
## ---- myrcode2
Các dòng này đánh dấu điểm bắt đầu của một chunk mã và là bắt buộc nếu bạn muốn sử dụng script này trong tài liệu, như được minh họa trong đoạn mã sau:
The chunk below will not be printed<<echo=FALSE, cache=FALSE>>=read_chunk("mycode.R")@The code must show up here<<myrcode2>>=@
Chunk đầu tiên không được in ra và chỉ được dùng để nhập script bằng lệnh read_chunk("mycode.R"). Đó là lý do tùy chọn echo=FALSE được đặt. Ngoài ra, các script không được lưu cache. Sau khi script đã được nhập, bạn có thể in một chunk bằng nhãn mà bạn đặt sau ## ----. Trong trường hợp này là myrcode2.Chúng tôi đã đưa tất cả các đoạn mã trong bài viết vào một dự án mà bạn có thể mở trên Overleaf.
Hướng dẫn tham khảo
Một số tùy chọn của chunk:
results. Thay đổi cách xử lý các kết quả do mã R tạo ra. Các giá trị có thể dùng là:
markup Sử dụng LaTeX để định dạng đầu ra.
asis In kết quả thô từ R.
hold Giữ lại kết quả đầu ra và đẩy chúng xuống cuối chunk.
hide Ẩn kết quả.
echo. Có bao gồm mã nguồn R hay không. Các tham số khác bao gồm:
echo=2:3 chỉ in dòng thứ hai và thứ ba;
echo=-2:-3 chỉ loại trừ dòng thứ hai và thứ ba.
cache. Có lưu cache cho chunk mã hay không. Các giá trị có thể dùng là: TRUE và FALSE
highlight. Có tô sáng cú pháp mã nguồn hay không. Các giá trị có thể dùng là: TRUE và FALSE
background. Màu nền của chunk. Có thể dùng định dạng rgb và HTML. Giá trị mặc định là “#F7F7F7”.
Lần sửa đổi cuối 4 tháng 10, 2026
Trang này có hữu ích không?
{"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":"6b01b8980081ff9d8e91cddc","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"ar","tag":"الاستضافة المحلية","count":159},{"language":"en","tag":"On-Premises","count":159},{"language":"cs","tag":"On-Premises","count":159},{"language":"da","tag":"On-premises","count":159},{"language":"de","tag":"On-Premises","count":159},{"language":"es","tag":"Local","count":159},{"language":"fi","tag":"Paikallinen asennus","count":159},{"language":"fr","tag":"Sur site","count":159},{"language":"id","tag":"On-Premises","count":159},{"language":"it","tag":"On-premise","count":159},{"language":"ja","tag":"オンプレミス","count":159},{"language":"ko","tag":"온프레미스","count":159},{"language":"nl","tag":"On-premises","count":159},{"language":"no","tag":"Lokal drift","count":159},{"language":"pl","tag":"On-Premises","count":159},{"language":"pt","tag":"On-Premises","count":159},{"language":"ru","tag":"Локальное развертывание","count":159},{"language":"sv","tag":"On-Premises","count":159},{"language":"tr","tag":"Şirket İçi Kurulum","count":159},{"language":"uk","tag":"Локальне розгортання","count":159},{"language":"vi","tag":"Tự triển khai (On-Premises)","count":159},{"language":"zh-CN","tag":"本地部署","count":159},{"language":"zh-Hans","tag":"本地部署","count":159},{"language":"zh-Hant","tag":"本地部署","count":159},{"language":"zh-TW","tag":"本地部署","count":159},{"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":51},{"language":"cs","tag":"Vývojáři","count":51},{"language":"da","tag":"Udvikler","count":51},{"language":"de","tag":"Entwickler","count":51},{"language":"es","tag":"Desarrollador","count":51},{"language":"fi","tag":"Kehittäjä","count":51},{"language":"fr","tag":"Développeur","count":51},{"language":"id","tag":"Pengembang","count":51},{"language":"it","tag":"Sviluppatore","count":51},{"language":"ja","tag":"開発者","count":51},{"language":"ko","tag":"개발자","count":51},{"language":"nl","tag":"Ontwikkelaar","count":51},{"language":"no","tag":"Utvikler","count":51},{"language":"pl","tag":"Dla deweloperów","count":51},{"language":"pt","tag":"Desenvolvedor","count":51},{"language":"ru","tag":"Разработчикам","count":51},{"language":"sv","tag":"Utvecklare","count":51},{"language":"tr","tag":"Geliştirici","count":51},{"language":"uk","tag":"Розробникам","count":51},{"language":"vi","tag":"Nhà phát triển","count":51},{"language":"zh-CN","tag":"开发者","count":51},{"language":"zh-Hans","tag":"开发者","count":51},{"language":"zh-Hant","tag":"開發者","count":51},{"language":"zh-TW","tag":"開發者","count":51},{"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":"نموذج البيانات","count":31},{"language":"cs","tag":"Datový model","count":31},{"language":"da","tag":"Datamodel","count":31},{"language":"de","tag":"Datenmodell","count":31},{"language":"es","tag":"Modelo de datos","count":31},{"language":"fi","tag":"Tietomalli","count":31},{"language":"fr","tag":"Modèle de données","count":31},{"language":"id","tag":"Model Data","count":31},{"language":"it","tag":"Modello dati","count":31},{"language":"ja","tag":"データモデル","count":31},{"language":"ko","tag":"데이터 모델","count":31},{"language":"nl","tag":"Datamodel","count":31},{"language":"no","tag":"Datamodell","count":31},{"language":"pl","tag":"Model danych","count":31},{"language":"pt","tag":"Modelo de dados","count":31},{"language":"ru","tag":"Модель данных","count":31},{"language":"sv","tag":"Datamodell","count":31},{"language":"tr","tag":"Veri Modeli","count":31},{"language":"uk","tag":"Модель даних","count":31},{"language":"vi","tag":"Mô hình dữ liệu","count":31},{"language":"zh-CN","tag":"数据模型","count":31},{"language":"zh-Hans","tag":"数据模型","count":31},{"language":"zh-Hant","tag":"資料模型","count":31},{"language":"zh-TW","tag":"資料模型","count":31},{"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":"Uživatelská příručka","count":24},{"language":"da","tag":"Brugervejledning","count":24},{"language":"de","tag":"Benutzerhandbuch","count":24},{"language":"es","tag":"Guía del usuario","count":24},{"language":"fi","tag":"Käyttöopas","count":24},{"language":"fr","tag":"Guide de l'utilisateur","count":24},{"language":"id","tag":"Panduan pengguna","count":24},{"language":"it","tag":"Guida utente","count":24},{"language":"ja","tag":"ユーザーガイド","count":24},{"language":"ko","tag":"사용자 가이드","count":24},{"language":"nl","tag":"Gebruikershandleiding","count":24},{"language":"no","tag":"Brukerveiledning","count":24},{"language":"pl","tag":"Przewodnik użytkownika","count":24},{"language":"pt","tag":"Guia do usuário","count":24},{"language":"ru","tag":"Руководство пользователя","count":24},{"language":"sv","tag":"Användarguide","count":24},{"language":"tr","tag":"Kullanıcı kılavuzu","count":24},{"language":"uk","tag":"Посібник користувача","count":24},{"language":"vi","tag":"Hướng dẫn người dùng","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}],"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":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"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":"vi/texlive/skills/r-code-knitr","slug":"/vi/texlive/skills/r-code-knitr","pageMetadata":{"title":"Mã R (knitr)","icon":"binary","description":null,"href":"/vi/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 cung cấp tích hợp với `,_jsx(_components.strong,{children:`knitr`}),`, cho phép bạn thêm mã R vào tài liệu LaTeX để tạo ra đầu ra động.`]}),`\n`,_jsxs(_components.p,{children:[`Các tài liệu chứa mã R phải được lưu với phần mở rộng `,_jsx(_components.code,{children:`.Rtex`}),` hoặc `,_jsx(_components.code,{children:`.Rnw`}),`, nếu không mã sẽ không hoạt động. Hãy xem một ví dụ:`]}),`\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:[`Mở ví dụ `,_jsx(_components.code,{children:`knitr`}),` này trên Overleaf`]})}),`\n`,_jsxs(_components.p,{children:[`Như bạn thấy, phần văn bản nằm giữa các ký tự `,_jsx(_components.code,{children:`\u003c\u003c>>=`}),` và `,_jsx(_components.code,{children:`@`}),` là mã R. Mã này và kết quả đầu ra của nó được in theo định dạng giống như listing. Khối mã này có thể nhận thêm một số tham số để tùy chỉnh đầu ra động, như được mô tả trong phần tiếp theo.`]}),`\n`,_jsx(Heading,{level:`3`,id:`các-khối-mã-chunk`,children:`Các khối mã (chunk)`}),`\n`,_jsxs(_components.p,{children:[`Một khối mã như khối được trình bày ở phần trước thường được gọi là `,_jsx(_components.em,{children:`chunk`}),`. Bạn có thể đặt thêm một số tùy chọn trong các chunk của knitr. Xem ví dụ dưới đây:`]}),`\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:[`Mở ví dụ `,_jsx(_components.code,{children:`knitr`}),` này trên Overleaf`]})}),`\n`,_jsxs(_components.p,{children:[`Có hai tùy chọn bổ sung được truyền vào bên trong `,_jsx(_components.code,{children:`\u003c\u003c`}),` và `,_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`}),` Tùy chọn này ẩn mã và chỉ in ra kết quả do R tạo ra.`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`cache=TRUE`}),` Nếu cache được đặt thành true, chunk sẽ không được chạy, chỉ sử dụng các đối tượng do nó tạo ra. Điều này giúp tiết kiệm thời gian nếu dữ liệu trong chunk đó không thay đổi.`]}),`\n`,_jsx(Info,{children:_jsx(`em`,{children:`Lưu ý rằng tùy chọn cache=TRUE hiện chưa được hỗ trợ trên Overleaf, nhưng nó sẽ hoạt động khi chạy cục bộ.`})}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`Xem `,_jsx(_components.a,{href:`https://learn.overleaf.com/learn/Knitr#Reference_guide`,children:`hướng dẫn tham khảo`}),` để biết thêm các tùy chọn.`]}),`\n`,_jsx(Heading,{level:`3`,id:`lệnh-nội-dòng`,children:`Lệnh nội dòng`}),`\n`,_jsx(_components.p,{children:`Có thể truy cập các đối tượng được tạo trong một chunk và in chúng ngay trong dòng văn bản.`}),`\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:[`Mở ví dụ `,_jsx(_components.code,{children:`knitr`}),` này trên Overleaf`]})}),`\n`,_jsxs(_components.p,{children:[`Lệnh `,_jsx(_components.code,{children:`\\\\Sexpr{mean(X)}`}),` in ra kết quả trả về bởi mã R `,_jsx(_components.code,{children:`mean(X)`}),`. Bên trong dấu ngoặc nhọn, bạn có thể truyền bất kỳ lệnh R nào.`]}),`\n`,_jsx(Heading,{level:`3`,id:`biểu-đồ`,children:`Biểu đồ`}),`\n`,_jsx(_components.p,{children:`Biểu đồ cũng có thể được thêm vào tài liệu knitr, như trong ví dụ sau:`}),`\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:[`Mở ví dụ `,_jsx(_components.code,{children:`knitr`}),` này trên Overleaf`]})}),`\n`,_jsx(_components.p,{children:`Biểu đồ histogram này sử dụng dữ liệu được lưu trong “data.txt”, nằm trong thư mục làm việc hiện tại. Một vài tùy chọn liên quan đến hình được truyền vào chunk.`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`plot1`}),` Đây là nhãn dùng để tham chiếu đến biểu đồ. Tiền tố “fig:” là bắt buộc. Bạn có thể thấy trong ví dụ rằng hình được tham chiếu bằng `,_jsx(_components.code,{children:`\\\\ref{fig:plot1}`}),`. `,_jsx(_components.code,{children:`fig.pos=\"t\"`}),` Tham số định vị. Tham số này giống với tham số được dùng trong `,_jsx(_components.a,{href:`https://learn.overleaf.com/learn/Positioning_images_and_tables#The_figure_environment`,children:`môi trường figure`}),`. `,_jsx(_components.code,{children:`fig.height=4, fig.width=4`}),` Chiều rộng và chiều cao của hình. `,_jsx(_components.code,{children:`fig.cap=\"First plot\"`}),` Chú thích cho hình.`]}),`\n`,_jsx(Heading,{level:`3`,id:`script-r-bên-ngoài`,children:`Script R bên ngoài`}),`\n`,_jsx(_components.p,{children:`Bạn có thể nhập các phần của một script R bên ngoài vào tài liệu knitr. Điều này rất hữu ích vì việc viết và gỡ lỗi script trong một chương trình bên ngoài trước khi đưa vào tài liệu là khá phổ biến.`}),`\n`,_jsxs(_components.p,{children:[`Giả sử chúng ta có đoạn mã R sau trong một tệp tên là `,_jsx(_components.code,{children:`mycode.R`}),` mà chúng ta đưa vào tài liệu LaTeX:`]}),`\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:`Hãy chú ý các dòng:`}),`\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:`và`}),`\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:`Các dòng này đánh dấu điểm bắt đầu của một chunk mã và là bắt buộc nếu bạn muốn sử dụng script này trong tài liệu, như được minh họa trong đoạn mã sau:`}),`\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:[`Chunk đầu tiên không được in ra và chỉ được dùng để nhập script bằng lệnh `,_jsx(_components.code,{children:`read_chunk(\"mycode.R\")`}),`. Đó là lý do tùy chọn `,_jsx(_components.code,{children:`echo=FALSE`}),` được đặt. Ngoài ra, các script không được lưu cache. Sau khi script đã được nhập, bạn có thể in một chunk bằng nhãn mà bạn đặt sau `,_jsx(_components.code,{children:`## ----`}),`. Trong trường hợp này là `,_jsx(_components.code,{children:`myrcode2`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Chúng tôi đã đưa tất cả các đoạn mã trong bài viết vào một dự án mà `,_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:`bạn có thể mở trên Overleaf`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`hướng-dẫn-tham-khảo`,children:`Hướng dẫn tham khảo`}),`\n`,_jsx(_components.p,{children:`Một số tùy chọn của chunk:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`results`}),`. Thay đổi cách xử lý các kết quả do mã R tạo ra. Các giá trị có thể dùng là:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`markup`}),` Sử dụng LaTeX để định dạng đầu ra.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`asis`}),` In kết quả thô từ R.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`hold`}),` Giữ lại kết quả đầu ra và đẩy chúng xuống cuối chunk.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`hide`}),` Ẩn kết quả.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`echo`}),`. Có bao gồm mã nguồn R hay không. Các tham số khác bao gồm:`,`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`echo=2:3`}),` chỉ in dòng thứ hai và thứ ba;`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`echo=-2:-3`}),` chỉ loại trừ dòng thứ hai và thứ ba.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`cache`}),`. Có lưu cache cho chunk mã hay không. Các giá trị có thể dùng là: `,_jsx(_components.code,{children:`TRUE`}),` và `,_jsx(_components.code,{children:`FALSE`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`highlight`}),`. Có tô sáng cú pháp mã nguồn hay không. Các giá trị có thể dùng là: `,_jsx(_components.code,{children:`TRUE`}),` và `,_jsx(_components.code,{children:`FALSE`})]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`background`}),`. Màu nền của chunk. Có thể dùng định dạng rgb và HTML. Giá trị mặc định là `,_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":"Mã R (knitr)","icon":"binary","description":null,"href":"/vi/texlive/skills/r-code-knitr"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Các khối mã (chunk)","slug":"các-khối-mã-chunk","depth":3,"children":[]},{"title":"Lệnh nội dòng","slug":"lệnh-nội-dòng","depth":3,"children":[]},{"title":"Biểu đồ","slug":"biểu-đồ","depth":3,"children":[]},{"title":"Script R bên ngoài","slug":"script-r-bên-ngoài","depth":3,"children":[]},{"title":"Hướng dẫn tham khảo","slug":"hướng-dẫn-tham-khảo","depth":3,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"ayakaleaf-pro","siteName":"Ayakaleaf Pro","title":"Mã R (knitr) - Ayakaleaf Pro","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{"en":{"href":"/texlive/skills/r-code-knitr","matchLevel":1},"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":0},"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:36.864Z","gitLastModified":"2026-10-04T09:44:31.000Z","originalFileLocation":"vi/texlive/skills/r-code-knitr.mdx","locale":"vi"},"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=\"Mã R (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/vi/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=M%C3%A3+R+%28knitr%29\u0026amp;theme=a85f2ba202ff92d99974cf6c\u0026amp;signature=9b5c4f815d5d880b0fb214c6d7fe9c9683e4ec33eedffb13bebb667548e63835\">\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=\"Mã R (knitr) - Ayakaleaf Pro\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://ayakaleaf-pro.mintlify.site/_mintlify/api/og/v2?division=Skills\u0026amp;title=M%C3%A3+R+%28knitr%29\u0026amp;theme=a85f2ba202ff92d99974cf6c\u0026amp;signature=9b5c4f815d5d880b0fb214c6d7fe9c9683e4ec33eedffb13bebb667548e63835\">\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/vi/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=\"/vi/texlive/skills/r-code-knitr.md\">\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=\"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=\"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/vi/texlive/skills/r-code-knitr#webpage\",\"url\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr\",\"name\":\"Mã R (knitr)\",\"dateModified\":\"2026-10-04T09:44:31.000Z\",\"isPartOf\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app#website\"},\"breadcrumb\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Skills\",\"item\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/adding-latex-dependencies\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mã R (knitr)\",\"item\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr#article\",\"headline\":\"Mã R (knitr)\",\"name\":\"Mã R (knitr)\",\"url\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr\",\"mainEntityOfPage\":{\"@id\":\"https://ayakaleaf-pro.mintlify.app/vi/texlive/skills/r-code-knitr#webpage\"},\"dateModified\":\"2026-10-04T09:44:31.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":"/vi/texlive/skills/r-code-knitr.md","siteName":"Ayakaleaf Pro","nav":{"global":null,"languages":[{"language":"en","default":true,"pages":[{"title":"en","href":"/texlive/skills/r-code-knitr"}]},{"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","tabs":[{"tab":"Trang chủ","icon":"house-chimney","pages":[{"title":"Trang chủ","href":"/vi"}]},{"tab":"Tự triển khai (On-Premises)","icon":"server","pages":[{"title":"Tự triển khai (On-Premises)","href":"/vi/on-premises"}]},{"tab":"Blog","icon":"rss","pages":[{"title":"Blog","href":"/vi/blog"}]},{"tab":"TeXLive","icon":"compact-disc","groups":[{"group":"Tổng quan","pages":[{"title":"TeX Live","icon":"compact-disc","href":"/vi/texlive"},{"title":"TeX Live trong Docker","icon":"https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/docker.svg","href":"/vi/texlive/texlive-in-docker"}]},{"group":"Phát hành","pages":[{"title":"TeX Live 2026 đã ra mắt","icon":"box-isometric","href":"/vi/texlive/release/tex-live-2026-is-now-available"}]},{"group":"Skills","pages":[{"title":"Thêm các phụ thuộc LaTeX","icon":"https://d3gk2c5xim1je2.cloudfront.net/fontawesome/v7.2.0/brands/codepen.svg","href":"/vi/texlive/skills/adding-latex-dependencies"},{"title":"Tạo PDF có khả năng tiếp cận","icon":"universal-access","description":null,"href":"/vi/texlive/skills/creating-accessible-pdfs"},{"title":"Mã R (knitr)","icon":"binary","href":"/vi/texlive/skills/r-code-knitr"}]},{"group":"Kiến thức cơ bản về LaTeX","pages":[{"title":"Học LaTeX trong 30 phút","description":null,"href":"/vi/texlive/latex-basics/learn-latex-in-30-minutes"}]},{"group":"Liên quan đến gói","pages":[{"title":"{Minted}","icon":"code","href":"/vi/texlive/package-related/minted"}]}]},{"tab":"Nhà phát triển","icon":"rectangle-terminal","pages":[{"title":"Nhà phát triển","href":"/vi/dev"}]}]},{"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":"Mã R (knitr) - Ayakaleaf Pro","deploymentId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","buildId":"dpl_DyXGnKeCjZyA3sUdfMJ7FjkdBefg","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-BQ4tbj_9.js","lightbox-handle-r17bVUz3.js"]}