Skip to content
This repository was archived by the owner on Feb 14, 2020. It is now read-only.
This repository was archived by the owner on Feb 14, 2020. It is now read-only.

caption numbering not in sequential order when citing the captions #36

@raiphilibert

Description

@raiphilibert

The caption number is not in sequential order when citing the captions but only if the table_nums(..., display="cite") is before the tables. I was trying to give the range of table numbers and it changed the number of the last table. Is there a way to make sure that table numbers remain in sequential order? The number isn't changed if the r table_nums('third_cars_table',display = "cite") is put after the captions.

Reproducible example:

---
title: "Untitled"
output: bookdown::word_document2
---

```{r setup, include=FALSE}
library(captioner)
library(huxtable)
library(knitr)
library(pander)
table_nums <- captioner(prefix = "Table")
fig_nums <- captioner(prefix = "Figure")
knitr::opts_chunk$set(echo = TRUE)
`` `


## Description of tables
I am trying to put a description of tables 
and say that these results are shown table numbers ranging 
from the first table (`r table_nums('first_cars_table',display = "cite")`)
 to the last table (`r table_nums('third_cars_table',display = "cite")`)

```{r, results='asis',echo=FALSE,eval.after=TRUE}
tablecap1=cat(table_nums(name="first_cars_table",caption='First car table'))
kable((cars[1:5,]))

tablecap2=cat(table_nums(name="second_cars_table",caption='second car table'))
kable(cars[6:10,])

tablecap3=cat(table_nums(name="third_cars_table",caption='third car table'))
kable(cars[10:15,])
`` `

The results:
captioner_issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions