Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsJul 28, 2026·3 min de lectura

bookdown — Author Books and Technical Documents with R Markdown

bookdown is an R package that extends R Markdown to produce multi-chapter books, dissertations, and long-form technical documents. It outputs to HTML, PDF, EPUB, and Word from a single set of Markdown and R code sources.

Listo para agents

Instalación lista para agent

Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
bookdown Guide
Comando de instalación directa
npx -y tokrepo@latest install 2820623f-8ac7-11f1-9bc6-00163e2b0d79 --target codex

Ejecutar después de confirmar el plan con dry-run.

Introduction

bookdown is an R package by Yihui Xie that makes it straightforward to write books and long-form documents using R Markdown. It handles cross-references, numbered figures and tables, citations, and multi-file chapter organization. Many published data science textbooks, including R for Data Science, are authored with bookdown.

What bookdown Does

  • Merges multiple R Markdown files into ordered chapters with a shared bibliography
  • Generates cross-references for figures, tables, equations, theorems, and sections
  • Outputs to HTML (GitBook style), PDF (via LaTeX), EPUB, and Word from one source
  • Embeds executable R code chunks whose output (plots, tables) is rendered inline
  • Supports custom LaTeX and HTML templates for publisher-specific formatting

Architecture Overview

bookdown builds on top of knitr (for executing code) and Pandoc (for format conversion). It reads an index file or _bookdown.yml config that lists chapter files in order. Each chapter is an R Markdown file. bookdown merges them, resolves cross-references, numbers figures and tables, and passes the result to Pandoc for final rendering. The GitBook output format provides a searchable, navigable HTML book with a sidebar table of contents.

Self-Hosting & Configuration

  • Install from CRAN: install.packages("bookdown")
  • Create a new book project via RStudio's project wizard or bookdown::create_book()
  • Configure chapter order and output formats in _bookdown.yml
  • Deploy HTML books to GitHub Pages, Netlify, or Bookdown.org
  • Customize LaTeX preamble in preamble.tex for PDF output styling

Key Features

  • Cross-references with @ref(fig:label) syntax work across all output formats
  • Numbered and captioned figures, tables, and equations with automatic numbering
  • Multi-format output from a single source ensures consistency across HTML and PDF
  • Citation support via BibTeX or CSL with Pandoc's citeproc
  • Extensible with custom output formats and Pandoc templates

Comparison with Similar Tools

  • Quarto — the next-generation successor supporting Python, Julia, and Observable in addition to R; bookdown remains widely used for R-only projects
  • Sphinx (Python) — reStructuredText-based documentation tool; bookdown is more natural for R users and embeds executable R code
  • Jupyter Book — builds books from Jupyter notebooks; bookdown integrates deeply with the R Markdown ecosystem
  • LaTeX — full typesetting control but steeper learning curve; bookdown offers Markdown simplicity with LaTeX output
  • MkDocs / mdBook — static doc generators from Markdown; bookdown adds executable code and academic features (cross-refs, citations)

FAQ

Q: Can I use bookdown without R code? A: Yes. bookdown works as a pure Markdown book authoring tool; R code chunks are optional.

Q: How do I publish a bookdown book online? A: Render to HTML and deploy the _book/ folder to GitHub Pages, Netlify, or bookdown.org (a free hosting service by RStudio).

Q: Does bookdown support languages other than R? A: Code chunks can run Python, SQL, Bash, and other languages supported by knitr engines, but the tooling is R-centric.

Q: Can I create a thesis or dissertation with bookdown? A: Yes. Community templates like thesisdown provide university-specific formatting. bookdown handles the structure, numbering, and bibliography management.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados