Skip to content

Commit c614289

Browse files
issue #872
1 parent b76ca64 commit c614289

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Description: Create beautiful and customizable tables to summarize several
1010
RTF, JPG, or PNG. Tables can easily be embedded in 'Rmarkdown' or 'knitr'
1111
dynamic documents. Details can be found in Arel-Bundock (2022)
1212
<doi:10.18637/jss.v103.i01>.
13-
Version: 2.3.0.6
13+
Version: 2.3.0.7
1414
Authors@R: c(person("Vincent", "Arel-Bundock",
1515
email = "[email protected]",
1616
role = c("aut", "cre"),

NEWS.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Bug:
1717
* `modelplot()` accepts `linewidth` argument. Thanks to @trekonom for report #861.
1818
* Misplaced horizontal rule with `add_rows`. Thanks to @judgelord for report #875.
1919
* Fixed but in `fmt_equivalence()`. Thanks to Nicholas Astier for the report and bugfix.
20+
* Rolled back the change about centering GOF in dot-aligned columns. This created many problems with inconsistent font display. The alternative solution with `tinytable::style_tt()` is now documented in a the Themes and Styles vignette.
2021

2122
Misc:
2223

R/factory_tinytable.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ factory_tinytable <- function(tab,
9292
out <- tinytable::group_tt(out, i = hg)
9393
}
9494

95-
if ("d" %in% align && !is.null(gof_idx)) {
96-
idx <- paste(match("d", align), collapse = ",")
97-
inn <- sprintf("cell{%s-%s}{%s}={guard,halign=c},", gof_idx + 1, nrow(out) + out@nhead, idx)
98-
out <- tinytable::style_tt(out, tabularray_inner = inn)
99-
}
100-
10195
# write to file
10296
if (!is.null(output_file)) {
10397
tinytable::save_tt(out, output = output_file, overwrite = TRUE)

inst/tinytest/_tinysnapshot/mathmode-latex_ldd.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ column{3}={si={table-format=-3.3,table-align-text-before=false,table-align-text-
1010
cell{1}{3}={guard,halign=c,},
1111
column{1}={}{halign=l,},
1212
hline{8}={1,2,3}{solid, black, 0.05em},
13-
cell{8-15}{2}={guard,halign=c},
1413
} %% tabularray inner close
1514
\toprule
1615
& (1) & (2) \\ \midrule %% TinyTableHeader

vignettes/appearance.qmd

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,20 @@ modelsummary(models) |>
103103
:::
104104

105105

106-
## Starting fresh
106+
## Dot alignement in LaTeX
107+
108+
Sometimes, dot-alignment fails in LaTeX because some cells include only text. In other cases, users wish to prevent dot-alignment for specific cells. This can be achieved by using the `tinytable::style_tt()` function to insert `tabularray` instructions in to the raw LaTeX table. Here, we create a regression table for a `fixest` model. The output includes a text-only row which identifies fixed effects. We call `style_tt()` to "guard" and center the text in the relevant cells.
109+
110+
```{r}
111+
library(fixest)
112+
library(tinytable)
113+
library(modelsummary)
114+
m <- feols(mpg ~ wt + factor(cyl) | carb, data = mtcars)
115+
modelsummary(m, align = "ld") |>
116+
tinytable::style_tt(tabularray_inner = "cell{16-17}{2}={guard,halign=c}")
117+
```
118+
119+
## Removing elements (e.g. horizontal rules)
107120

108121
When `modelsummary()` creates a `tinytable`, it fixes a few styling elements immediately, which can cause minor issues when customizing the table further. For example, `modelsummary()` draws a separator line to distinguish the coefficients and goodness-of-fit statistics, but this line is drawn at a hard-coded position in the table. If users call `tinytable` functions to add rows *after the fact*, the separator line may no longer appear in the correct place.
109122

0 commit comments

Comments
 (0)