Skip to content

Commit

Permalink
Set default font size to NA so tables inherit document font
Browse files Browse the repository at this point in the history
In LaTeX and HTML output formats, gt tables previously always set the
font size (see rstudio#1594). If the tables were being inserted into a
document (e.g., in a Quarto document), they did not inherit the font
size of the surrounding document, requiring the user to manually set the
size option for each table.

Instead, the default table.font.size is NA. Leaving it NA causes the
HTML and LaTeX outputs to emit no font size change, so the table is the
same size as the surrounding text in the document (or the browser's
default body font size). If the user manually sets the table.font.size,
it will be respected in both formats.

Fixes rstudio#1852.
  • Loading branch information
capnrefsmmat committed Jan 1, 2025
1 parent cdb22fe commit c4a7129
Show file tree
Hide file tree
Showing 18 changed files with 115 additions and 102 deletions.
2 changes: 1 addition & 1 deletion R/dt_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ dt_options_tbl <-
"table_background_color", TRUE, "table", "value", "#FFFFFF",
"table_additional_css", FALSE, "table", "values", character(0L),
"table_font_names", FALSE, "table", "values", default_fonts_vec,
"table_font_size", TRUE, "table", "px", "16px",
"table_font_size", TRUE, "table", "px", NA_character_,
"table_font_weight", TRUE, "table", "value", "normal",
"table_font_style", TRUE, "table", "value", "normal",
"table_font_color", TRUE, "table", "value", "#333333",
Expand Down
2 changes: 1 addition & 1 deletion R/render_as_i_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ render_as_ihtml <- function(data, id) {
style = list(
`font-family` = font_family_str,
#1693
fontSize = table_font_size
fontSize = if (is.na(table_font_size)) NULL else table_font_size
),
tableStyle = list(
borderTopStyle = column_labels_border_top_style,
Expand Down
5 changes: 5 additions & 0 deletions R/utils_render_grid.R
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,11 @@ parse_vjust <- function(vjust) {
# setting the font relative to the 'gt_table' font size.
parse_fontsize <- function(size, base) {

# if fontsize is not set by the user, it will be NULL here; use the base fontsize
if (is.null(size)) {
return(base)
}

new_size <- rep(base[1], length(size))

# Parse percentages relative to base
Expand Down
6 changes: 6 additions & 0 deletions R/utils_render_latex.R
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,12 @@ create_fontsize_statement_l <- function(data) {

size <- dt_options_get_value(data, "table_font_size")

# if font size is left unset, use the document's font at this point instead of
# emitting a font size change
if (is.na(size)) {
return("")
}

fs_fmt <- "\\fontsize{%3.1fpt}{%3.1fpt}\\selectfont\n"
if (grepl(pattern = "^[[:digit:]]+(\\%|in|cm|emu|em|pt|px)$", size)) {

Expand Down
4 changes: 3 additions & 1 deletion inst/css/gt_styles_default.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
margin-left: $table_margin_left; // table.margin.left
margin-right: $table_margin_right; // table.margin.right
color: font-color($table_background_color);
font-size: $table_font_size; // table.font.size
@if variable-exists("table_font_size") {
font-size: $table_font_size; // table.font.size
}
font-weight: $table_font_weight; // table.font.weight
font-style: $table_font_style; // table.font.style
background-color: $table_background_color; // table.background.color
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/_snaps/as_latex.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Code
gt_latex_styled
Output
[1] "\\begingroup\n\\fontsize{12.0pt}{14.4pt}\\selectfont\n\\setlength{\\LTpost}{0mm}\n\\begin{longtable}{l|rlcrrr}\n\\toprule\n & \\multicolumn{3}{c}{{\\itshape heading}} & & \\multicolumn{2}{c}{heading} \\\\ \n\\cmidrule(lr){2-4} \\cmidrule(lr){6-7}\n{$\\overline{\\mbox{stubhead}}$} & {NUM} & char & fctr\\textsuperscript{\\textit{1}} & time & {DATETIME} & currency \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{grp\\_a} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_1}}} & 0.1111 & apricot & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{one}} & 13:35 & {\\scriptsize 2018-01-01 02:22} & 49.95 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_2}}} & 2.2220 & {\\bfseries \\hspace{15pt}banana} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{two}} & 14:40 & {\\scriptsize 2018-02-02 14:33} & 17.95 \\\\ \n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_3}}} & 33.3300 & coconut & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{three}} & \\textsuperscript{\\textit{2}}{\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{15:45}}} & {\\scriptsize 2018-03-03 03:44} & 1.39 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_4}}} & 444.4000 & {\\bfseries \\hspace{15pt}durian} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{four}} & {\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{16:50}}} & {\\scriptsize 2018-04-04 15:55} & 65100.00 \\\\ \n\\midrule \nTotal & {\\cellcolor[HTML]{00FF00}{480.06}} & — & — & — & — & {\\cellcolor[HTML]{00FF00}{65,169.29}} \\\\ \nAvg & 120.02 & — & — & — & — & 16,292.32 \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{{\\bfseries \\cellcolor[HTML]{CCCCFF}{grp\\_b}}} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_5}}} & 5550.0000 & {\\bfseries \\hspace{15pt}NA} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{five}} & 17:55 & {\\scriptsize 2018-05-05 04:00} & 1325.81 \\\\ \n\\midrule \n\\midrule \n{\\bfseries Grand Total} & {\\cellcolor[HTML]{AAAAAA}{6,030.06}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{66,495.10}} \\\\ \n\\bottomrule\n\\end{longtable}\n\\begin{minipage}{\\linewidth}\n\\textsuperscript{\\textit{1}}{\\bfseries This is a footnote in the column labels.}\\\\\n\\textsuperscript{\\textit{2}}{\\bfseries This is a footnote. With a second line.}\\\\\n{\\itshape \\fontsize{6}{7.5}\\selectfont NOTES: A mtcars example.\\\\\n}\\end{minipage}\n\\endgroup\n"
[1] "\\begingroup\n\\setlength{\\LTpost}{0mm}\n\\begin{longtable}{l|rlcrrr}\n\\toprule\n & \\multicolumn{3}{c}{{\\itshape heading}} & & \\multicolumn{2}{c}{heading} \\\\ \n\\cmidrule(lr){2-4} \\cmidrule(lr){6-7}\n{$\\overline{\\mbox{stubhead}}$} & {NUM} & char & fctr\\textsuperscript{\\textit{1}} & time & {DATETIME} & currency \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{grp\\_a} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_1}}} & 0.1111 & apricot & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{one}} & 13:35 & {\\scriptsize 2018-01-01 02:22} & 49.95 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_2}}} & 2.2220 & {\\bfseries \\hspace{15pt}banana} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{two}} & 14:40 & {\\scriptsize 2018-02-02 14:33} & 17.95 \\\\ \n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_3}}} & 33.3300 & coconut & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{three}} & \\textsuperscript{\\textit{2}}{\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{15:45}}} & {\\scriptsize 2018-03-03 03:44} & 1.39 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_4}}} & 444.4000 & {\\bfseries \\hspace{15pt}durian} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{four}} & {\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{16:50}}} & {\\scriptsize 2018-04-04 15:55} & 65100.00 \\\\ \n\\midrule \nTotal & {\\cellcolor[HTML]{00FF00}{480.06}} & — & — & — & — & {\\cellcolor[HTML]{00FF00}{65,169.29}} \\\\ \nAvg & 120.02 & — & — & — & — & 16,292.32 \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{{\\bfseries \\cellcolor[HTML]{CCCCFF}{grp\\_b}}} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_5}}} & 5550.0000 & {\\bfseries \\hspace{15pt}NA} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{five}} & 17:55 & {\\scriptsize 2018-05-05 04:00} & 1325.81 \\\\ \n\\midrule \n\\midrule \n{\\bfseries Grand Total} & {\\cellcolor[HTML]{AAAAAA}{6,030.06}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{66,495.10}} \\\\ \n\\bottomrule\n\\end{longtable}\n\\begin{minipage}{\\linewidth}\n\\textsuperscript{\\textit{1}}{\\bfseries This is a footnote in the column labels.}\\\\\n\\textsuperscript{\\textit{2}}{\\bfseries This is a footnote. With a second line.}\\\\\n{\\itshape \\fontsize{6}{7.5}\\selectfont NOTES: A mtcars example.\\\\\n}\\end{minipage}\n\\endgroup\n"
attr(,"class")
[1] "knit_asis"
attr(,"knit_meta")
Expand Down Expand Up @@ -106,7 +106,7 @@
Code
gt_latex_styled
Output
[1] "\\begin{table}[!t]\n\\fontsize{12.0pt}{14.4pt}\\selectfont\n\\begin{tabular*}{\\linewidth}{@{\\extracolsep{\\fill}}l|rlcrrr}\n\\toprule\n & \\multicolumn{3}{c}{{\\itshape heading}} & & \\multicolumn{2}{c}{heading} \\\\ \n\\cmidrule(lr){2-4} \\cmidrule(lr){6-7}\n{$\\overline{\\mbox{stubhead}}$} & {NUM} & char & fctr\\textsuperscript{\\textit{1}} & time & {DATETIME} & currency \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{grp\\_a} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_1}}} & 0.1111 & apricot & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{one}} & 13:35 & {\\scriptsize 2018-01-01 02:22} & 49.95 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_2}}} & 2.2220 & {\\bfseries \\hspace{15pt}banana} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{two}} & 14:40 & {\\scriptsize 2018-02-02 14:33} & 17.95 \\\\ \n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_3}}} & 33.3300 & coconut & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{three}} & \\textsuperscript{\\textit{2}}{\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{15:45}}} & {\\scriptsize 2018-03-03 03:44} & 1.39 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_4}}} & 444.4000 & {\\bfseries \\hspace{15pt}durian} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{four}} & {\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{16:50}}} & {\\scriptsize 2018-04-04 15:55} & 65100.00 \\\\ \n\\midrule \nTotal & {\\cellcolor[HTML]{00FF00}{480.06}} & — & — & — & — & {\\cellcolor[HTML]{00FF00}{65,169.29}} \\\\ \nAvg & 120.02 & — & — & — & — & 16,292.32 \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{{\\bfseries \\cellcolor[HTML]{CCCCFF}{grp\\_b}}} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_5}}} & 5550.0000 & {\\bfseries \\hspace{15pt}NA} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{five}} & 17:55 & {\\scriptsize 2018-05-05 04:00} & 1325.81 \\\\ \n\\midrule \n\\midrule \n{\\bfseries Grand Total} & {\\cellcolor[HTML]{AAAAAA}{6,030.06}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{66,495.10}} \\\\ \n\\bottomrule\n\\end{tabular*}\n\\begin{minipage}{\\linewidth}\n\\textsuperscript{\\textit{1}}{\\bfseries This is a footnote in the column labels.}\\\\\n\\textsuperscript{\\textit{2}}{\\bfseries This is a footnote. With a second line.}\\\\\n{\\itshape \\fontsize{6}{7.5}\\selectfont NOTES: A mtcars example.\\\\\n}\\end{minipage}\n\\end{table}\n"
[1] "\\begin{table}[!t]\n\\begin{tabular*}{\\linewidth}{@{\\extracolsep{\\fill}}l|rlcrrr}\n\\toprule\n & \\multicolumn{3}{c}{{\\itshape heading}} & & \\multicolumn{2}{c}{heading} \\\\ \n\\cmidrule(lr){2-4} \\cmidrule(lr){6-7}\n{$\\overline{\\mbox{stubhead}}$} & {NUM} & char & fctr\\textsuperscript{\\textit{1}} & time & {DATETIME} & currency \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{grp\\_a} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_1}}} & 0.1111 & apricot & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{one}} & 13:35 & {\\scriptsize 2018-01-01 02:22} & 49.95 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_2}}} & 2.2220 & {\\bfseries \\hspace{15pt}banana} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{two}} & 14:40 & {\\scriptsize 2018-02-02 14:33} & 17.95 \\\\ \n{\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_3}}} & 33.3300 & coconut & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{three}} & \\textsuperscript{\\textit{2}}{\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{15:45}}} & {\\scriptsize 2018-03-03 03:44} & 1.39 \\\\ \n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_4}}} & 444.4000 & {\\bfseries \\hspace{15pt}durian} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{four}} & {\\fontsize{15}{18.75}\\selectfont \\underline{\\textcolor[HTML]{FF0000}{16:50}}} & {\\scriptsize 2018-04-04 15:55} & 65100.00 \\\\ \n\\midrule \nTotal & {\\cellcolor[HTML]{00FF00}{480.06}} & — & — & — & — & {\\cellcolor[HTML]{00FF00}{65,169.29}} \\\\ \nAvg & 120.02 & — & — & — & — & 16,292.32 \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{7}{l}{{\\bfseries \\cellcolor[HTML]{CCCCFF}{grp\\_b}}} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\n{\\slshape \\hspace{11.25pt}\\cellcolor[HTML]{AA0000}{\\textcolor[HTML]{FFFFFF}{\\hspace*{3.75pt} row\\_5}}} & 5550.0000 & {\\bfseries \\hspace{15pt}NA} & {\\fontsize{15}{18.75}\\selectfont \\textcolor[HTML]{0000FF}{five}} & 17:55 & {\\scriptsize 2018-05-05 04:00} & 1325.81 \\\\ \n\\midrule \n\\midrule \n{\\bfseries Grand Total} & {\\cellcolor[HTML]{AAAAAA}{6,030.06}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{—}} & {\\cellcolor[HTML]{AAAAAA}{66,495.10}} \\\\ \n\\bottomrule\n\\end{tabular*}\n\\begin{minipage}{\\linewidth}\n\\textsuperscript{\\textit{1}}{\\bfseries This is a footnote in the column labels.}\\\\\n\\textsuperscript{\\textit{2}}{\\bfseries This is a footnote. With a second line.}\\\\\n{\\itshape \\fontsize{6}{7.5}\\selectfont NOTES: A mtcars example.\\\\\n}\\end{minipage}\n\\end{table}\n"
attr(,"class")
[1] "knit_asis"
attr(,"knit_meta")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/cols_width.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Code
as_latex(gt_tbl)
Output
[1] "\\begin{table}[!t]\n\\fontsize{12.0pt}{14.4pt}\\selectfont\n\\begin{tabular*}{\\linewidth}{@{\\extracolsep{\\fill}}>{\\raggedright\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}|>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}\n\\toprule\n & & \\multicolumn{2}{>{\\centering\\arraybackslash}m{\\dimexpr 114.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}{Another long spanner that needs to wrap even more than the other} & & \\\\ \n\\cmidrule(lr){3-4}\n & \\multicolumn{2}{>{\\centering\\arraybackslash}m{\\dimexpr 114.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}{Spanner with a long title that should be wrapped} & & \\multicolumn{2}{>{\\centering\\arraybackslash}m{\\dimexpr 114.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}{Spanner2} \\\\ \n\\cmidrule(lr){2-3} \\cmidrule(lr){5-6}\n & y & z & m & n & w \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{6}{>{\\raggedright\\arraybackslash}m{342pt}}{Only row group label} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\na & 0.114 & 0.640 & 0.694 & 0.837 & 0.317 \\\\ \nb & 0.622 & 0.009 & 0.545 & 0.286 & 0.303 \\\\ \n\\midrule \nmean & 0.3680014 & 0.3249032 & 0.6192831 & 0.5617595 & 0.3096529 \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{6}{>{\\raggedright\\arraybackslash}m{342pt}}{\\rule{0pt}{0pt}} \\\\[-3.2ex] \n\\midrule\\addlinespace[2.5pt]\nc & 0.609 & 0.233 & 0.283 & 0.267 & 0.159 \\\\ \nd & 0.623 & 0.666 & 0.923 & 0.187 & 0.040 \\\\ \ne & 0.861 & 0.514 & 0.292 & 0.232 & 0.219 \\\\ \n\\bottomrule\n\\end{tabular*}\n\\end{table}\n"
[1] "\\begin{table}[!t]\n\\begin{tabular*}{\\linewidth}{@{\\extracolsep{\\fill}}>{\\raggedright\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}|>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}>{\\raggedleft\\arraybackslash}p{\\dimexpr 57.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}\n\\toprule\n & & \\multicolumn{2}{>{\\centering\\arraybackslash}m{\\dimexpr 114.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}{Another long spanner that needs to wrap even more than the other} & & \\\\ \n\\cmidrule(lr){3-4}\n & \\multicolumn{2}{>{\\centering\\arraybackslash}m{\\dimexpr 114.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}{Spanner with a long title that should be wrapped} & & \\multicolumn{2}{>{\\centering\\arraybackslash}m{\\dimexpr 114.00pt -2\\tabcolsep-1.5\\arrayrulewidth}}{Spanner2} \\\\ \n\\cmidrule(lr){2-3} \\cmidrule(lr){5-6}\n & y & z & m & n & w \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{6}{>{\\raggedright\\arraybackslash}m{342pt}}{Only row group label} \\\\[2.5pt] \n\\midrule\\addlinespace[2.5pt]\na & 0.114 & 0.640 & 0.694 & 0.837 & 0.317 \\\\ \nb & 0.622 & 0.009 & 0.545 & 0.286 & 0.303 \\\\ \n\\midrule \nmean & 0.3680014 & 0.3249032 & 0.6192831 & 0.5617595 & 0.3096529 \\\\ \n\\midrule\\addlinespace[2.5pt]\n\\multicolumn{6}{>{\\raggedright\\arraybackslash}m{342pt}}{\\rule{0pt}{0pt}} \\\\[-3.2ex] \n\\midrule\\addlinespace[2.5pt]\nc & 0.609 & 0.233 & 0.283 & 0.267 & 0.159 \\\\ \nd & 0.623 & 0.666 & 0.923 & 0.187 & 0.040 \\\\ \ne & 0.861 & 0.514 & 0.292 & 0.232 & 0.219 \\\\ \n\\bottomrule\n\\end{tabular*}\n\\end{table}\n"
attr(,"class")
[1] "knit_asis"
attr(,"knit_meta")
Expand Down
Loading

0 comments on commit c4a7129

Please sign in to comment.