vincentarelbundock / tinytable

Simple and Customizable Tables in `R`
https://vincentarelbundock.github.io/tinytable
GNU General Public License v3.0
221 stars 18 forks source link

The cross-referencing of tinytable::tt() does not work in papaja::apa6_pdf() #398

Open perlatex opened 14 hours ago

perlatex commented 14 hours ago

As shown in the title, cross-referencing tinytable::tt() in papaja::apa6_pdf() does not work.

---
title: "The Chain Mediating Roles"
shorttitle: "Relationship"
author: 
  - name          : "Wang"
    affiliation   : "1"
    corresponding : no
    email         : ""
affiliation:
  - id            : "1"
    institution   : "Faculty of Education"
authornote: |

keywords          : "parent–child"
wordcount         : "X"
numbersections    : yes
floatsintext      : yes
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no
documentclass     : "apa6"
classoption       : "doc"
link-citations    : yes
linkcolor         : red
urlcolor          : blue
citecolor         : blue
output            : 
  papaja::apa6_pdf:
    latex_engine: xelatex
    fig_caption: yes
    keep_tex: false
header-includes   :
  - \usepackage{booktabs}
  - \usepackage{longtable}
  - \usepackage{array}
  - \usepackage{multirow}
  - \usepackage{wrapfig}
  - \usepackage{float}
  - \usepackage{colortbl}
  - \usepackage{pdflscape}
  - \usepackage{tabu}
  - \usepackage{threeparttable}
  - \usepackage{threeparttablex}
  - \usepackage[normalem]{ulem}
  - \usepackage{makecell}
  - \usepackage{tabularray}
  - \usepackage{graphicx}
  - \UseTblrLibrary{booktabs}
  - \UseTblrLibrary{siunitx}
  - \newcommand{\tinytableTabularrayUnderline}[1]{\underline{#1}}
  - \newcommand{\tinytableTabularrayStrikeout}[1]{\sout{#1}}
  - \NewTableCommand{\tinytableDefineColor}[3]{\definecolor{#1}{#2}{#3}}
  - \usepackage{caption,fixltx2e}
  - \usepackage[table]{xcolor}
  - \floatplacement{figure}{H}
  - \raggedbottom
---

# tidytable

see Table \@ref(tab:tbl-blah)

```{r tbl-blah}
library(tinytable)

tt(mtcars[1:4, 1:4], caption = "this is my caption")
vincentarelbundock commented 13 hours ago

Not at the computer now, but can you try putting the title in the Quarto chunk options rather than the caption argument?

perlatex commented 13 hours ago

It's still the same


---
title: "The Chain Mediating Roles"
shorttitle: "Relationship"
author: 
  - name          : "Wang"
    affiliation   : "1"
    corresponding : no
    email         : ""
affiliation:
  - id            : "1"
    institution   : "Faculty of Education"
authornote: |

keywords          : "parent–child"
wordcount         : "X"
numbersections    : yes
floatsintext      : yes
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no
documentclass     : "apa6"
classoption       : "doc"
link-citations    : yes
linkcolor         : red
urlcolor          : blue
citecolor         : blue
output            : 
  papaja::apa6_pdf:
    latex_engine: xelatex
    fig_caption: yes
    keep_tex: false
header-includes   :
  - \usepackage{booktabs}
  - \usepackage{longtable}
  - \usepackage{array}
  - \usepackage{multirow}
  - \usepackage{wrapfig}
  - \usepackage{float}
  - \usepackage{colortbl}
  - \usepackage{pdflscape}
  - \usepackage{tabu}
  - \usepackage{threeparttable}
  - \usepackage{threeparttablex}
  - \usepackage[normalem]{ulem}
  - \usepackage{makecell}
  - \usepackage{tabularray}
  - \usepackage{graphicx}
  - \UseTblrLibrary{booktabs}
  - \UseTblrLibrary{siunitx}
  - \newcommand{\tinytableTabularrayUnderline}[1]{\underline{#1}}
  - \newcommand{\tinytableTabularrayStrikeout}[1]{\sout{#1}}
  - \NewTableCommand{\tinytableDefineColor}[3]{\definecolor{#1}{#2}{#3}}
  - \usepackage{caption,fixltx2e}
  - \usepackage[table]{xcolor}
  - \floatplacement{figure}{H}
  - \raggedbottom
---

# tidytable

see Table \@ref(tab:tbl-blah)

```{r}
#| label: tbl-blah
#| tbl-cap: "Blah blah blah"

library(tinytable)

tt(mtcars[1:4, 1:4])
vincentarelbundock commented 11 hours ago

I don't know papaja. Probably not Quarto, right? It's Rmarkdown?

If the only target is LaTeX/PDF, a workaround would be to use raw latex in the caption and references.

\\label{tbl-blah}
\ref{tbl-blah}
vincentarelbundock commented 11 hours ago

And maybe this bookdown trick would help?

https://vincentarelbundock.github.io/tinytable/vignettes/notebooks.html#cross-references