\documentclass[12pt,a4paper]{article}

% ==========================
% Language, encoding, layout
% ==========================
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage{microtype}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{setspace}
\onehalfspacing
\usepackage{parskip} % no paragraph indent; vertical space between paragraphs

% ==========================
% Fonts (LuaLaTeX / XeLaTeX)
% ==========================
\usepackage{fontspec}
\usepackage{unicode-math} % load AFTER fontspec
\setmainfont[Ligatures=TeX]{Libertinus Serif}
\setsansfont{Libertinus Sans}
\setmonofont[Scale=MatchLowercase]{JetBrains Mono}
\setmathfont{Libertinus Math}

% ==========================
% Graphics, floats, captions
% ==========================
\usepackage{graphicx}
\graphicspath{{figures/}} % put your images in ./figures
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage[flushleft]{threeparttable}
\usepackage{subcaption}
\usepackage{caption}
\captionsetup{labelfont=bf, font=small}
\captionsetup[table]{skip=6pt}
\usepackage{adjustbox}
\usepackage{multirow}
\usepackage{float}
\usepackage{placeins} % \FloatBarrier
\usepackage{pdflscape}
\usepackage{mwe} % example images so the demo compiles

% ==========================
% Colors & links
% ==========================
\usepackage[dvipsnames]{xcolor}
\definecolor{Brand}{HTML}{1F77B4}
\definecolor{Link}{HTML}{1155CC}
\definecolor{Cite}{HTML}{006400}
\usepackage[hyperfootnotes=false]{hyperref}
\hypersetup{
  colorlinks=true,
  linkcolor=Link,
  citecolor=Cite,
  urlcolor=Link,
  pdfauthor={Your Name},
  pdftitle={Research Paper Template with LaTeX Demos}
}
\usepackage[capitalise,nameinlink,noabbrev]{cleveref} % after hyperref

% ==========================
% Numbers & units
% ==========================
\usepackage{siunitx}
\sisetup{
  detect-all,
  table-number-alignment = center,
  input-decimal-markers = .,
  group-minimum-digits = 4
}

% ==========================
% Math & theorems
% ==========================
\usepackage{mathtools} % loads amsmath
\numberwithin{equation}{section}
\usepackage{amsthm}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\theoremstyle{plain}
\newtheorem{assumption}[definition]{Assumption}

% ==========================
% Line numbers (optional)
% ==========================
\usepackage[switch]{lineno}
% \linenumbers

% ==========================
% TikZ / PGFPlots (optional)
% ==========================
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}

% ==========================
% Code listings (simple)
% ==========================
\usepackage{listings}
\lstset{
  basicstyle=\ttfamily\small,
  columns=fullflexible,
  frame=single,
  framerule=.2pt,
  breaklines=true,
  tabsize=2,
  showstringspaces=false,
  keywordstyle=\color{RoyalBlue},
  commentstyle=\color{ForestGreen},
  stringstyle=\color{BrickRed},
  captionpos=b
}

