LaTeX Economic Model Writer
Purpose
This skill helps economists write and typeset economic models in LaTeX with proper mathematical notation, consistent formatting, and academic conventions. It covers utility maximization, equilibrium conditions, dynamic programming, and game theory models.
When to Use
- Writing the theory section of a paper
- Formalizing an economic model
- Creating lecture notes with equations
- Typesetting optimization problems and equilibrium conditions
Instructions
Step 1: Understand the Model Type
Ask the user:
- What type of model? (Static optimization, dynamic programming, game theory, general equilibrium)
- What are the agent types? (Consumer, firm, government, etc.)
- What constraints apply?
- Should it include proofs or just the setup?
Step 2: Use Standard Notation
Follow economics conventions:
- Utility: $U$, $u$, or $v$
- Production: $F$, $f$, or $Y$
- Prices: $p$, $w$, $r$
- Quantities: $q$, $x$, $y$
- Time subscripts: $t$, $t+1$
- Greek letters for parameters: $\alpha$, $\beta$, $\gamma$, $\delta$
Step 3: Structure the Model
Organize as:
- Environment - Agents, goods, time horizon
- Preferences/Technology - Utility functions, production functions
- Constraints - Budget, resource, incentive compatibility
- Equilibrium concept - Definition and conditions
- Solution - First-order conditions, closed-form solutions
Example Output
\documentclass{article}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{mathtools}
% Theorem environments
\newtheorem{definition}{Definition}
\newtheorem{proposition}{Proposition}
\newtheorem{lemma}{Lemma}
% Custom commands for economics
\newcommand{\E}{\mathbb{E}} % Expectation
\newcommand{\R}{\mathbb{R}} % Real numbers
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}} % Partial derivative
\begin{document}
\section{A Simple Consumer Problem}
\subsection{Environment}
Consider a consumer who lives for two periods, $t \in \{1, 2\}$. The consumer has preferences over consumption $c_t$ represented by the utility function:
%
\begin{equation}
U(c_1, c_2) = u(c_1) + \beta u(c_2)
\end{equation}
%
where $\beta \in (0,1)$ is the discount factor and $u(\cdot)$ is strictly increasing and strictly concave.
\subsection{Constraints}
The consumer earns income $y_1$ in period 1 and $y_2$ in period 2. She can save at gross interest rate $R = 1 + r$. The budget constraints are:
%
\begin{align}
c_1 + s &= y_1 \label{eq:bc1}\\
c_2 &= y_2 + Rs \label{eq:bc2}
\end{align}
%
where $s$ denotes savings. Combining \eqref{eq:bc1} and \eqref{eq:bc2} yields the intertemporal budget constraint:
%
\begin{equation}
c_1 + \frac{c_2}{R} = y_1 + \frac{y_2}{R} \equiv W
\end{equation}
\subsection{Optimization Problem}
The consumer solves:
%
\begin{equation}
\max_{c_1, c_2} \quad u(c_1) + \beta u(c_2)
\quad \text{s.t.} \quad c_1 + \frac{c_2}{R} = W
\end{equation}
\subsection{Solution}
The Lagrangian is:
%
\begin{equation}
\mathcal{L} = u(c_1) + \beta u(c_2) + \lambda\left(W - c_1 - \frac{c_2}{R}\right)
\end{equation}
First-order conditions:
%
\begin{align}
\pd{\mathcal{L}}{c_1} &= u'(c_1) - \lambda = 0 \\
\pd{\mathcal{L}}{c_2} &= \beta u'(c_2) - \frac{\lambda}{R} = 0
\end{align}
Combining these yields the \textbf{Euler equation}:
%
\begin{equation}
\boxed{u'(c_1) = \beta R \cdot u'(c_2)}
\end{equation}
\begin{proposition}[Consumption Smoothing]
If $\beta R = 1$, then $c_1^* = c_2^*$ (perfect consumption smoothing).
\end{proposition}
\begin{proof}
When $\beta R = 1$, the Euler equation becomes $u'(c_1) = u'(c_2)$. Since $u$ is strictly concave, $u'$ is strictly decreasing, which implies $c_1 = c_2$.
\end{proof}
%====================================
\section{A Firm's Dynamic Problem}
%====================================
Consider a firm that maximizes the present value of profits:
%
\begin{equation}
\max_{\{k_{t+1}, n_t\}_{t=0}^{\infty}} \sum_{t=0}^{\infty} \beta^t \left[ F(k_t, n_t) - w_t n_t - I_t \right]
\end{equation}
%
subject to the capital accumulation equation:
%
\begin{equation}
k_{t+1} = (1 - \delta) k_t + I_t
\end{equation}
The Bellman equation is:
%
\begin{equation}
V(k) = \max_{k', n} \left\{ F(k, n) - wn - k' + (1-\delta)k + \beta V(k') \right\}
\end{equation}
\end{document}
LaTeX Packages to Include
% Essential packages for economics papers
\usepackage{amsmath} % Enhanced math environments
\usepackage{amssymb} % Mathematical symbols
\usepackage{amsthm} % Theorem environments
\usepackage{mathtools} % Extensions to amsmath
\usepackage{bm} % Bold math symbols
\usepackage{dsfont} % \mathds for indicator functions
Useful Custom Commands
% Expectation and probability
\newcommand{\E}{\mathbb{E}}
\newcommand{\Var}{\text{Var}}
\newcommand{\Cov}{\text{Cov}}
\newcommand{\Prob}{\mathbb{P}}
% Indicator function
\newcommand{\ind}{\mathds{1}}
% Partial derivatives
\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}}
% Argmax/argmin
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
% Blackboard bold
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
Best Practices
- Use
align environment for multiline equations
- Label important equations with
\label{} and reference with \eqref{}
- Use
\text{} for words in equations (not bare text)
- Box key results with
\boxed{}
- Define custom commands for repeated notation
- Use consistent subscript conventions ($t$ for time, $i$ for individuals)
Common Pitfalls
- ❌ Using
* for multiplication (use \cdot or implicit multiplication)
- ❌ Forgetting
\left( and \right) for auto-sizing brackets
- ❌ Inconsistent notation across the paper
- ❌ Not aligning equations at
= signs
- ❌ Using
$$ ... $$ instead of proper environments
References
Changelog
v1.0.0
- Initial release with consumer, firm, and game theory templates
1---2name: latex-econ-model3description: Write and typeset economic models in LaTeX with proper notation4---56# LaTeX Economic Model Writer78## Purpose910This skill helps economists write and typeset economic models in LaTeX with proper mathematical notation, consistent formatting, and academic conventions. It covers utility maximization, equilibrium conditions, dynamic programming, and game theory models.1112## When to Use1314- Writing the theory section of a paper15- Formalizing an economic model16- Creating lecture notes with equations17- Typesetting optimization problems and equilibrium conditions1819## Instructions2021### Step 1: Understand the Model Type2223Ask the user:241. What type of model? (Static optimization, dynamic programming, game theory, general equilibrium)252. What are the agent types? (Consumer, firm, government, etc.)263. What constraints apply?274. Should it include proofs or just the setup?2829### Step 2: Use Standard Notation3031Follow economics conventions:32- Utility: $U$, $u$, or $v$33- Production: $F$, $f$, or $Y$34- Prices: $p$, $w$, $r$35- Quantities: $q$, $x$, $y$36- Time subscripts: $t$, $t+1$37- Greek letters for parameters: $\alpha$, $\beta$, $\gamma$, $\delta$3839### Step 3: Structure the Model4041Organize as:421. **Environment** - Agents, goods, time horizon432. **Preferences/Technology** - Utility functions, production functions443. **Constraints** - Budget, resource, incentive compatibility454. **Equilibrium concept** - Definition and conditions465. **Solution** - First-order conditions, closed-form solutions4748## Example Output4950```latex51\documentclass{article}52\usepackage{amsmath, amssymb, amsthm}53\usepackage{mathtools}5455% Theorem environments56\newtheorem{definition}{Definition}57\newtheorem{proposition}{Proposition}58\newtheorem{lemma}{Lemma}5960% Custom commands for economics61\newcommand{\E}{\mathbb{E}} % Expectation62\newcommand{\R}{\mathbb{R}} % Real numbers63\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}} % Partial derivative6465\begin{document}6667\section{A Simple Consumer Problem}6869\subsection{Environment}7071Consider a consumer who lives for two periods, $t \in \{1, 2\}$. The consumer has preferences over consumption $c_t$ represented by the utility function:72%73\begin{equation}74 U(c_1, c_2) = u(c_1) + \beta u(c_2)75\end{equation}76%77where $\beta \in (0,1)$ is the discount factor and $u(\cdot)$ is strictly increasing and strictly concave.7879\subsection{Constraints}8081The consumer earns income $y_1$ in period 1 and $y_2$ in period 2. She can save at gross interest rate $R = 1 + r$. The budget constraints are:82%83\begin{align}84 c_1 + s &= y_1 \label{eq:bc1}\\85 c_2 &= y_2 + Rs \label{eq:bc2}86\end{align}87%88where $s$ denotes savings. Combining \eqref{eq:bc1} and \eqref{eq:bc2} yields the intertemporal budget constraint:89%90\begin{equation}91 c_1 + \frac{c_2}{R} = y_1 + \frac{y_2}{R} \equiv W92\end{equation}9394\subsection{Optimization Problem}9596The consumer solves:97%98\begin{equation}99 \max_{c_1, c_2} \quad u(c_1) + \beta u(c_2) 100 \quad \text{s.t.} \quad c_1 + \frac{c_2}{R} = W101\end{equation}102103\subsection{Solution}104105The Lagrangian is:106%107\begin{equation}108 \mathcal{L} = u(c_1) + \beta u(c_2) + \lambda\left(W - c_1 - \frac{c_2}{R}\right)109\end{equation}110111First-order conditions:112%113\begin{align}114 \pd{\mathcal{L}}{c_1} &= u'(c_1) - \lambda = 0 \\115 \pd{\mathcal{L}}{c_2} &= \beta u'(c_2) - \frac{\lambda}{R} = 0116\end{align}117118Combining these yields the \textbf{Euler equation}:119%120\begin{equation}121 \boxed{u'(c_1) = \beta R \cdot u'(c_2)}122\end{equation}123124\begin{proposition}[Consumption Smoothing]125If $\beta R = 1$, then $c_1^* = c_2^*$ (perfect consumption smoothing).126\end{proposition}127128\begin{proof}129When $\beta R = 1$, the Euler equation becomes $u'(c_1) = u'(c_2)$. Since $u$ is strictly concave, $u'$ is strictly decreasing, which implies $c_1 = c_2$.130\end{proof}131132%====================================133\section{A Firm's Dynamic Problem}134%====================================135136Consider a firm that maximizes the present value of profits:137%138\begin{equation}139 \max_{\{k_{t+1}, n_t\}_{t=0}^{\infty}} \sum_{t=0}^{\infty} \beta^t \left[ F(k_t, n_t) - w_t n_t - I_t \right]140\end{equation}141%142subject to the capital accumulation equation:143%144\begin{equation}145 k_{t+1} = (1 - \delta) k_t + I_t146\end{equation}147148The Bellman equation is:149%150\begin{equation}151 V(k) = \max_{k', n} \left\{ F(k, n) - wn - k' + (1-\delta)k + \beta V(k') \right\}152\end{equation}153154\end{document}155```156157## LaTeX Packages to Include158159```latex160% Essential packages for economics papers161\usepackage{amsmath} % Enhanced math environments162\usepackage{amssymb} % Mathematical symbols163\usepackage{amsthm} % Theorem environments164\usepackage{mathtools} % Extensions to amsmath165\usepackage{bm} % Bold math symbols166\usepackage{dsfont} % \mathds for indicator functions167```168169## Useful Custom Commands170171```latex172% Expectation and probability173\newcommand{\E}{\mathbb{E}}174\newcommand{\Var}{\text{Var}}175\newcommand{\Cov}{\text{Cov}}176\newcommand{\Prob}{\mathbb{P}}177178% Indicator function179\newcommand{\ind}{\mathds{1}}180181% Partial derivatives182\newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}}183\newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}}184185% Argmax/argmin186\DeclareMathOperator*{\argmax}{arg\,max}187\DeclareMathOperator*{\argmin}{arg\,min}188189% Blackboard bold190\newcommand{\R}{\mathbb{R}}191\newcommand{\N}{\mathbb{N}}192\newcommand{\Z}{\mathbb{Z}}193```194195## Best Practices1961971. **Use `align` environment** for multiline equations1982. **Label important equations** with `\label{}` and reference with `\eqref{}`1993. **Use `\text{}` for words in equations** (not bare text)2004. **Box key results** with `\boxed{}`2015. **Define custom commands** for repeated notation2026. **Use consistent subscript conventions** ($t$ for time, $i$ for individuals)203204## Common Pitfalls205206- ❌ Using `*` for multiplication (use `\cdot` or implicit multiplication)207- ❌ Forgetting `\left(` and `\right)` for auto-sizing brackets208- ❌ Inconsistent notation across the paper209- ❌ Not aligning equations at `=` signs210- ❌ Using `$$ ... $$` instead of proper environments211212## References213214- [AMS-LaTeX User's Guide](https://www.ams.org/arc/resources/amslatex-about.html)215- [The Not So Short Introduction to LaTeX](https://tobi.oetiker.ch/lshort/lshort.pdf)216- [Mathpix](https://mathpix.com/) - Convert handwritten equations to LaTeX217218## Changelog219220### v1.0.0221- Initial release with consumer, firm, and game theory templates