Stata esttab 输出到 Latex:更改字体大小
Stata esttab output to Latex : changing font size
有时您必须使用从 Stata 导出到 Latex 非常长或非常大的回归 tables,以至于它不适合单个页面。这通常发生在初步分析中,即您保留最大的控制变量并并排测试各种模型。一种解决方案是通过添加 \footnotesize 或 \tiny[ 在 Latex 输出 ResultsTable.tex 文件中手动修改字体=23=] 在 \caption:
之后
\begin{table}[htbp]\centering
\caption{Main Results} \footnotesize
\begin{tabular}{l*{3}{c}}
但是每次对 table 进行修改时都必须重复此操作。
使用esttab包将Latex的字号直接修改成STATA的方法是什么?
esttab m1 m2 m3 m4 m5 m6 m7 m8 using "ResultsTable.tex", replace booktabs compress
感谢您对此的任何建议!
虽然 help esttab
总是有用的,但大多数棘手的 esttab
-to-Latex 问题的解决方案都依赖于 esttab
是 estout
的包装这一事实, 并且很容易用 estout
的 prehead
选项解决...esttab
.
下没有记录
这里有一个快速 MWE 可以大致了解您问题中的信息:
sysuse auto
reg price mpg
estimates store m1
reg price mpg rep78
estimates store m2
reg price mpg rep78 headroom
estimates store m3
esttab m1 m2 m3 ///
using "out1.tex", ///
replace booktabs compress ///
title("Main Results")
这会生成一个 .tex
文件,其中包含 table 以及以下内容 header:
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Main Results}
\begin{tabular}{l*{3}{c}}
\toprule
要添加 \footnotesize
,您需要将完整的 header 从 \begin{table}
传递到 \toprule
(因为您使用的是 booktabs
) prehead()
选项如下:
esttab m1 m2 m3 ///
using "out2.tex", ///
replace booktabs compress ///
prehead(`"\begin{table}[htbp]\centering"' `"\footnotesize"' ///
`"\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}"' ///
`"\caption{Main Results}"' ///
`"\begin{tabular}{l*{@M}{c}}"' ///
`"\toprule"' ) //
请注意,.tex
输出中的每一行都用 back-tick 和撇号括起来,并且 \begin{tabular}{l*{@M}{c}}
语句引用 @M
而不是明确说明数字的列。
这会生成一个 .tex
文件,其中包含 table 以及以下内容 header:
\begin{table}[htbp]\centering
\footnotesize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Main Results}
\begin{tabular}{l*{3}{c}}
\toprule
有时您必须使用从 Stata 导出到 Latex 非常长或非常大的回归 tables,以至于它不适合单个页面。这通常发生在初步分析中,即您保留最大的控制变量并并排测试各种模型。一种解决方案是通过添加 \footnotesize 或 \tiny[ 在 Latex 输出 ResultsTable.tex 文件中手动修改字体=23=] 在 \caption:
之后\begin{table}[htbp]\centering
\caption{Main Results} \footnotesize
\begin{tabular}{l*{3}{c}}
但是每次对 table 进行修改时都必须重复此操作。
使用esttab包将Latex的字号直接修改成STATA的方法是什么?
esttab m1 m2 m3 m4 m5 m6 m7 m8 using "ResultsTable.tex", replace booktabs compress
感谢您对此的任何建议!
虽然 help esttab
总是有用的,但大多数棘手的 esttab
-to-Latex 问题的解决方案都依赖于 esttab
是 estout
的包装这一事实, 并且很容易用 estout
的 prehead
选项解决...esttab
.
这里有一个快速 MWE 可以大致了解您问题中的信息:
sysuse auto
reg price mpg
estimates store m1
reg price mpg rep78
estimates store m2
reg price mpg rep78 headroom
estimates store m3
esttab m1 m2 m3 ///
using "out1.tex", ///
replace booktabs compress ///
title("Main Results")
这会生成一个 .tex
文件,其中包含 table 以及以下内容 header:
\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Main Results}
\begin{tabular}{l*{3}{c}}
\toprule
要添加 \footnotesize
,您需要将完整的 header 从 \begin{table}
传递到 \toprule
(因为您使用的是 booktabs
) prehead()
选项如下:
esttab m1 m2 m3 ///
using "out2.tex", ///
replace booktabs compress ///
prehead(`"\begin{table}[htbp]\centering"' `"\footnotesize"' ///
`"\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}"' ///
`"\caption{Main Results}"' ///
`"\begin{tabular}{l*{@M}{c}}"' ///
`"\toprule"' ) //
请注意,.tex
输出中的每一行都用 back-tick 和撇号括起来,并且 \begin{tabular}{l*{@M}{c}}
语句引用 @M
而不是明确说明数字的列。
这会生成一个 .tex
文件,其中包含 table 以及以下内容 header:
\begin{table}[htbp]\centering
\footnotesize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Main Results}
\begin{tabular}{l*{3}{c}}
\toprule