After Stata/R generates .tex tables, insert \input commands into the correct Overleaf sections
After a Stata or R script generates .tex table files in the Overleaf project, this skill:
\input{} command should goInput: $ARGUMENTS — table filename (e.g., table5_new.tex) or "scan" to find all unlinked tables.
Tables live in: $OL/files/tab/
files/tab/
├── {{your_subfolder}}/ ← Main tables from your table do-file
│ ├── table1.tex
│ ├── table2.tex
│ └── ...
└── {{archive_subfolder}}/ ← Older/archived tables
| Table Type | Insert In | Section |
|---|---|---|
| Main tables (1-4) |
Sections/7-figuresAndTables.tex |
| After existing tables |
| Appendix tables (A.1+) | Sections/8-appendix.tex | After existing appendix tables |
| In-text reference | Sections/5-results.tex | Where results are discussed |
| Presentation tables | presentation.tex | In relevant \section{} |
Tables from esttab are COMPLETE — they include \begin{table}...\end{table} with caption and label. Do NOT wrap in another table environment.
% In 7-figuresAndTables.tex:
\input{files/tab/{{subfolder}}/table_new.tex}
% For wide tables (6+ columns):
\begin{landscape}
\input{files/tab/{{subfolder}}/table_wide.tex}
\end{landscape}
Tables need scaling for Beamer frames:
\begin{frame}[plain]\frametitle{Table Title}
\scalebox{0.8}{
\input{files/tab/{{subfolder}}/table_new.tex}
}
\end{frame}
When called with "scan":
.tex files in files/tab/ subdirectories7-figuresAndTables.tex, 8-appendix.tex, and presentation.tex for \input{files/tab/.tex table files that exist but are NOT referenced anywhere\begin{table}, \caption{}, \label{tab:...}\input{} command at the appropriate location with a commentTable \ref{tab:label} in the narrative\input{} for the same file\begin{table} / \end{table}\label{tab:...} is present and unique\input{} path is correct relative to main.tex\scalebox{} wrapping present