I have hundreds of latex tables I generated using Stargazer. Almost all of these tables can be rectified by wrapping tabular as such \resizebox{\textwidth}{!}{ \begin{tabular} ... \end{tabular}}. I have already attempted to make adjustments using the stargazer function.
However, going back to latex, I thought that I would be able to simply use the etoolbox package and apply \BeforeBeginEnvironment{tabular}{\resizebox{\textwidth}{!}{} \AfterEndEnvironment{tabular}{}}. My hopes would be that every time \begin and \end tabular shows up in my code, it is autcomatically wrapped accordingly. However, it did not work. I suspect it is because latex interprets the {, and } quite literally. Any suggestions? I do not want to have to modify each individual table manually as I find myself having to regenerate tables quite often.

\resizeboxwill also scale tables up to fit\textwidth. Is that what you want, or only to scale down to fit\textwidth? – Werner Feb 22 '24 at 20:47adjustboxpackage, but please note that the result will most likely look like a ransom letter with all the different font sizes. See also https://tex.stackexchange.com/questions/425453/why-not-scale-elements-that-contain-text for some more reasons why scaling tables might not be the best of ideas. – samcarter_is_at_topanswers.xyz Feb 22 '24 at 21:03