# Bookdown

> R bookdown package for books and long documents. Use for multi-chapter documents with cross-references.

- Skill: `leolin990405/bookdown` (Agent Skill)
- Install (CLI): `npx get-skill add leolin990405/bookdown`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leolin990405/bookdown/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: LeoLin990405 (https://skillmd.com/u/leolin990405)
- Updated: 2026-11-14
- Page: https://skillmd.com/skills/leolin990405/bookdown

---


# bookdown Package

Authoring books and technical documents.

## Project Structure

```
mybook/
├── index.Rmd        # First chapter (with YAML)
├── 01-intro.Rmd
├── 02-methods.Rmd
├── 03-results.Rmd
├── _bookdown.yml    # Book configuration
├── _output.yml      # Output configuration
└── references.bib
```

## index.Rmd

```yaml
---
title: "My Book"
author: "Author Name"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
bibliography: references.bib
link-citations: yes
---
```

## _bookdown.yml

```yaml
book_filename: "mybook"
delete_merged_file: true
language:
  ui:
    chapter_name: "Chapter "
rmd_files:
  - index.Rmd
  - 01-intro.Rmd
  - 02-methods.Rmd
```

## _output.yml

```yaml
bookdown::gitbook:
  css: style.css
  config:
    toc:
      before: |
        <li><a href="./">My Book</a></li>
bookdown::pdf_book:
  includes:
    in_header: preamble.tex
bookdown::epub_book: default
```

## Cross-References

```markdown
# Introduction {#intro}

See Chapter \@ref(methods) for details.
See Figure \@ref(fig:myplot).
See Table \@ref(tab:mytable).
See Equation \@ref(eq:myeq).

```{r myplot, fig.cap="My caption"}
plot(1:10)
```
```

## Build

```r
bookdown::render_book("index.Rmd", "bookdown::gitbook")
bookdown::render_book("index.Rmd", "bookdown::pdf_book")

# Preview
bookdown::serve_book()
```

