-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
notes
arguments accepts lists with i,j arguments to add markers in …
…cells to refer to specific footnotes
- Loading branch information
1 parent
77eac47
commit f3d857c
Showing
9 changed files
with
144 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
footnote_markers <- function(x) { | ||
notes <- meta(x, "notes") | ||
for (idx in seq_along(notes)) { | ||
n <- notes[[idx]] | ||
sup <- names(notes)[idx] | ||
if (is.list(n)) { | ||
if (meta(x)$output == "latex") { | ||
x[n$i, n$j] <- paste0(x[n$i, n$j], "\\textsuperscript{", sup, "}") | ||
if (0 %in% n$i) colnames(x)[n$j] <- paste0(colnames(x)[n$j], "\\textsuperscript{", sup, "}") | ||
} else if (meta(x)$output == "html") { | ||
x[n$i, n$j] <- paste0(x[n$i, n$j], "<sup>", sup, "</sup>") | ||
if (0 %in% n$i) colnames(x)[n$j] <- paste0(colnames(x)[n$j], "<sup>", sup, "</sup>") | ||
} else if (meta(x)$output == "typst") { | ||
x[n$i, n$j] <- paste0(x[n$i, n$j], "#super[", sup, "]") | ||
if (0 %in% n$i) colnames(x)[n$j] <- paste0(colnames(x)[n$j], "#super[", sup, "]") | ||
} else { | ||
x[n$i, n$j] <- paste0(x[n$i, n$j], "^", sup, "^") | ||
if (0 %in% n$i) colnames(x)[n$j] <- paste0(colnames(x)[n$j], "^", sup, "^") | ||
} | ||
} | ||
} | ||
return(x) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
\begin{table} | ||
\centering | ||
\begin{talltblr}[ %% tabularray outer open | ||
entry=none,label=none, | ||
note{}={Blah blah}, | ||
note{*}={foo bar}, | ||
] %% tabularray outer close | ||
{ %% tabularray inner open | ||
colspec={Q[]Q[]Q[]}, | ||
} %% tabularray inner close | ||
\toprule | ||
mpg & cyl\textsuperscript{*} & disp \\ \midrule %% TinyTableHeader | ||
21.0 & 6\textsuperscript{*} & 160 \\ | ||
21.0 & 6 & 160 \\ | ||
22.8 & 4 & 108 \\ | ||
\bottomrule | ||
\end{talltblr} | ||
\end{table} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
source("helpers.R") | ||
using("tinysnapshot") | ||
|
||
|
||
# latex table with cell marker table | ||
options(tinytable_print_output = "latex") | ||
x <- mtcars[1:3, 1:3] | ||
n <- list("Blah blah", "*" = list(i = 0:1, j = 2, text = "foo bar")) | ||
tab <- tt(x, notes = n) | ||
expect_snapshot_print(tab, label = "notes-latex_cell_markers") | ||
options(tinytable_print_output = NULL) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.