Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default value for latex.tbl.pos #1940

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/dt_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -272,5 +272,5 @@ dt_options_tbl <-
"quarto_disable_processing", FALSE, "quarto", "logical", FALSE,
"quarto_use_bootstrap", FALSE, "quarto", "logical", FALSE,
"latex_use_longtable", FALSE, "latex", "logical", FALSE,
"latex_tbl_pos", FALSE, "latex", "value", "!t",
"latex_tbl_pos", FALSE, "latex", "value", "t",
)[-1, ]
9 changes: 5 additions & 4 deletions R/tab_options.R
Original file line number Diff line number Diff line change
Expand Up @@ -538,10 +538,11 @@
#'
#' *Specify latex floating position*
#'
#' The latex position indicator for a floating environment (e.g., `"!t"`,
#' `"H"`). It should be specified without square brackets. Quarto users should
#' instead set the floating position within the code chunk argument `tbl-pos`.
#' The output table will only float if `latex.use_longtable = FALSE`.
#' The latex position indicator for a floating environment (e.g., `"tb"`,
#' `"h"`). If not specified, latex position will default to "t". It should be
#' specified without square brackets. Quarto users should instead set the
#' floating position within the code chunk argument `tbl-pos`. The output
#' table will only float if `latex.use_longtable = FALSE`.
#'
#' @return An object of class `gt_tbl`.
#'
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/as_latex.md
Original file line number Diff line number Diff line change
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\\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"
attr(,"class")
[1] "knit_asis"
attr(,"knit_meta")
Expand Down
Loading