问题:
回归表需要缩小以包含在Beamer幻灯片中,但不能在没有复制和粘贴原始TeX的情况下在RMarkdown中缩小它们。有没有更简单的方法来实现这一点,以便我可以自动完成工作流程的这一部分?
背景
我的回归自动生成回归表的.tex文件。但是,当我尝试将文件输入我的Beamer幻灯片(在Rmarkdown中创建)时,它们太大了,我必须手动复制,粘贴和调整它们以使它们适合。以下是MWE
table.tex
\begin{table}[!htbp] \centering
\caption{Title}
\begin{tabular}{lcccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{6}{c}{Dependent Var} \\
\hline \\[-1.8ex]
Independent Var & $-$0.031 & 0.012 & $-$0.264 & $-$0.267 & $-$0.107 & $-$1.980 \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{6}{l}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
RMarkdown.Rmd
---
title: "Title"
output:
beamer_presentation:
slide_level: 3
keep_tex: false
---
### Test Results
\input{table.tex}
解决方法
复制/粘贴.tex表并在\resizebox{}{}
\begin{tabular}...\end{tabular}
Workaround.Rmd
---
title: "Title"
output:
beamer_presentation:
slide_level: 3
keep_tex: false
---
### Test Results
\begin{table}[!htbp] \centering
\caption{Title}
\resizebox{0.98\textwidth}{!}{
\begin{tabular}{lcccccc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{6}{c}{Dependent Var} \\
\hline \\[-1.8ex]
Independent Var & $-$0.031 & 0.012 & $-$0.264 & $-$0.267 & $-$0.107 & $-$1.980 \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{6}{l}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
}
\end{table}