# Publication Output Conventions

> Table format, figure format, and output routing standards for publication-ready outputs.
> Referenced by `/data-analysis`, `/replication-package`.

## Table Format: Booktabs Three-Line

All LaTeX tables use the `booktabs` three-line style unless a venue explicitly requires something else.

### Standard Structure

```latex
\begin{table}[htbp]
\centering
\caption{Descriptive title stating the finding}
\label{tab:descriptive-label}
\begin{tabular}{lcccc}
\toprule
                & (1)        & (2)        & (3)        & (4)        \\
                & OLS        & FE         & IV         & IV-FE      \\
\midrule
Treatment       & 0.123***   & 0.098**    & 0.145**    & 0.112*     \\
                & (0.034)    & (0.041)    & (0.058)    & (0.063)    \\
Control A       & 0.456      & 0.423      & 0.478      & 0.445      \\
                & (0.089)    & (0.092)    & (0.095)    & (0.098)    \\
\midrule
Observations    & 1,247      & 1,247      & 1,189      & 1,189      \\
R$^2$           & 0.234      & 0.312      & 0.198      & 0.289      \\
Controls        & Yes        & Yes        & Yes        & Yes        \\
Fixed Effects   & No         & Yes        & No         & Yes        \\
\bottomrule
\end{tabular}
\begin{tablenotes}[flushleft]
\footnotesize
\item \textit{Notes:} Standard errors in parentheses, clustered at the firm level.
* $p<0.10$, ** $p<0.05$, *** $p<0.01$.
\end{tablenotes}
\end{table}
```

### Rules

1. **Three lines only:** `\toprule`, `\midrule`, `\bottomrule`. No `\hline`, no vertical lines.
2. **Standard errors in parentheses** below coefficients. Never brackets.
3. **Star convention:** `* p<0.10, ** p<0.05, *** p<0.01` (state in table notes).
4. **Column headers:** Model number in row 1, specification name in row 2.
5. **Panel labels:** Use `\multicolumn` with `Panel A:`, `Panel B:` for multi-panel tables.
6. **Footnotes:** Use `tablenotes` environment or `\smallskip\footnotesize` block below the table.
7. **Alignment:** `l` for row labels, `c` for numeric columns. Use `S` (siunitx) for decimal alignment if available.
8. **Number formatting:** Thousands separator (1,247 not 1247). 3 decimal places for coefficients, 2 for R².

## Figure Format

### Export Standards

| Format | Use case |
|--------|----------|
| PDF | Default for all figures (vector, lossless) |
| PNG | Raster plots, heatmaps (300+ DPI) |
| SVG | Web/HTML output only |

### Dimensions

- **Single column:** 6 × 4 inches (width × height)
- **Full width:** 10 × 6 inches
- **Square (scatter/correlation):** 6 × 6 inches
- **Panel figures:** Scale width proportionally; maintain consistent height across panels

### Style

- Greyscale-safe colour palettes (figures should be readable in B&W print)
- Minimal gridlines (light grey, major ticks only)
- Axis labels with units: "Revenue (USD millions)"
- Legend inside plot area when space allows; outside otherwise
- Title in the LaTeX `\caption{}`, not baked into the figure image

### LaTeX Inclusion

```latex
\begin{figure}[htbp]
\centering
\includegraphics[width=\textwidth]{figures/fig1.pdf}
\caption{Descriptive title stating what the figure shows}
\label{fig:descriptive-label}
\end{figure}
```

## Output Routing

### Directory Structure

```
project/
├── code/              ← scripts that generate output
├── data/
│   ├── raw/           ← READ-ONLY source data
│   ├── processed/     ← cleaned/transformed data
│   └── synthetic/     ← generated test data
├── output/            ← intermediate results (not for paper)
│   ├── tables/        ← .csv, .rds, .pkl intermediate tables
│   └── figures/       ← exploratory/draft figures
└── paper/             ← Overleaf-synced, LaTeX only
    ├── tables/        ← .tex table files (generated by code)
    └── figures/       ← .pdf/.png figure files (generated by code)
```

### Routing Rules

1. **Scripts** live in `code/` or `src/`, never in `paper/`.
2. **Publication tables** (`.tex`) go directly to `paper/tables/`. Generated by code, referenced via `\input{tables/table1.tex}`.
3. **Publication figures** (`.pdf`/`.png`) go directly to `paper/figures/`. Generated by code, referenced via `\includegraphics{figures/fig1.pdf}`.
4. **Intermediate outputs** (exploratory plots, draft tables, `.csv` summaries) go to `output/`. These are not committed to the paper directory.
5. **Never hard-code results** in `.tex` files. All numbers come from `\input{}` or generated files.

### Naming Conventions

| File type | Pattern | Example |
|-----------|---------|---------|
| Main results table | `table{N}.tex` | `table1.tex` |
| Named table | `tab-{name}.tex` | `tab-descriptives.tex` |
| Appendix table | `tableA{N}.tex` | `tableA1.tex` |
| Main figure | `fig{N}.pdf` | `fig1.pdf` |
| Named figure | `fig-{name}.pdf` | `fig-event-study.pdf` |
| Appendix figure | `figA{N}.pdf` | `figA1.pdf` |

### Inline Statistics

For inline numbers (sample sizes, test statistics, p-values), export a `.tex` file with `\newcommand` definitions:

```latex
% Generated by code/analysis.R — do not edit manually
\newcommand{\Nobs}{1,247}
\newcommand{\maineffect}{0.123}
\newcommand{\mainse}{0.034}
\newcommand{\mainpval}{0.001}
```

Include in the paper preamble with `\input{tables/inline-stats.tex}` and reference as `$N = \Nobs$`.
