Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add a helper function to customize caption numbering#1427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
yihui wants to merge1 commit intomain
base:main
Choose a base branch
Loading
fromformat-caption

Conversation

yihui
Copy link
Contributor

@yihuiyihui commentedMay 7, 2023
edited
Loading

This is supposed toclose#855, but it has a technical flaw that's not easy to overcome. That is, cross-references to custom caption numbers won't work (see the example below).

Installation

remotes::install_github('rstudio/bookdown#1427')

Example

Create a file_bookdown.yml:

language:label:tab:!expr bookdown::number_caption(3, c('Table', 'Supplementary table'))

It means that for tables after the 3rd table, restart the table number from 1, and change the caption label fromTable toSupplementary table).

Then an Rmd file under the same directory:

---title: "Test"output:  bookdown::html_document2:    global_numbering: true  bookdown::word_document2:    global_numbering: true---# Section one```{r, test-a}knitr::kable(head(iris), caption = 'One table.')``````{r, test-b}knitr::kable(iris[7:12, ], caption = 'Another table.')```# Section two```{r, test-c}knitr::kable(iris[7:12, ], caption = 'Another table.')```# Supplementary materialsSupplementary table \@ref(tab:test-d) (this number is incorrect).```{r, test-d}knitr::kable(head(mtcars), caption = 'Yet another table.')```

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Feature request: more manual control of figure/table caption numbering
1 participant
@yihui

[8]ページ先頭

©2009-2025 Movatter.jp