lrberge / fixest

Fixed-effects estimations
https://lrberge.github.io/fixest/
375 stars 59 forks source link

Support resizebox for etable #520

Open matthewgson opened 2 months ago

matthewgson commented 2 months ago

I would like to express my gratitude for the exceptional work you have done on this project.

Although I'm aware adjustbox is more flexible and has powerful features compared to similar resizebox, I've been somewhat more successful with resizebox when it comes to adjusting the tables in my paper. I was wondering if there's any chance this option could be added for regression tables (etable)?

waynelapierre commented 1 month ago

etable already has so many arguments. You only need to add one line of LaTeX code to make your tables fit... \resizebox{\linewidth}{!} { your table }

matthewgson commented 1 month ago

@waynelapierre It's not something you want to do if you have many tables and want to set it programmatically.

waynelapierre commented 1 month ago

@matthewgson Sure, if you need more granular control of the table layout, wouldn't it make more sense to tune LaTeX codes than to make etable even more bloated?

etiennebacher commented 1 month ago

It's not something you want to do if you have many tables and want to set it programmatically.

Sure, but you could make your own helper function that takes the output of etable() and wraps it in the resizebox call. That way, you can just add a function call after etable():

wrap_in_resizebox <- function(x) {
  paste0("\\\resizebox{\\\linewidth}{!}{\n", x, "\n}")
}

etable(..., tex = TRUE) |>
  wrap_in_resizebox() |>
  writeLines(file = "output.tex")

(I didn't try this code, but this idea should work)

matthewgson commented 1 month ago

@waynelapierre Not really. I think it is a simple change from the current flow that won't make it bloated if it ever were. etable is designed to be the finalizer of the workflow, not the pipeline I don't think it would be a design problem either. It's completely up to the maintainer's view.

@etiennebacher The resizebox should be inside the table boundary and it's pretty messier than it seems. Of course, there should be a way to augment them similar to your suggestion, but adding them similar to adjustbox would be greater.