% ==========================
% Bibliography (biblatex+biber)
% ==========================
\usepackage[
  backend=biber,
  style=authoryear-comp,
  giveninits=true,
  uniquename=init,
  maxbibnames=7, minbibnames=3,
  maxcitenames=2,
  date=year,
  doi=true, url=false, isbn=false,
  dashed=false,
  natbib=true
]{biblatex}
\addbibresource{paper_coop.bib} % <-- replace with your .bib file
\DeclareFieldFormat{doi}{\href{https://doi.org/\strfield{doi}}{\texttt{doi:\strfield{doi}}}}
\renewbibmacro*{doi+eprint+url}{%
  \printfield{doi}%
  \newunit\newblock
  \iffieldundef{doi}{\printfield{url}}{}%
}
\setlength\bibhang{1.6em}
\setlength\bibitemsep{0.3\baselineskip}
\appto{\bibsetup}{\raggedright\setlength{\emergencystretch}{3em}}

% ==========================
% Title & authors
% ==========================
\usepackage{authblk}
\title{A Research Paper Template (with LaTeX Examples)}
\author[]{Your Name\thanks{\footnotesize Funding and affiliations here.}}
\date{\today}

\begin{document}
\maketitle

\begin{abstract}
% Keep to ~150--200 words: motivation, question, method, main results (with numbers), contribution, implications.
This template follows a standard research paper structure while demonstrating basic \LaTeX{} features (lists, math, figures, tables, citations, and code).
\end{abstract}

\noindent\textbf{Keywords:} LaTeX, research paper, template \quad
\textbf{JEL:} A20

% ==========================
\section{Introduction}\label{sec:intro}
% What is the question? Why does it matter? What do you do? Main quantitative results. Contribution and roadmap.
This paragraph shows simple text styling: \emph{emphasis}, \textbf{bold}, \texttt{monospace}, and a footnote.\footnote{Footnotes are easy—use them sparingly.}
We will refer to \cref{sec:lit}, \cref{sec:data}, and \cref{fig:single} later.

\begin{itemize} % -- demo list in the Intro
  \item Bullet lists with \verb|\item|.
  \item Numbered lists use \texttt{enumerate}; description lists use \texttt{description}.
\end{itemize}

% ==========================
\section{Related Literature}\label{sec:lit}
Cite with \texttt{biblatex}: narrative \textcite{knuth1990}, or parenthetical \parencite{lamport1994}.
Add entries to your \texttt{.bib} file and run \texttt{biber}. Use \cref{sec:empirical} for the model.

% ==========================
\section{Data and Experimental Design}\label{sec:data}
% Describe data, sources, variables, sample, identification variation (if design-based).
Table~\ref{tab:desc} shows a small data snapshot with aligned numbers.

\begin{table}[H]
\centering
\begin{threeparttable}
\caption{Descriptive Statistics}\label{tab:desc}
\begin{tabular}{L{4cm} S[table-format=2.2] S[table-format=3.0]}
\toprule
Variable & {Mean} & {N} \\
\midrule
Outcome A & 12.34 & 120 \\
Outcome B &  9.10 &  85 \\
Outcome C &  3.14 &  42 \\
\bottomrule
\end{tabular}
\begin{tablenotes}\footnotesize
\item Notes: numbers aligned with \texttt{siunitx}; replace with your variables.
\end{tablenotes}
\end{threeparttable}
\end{table}

% ==========================
\section{Empirical Strategy / Methodology}\label{sec:empirical}
% Model, identification, estimating equations, assumptions.
Inline math $a^2+b^2=c^2$, display:
\[
  \int_0^1 x^2\,dx = \frac{1}{3}.
\]
Main estimating equation:
\begin{equation}\label{eq:ols}
  y_{it} = \beta X_{it} + \gamma_i + \delta_t + \varepsilon_{it}.
\end{equation}
Aligned system:
\begin{align}
\beta &= (X^\top X)^{-1}X^\top y, &
\mathrm{Var}(\hat\beta) &= \sigma^2 (X^\top X)^{-1}.
\end{align}

\begin{assumption}[Exogeneity]
$\mathbb{E}[\varepsilon_{it}\mid X_{it},\gamma_i,\delta_t]=0$.
\end{assumption}

% ==========================
\section{Results}\label{sec:results}
% Present main figures/tables; interpret magnitudes.
A single figure (\cref{fig:single}) and a tiny plot (\cref{fig:pgf}).

\begin{figure}[H]
  \centering
  \includegraphics[width=.6\linewidth]{example-image-a}
  \caption{A placeholder figure.}\label{fig:single}
\end{figure}

\begin{figure}[H]
  \centering
  \begin{tikzpicture}
    \begin{axis}[width=.8\linewidth, xlabel={$x$}, ylabel={$y$}]
      \addplot+[mark=*] table[row sep=\\] {
        x y\\ 0 0\\ 1 1\\ 2 4\\ 3 9\\
      };
    \end{axis}
  \end{tikzpicture}
  \caption{A tiny $y=x^2$ PGFPlots chart.}\label{fig:pgf}
\end{figure}

% Simple code listing (e.g., replication snippet)
\begin{lstlisting}[language=Python, caption={Example code listing}]
def squares(n):
    return [i*i for i in range(n)]
print(squares(5))
\end{lstlisting}

% ==========================
\section{Robustness and Sensitivity}\label{sec:robust}
% Alternative specs, sub-samples, placebo tests, bandwidths, functional forms.
We test alternative specifications and sub-samples; see Appendix~\ref{app:extra} for details.

% ==========================
\section{Discussion and Policy Implications}\label{sec:discussion}
% Mechanisms, external validity, limits, interpretation.
Discuss mechanisms and external validity; relate magnitudes to prior work in \cref{sec:lit}.

% ==========================
\section{Conclusion}\label{sec:conclusion}
% Summarize contributions, limitations, and future work.
We summarize findings and outline future research directions.

\FloatBarrier
% Optional: lists of figures/tables
% \section*{Tables and Figures}
% \listoffigures
% \listoftables

\bigskip
{\singlespace\small
\phantomsection
\printbibliography
}

\clearpage
\appendix
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{1}

\section{Additional Material}\label{app:extra}
Extra figures, robustness checks, data dictionary, or derivations can go here.

\end{document}
