name: insert-tables description: After Stata/R generates .tex tables, insert \input commands into the correct Overleaf sections disable-model-invocation: true argument-hint: "[table file name or 'scan' to find new unlinked tables]" allowed-tools: ["Read", "Grep", "Glob", "Write", "Edit", "Task"]
Insert Tables
After a Stata or R script generates .tex table files in the Overleaf project, this skill:
- Identifies where the
\input{}command should go - Inserts it in the correct section file
- Verifies the table file exists and is well-formed
Input: $ARGUMENTS — table filename (e.g., table5_new.tex) or "scan" to find all unlinked tables.
Overleaf Table Architecture
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
Insertion Points
| 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{} |
For Paper (main.tex)
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}
For Slides (presentation.tex)
Tables need scaling for Beamer frames:
\begin{frame}[plain]\frametitle{Table Title}
\scalebox{0.8}{
\input{files/tab/{{subfolder}}/table_new.tex}
}
\end{frame}
"Scan" Mode
When called with "scan":
- List all
.texfiles infiles/tab/subdirectories - Grep
7-figuresAndTables.tex,8-appendix.tex, andpresentation.texfor\input{files/tab/ - Report any
.textable files that exist but are NOT referenced anywhere - Suggest where each unlinked table should be inserted
Steps
- Verify table file exists at the expected path
- Read the table file — check for
\begin{table},\caption{},\label{tab:...} - Determine insertion point based on table type (main/appendix/slides)
- Read the target section file
- Insert
\input{}command at the appropriate location with a comment - If results section reference needed: add
Table \ref{tab:label}in the narrative - Verify no duplicate
\input{}for the same file
Quality Checks
- Table file has matching
\begin{table}/\end{table} -
\label{tab:...}is present and unique -
\input{}path is correct relative to main.tex - No duplicate insertions
- For slides:
\scalebox{}wrapping present