关于 latex-econ-model
面向经济学家的 LaTeX 建模与排版技能,帮助规范表示经济模型并组织理论部分。内容涵盖效用最大化、均衡条件、动态规划和博弈论模型。
主要功能
- 01规范经济学数学符号
- 02组织模型环境与约束
- 03编写均衡条件和解
- 04排版优化问题与方程
- 05遵循学术排版惯例
适用场景
- 01撰写论文理论部分
- 02形式化经济模型
- 03制作含方程的课程讲义
- 04排版优化问题与均衡条件
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ meleantonio/ awesome-econ-ai-stuff --skill latex-econ-model安装后在 Claude Code 中输入/latex-econ-model确认已加载。
附带文件index.md
详细介绍
LaTeX 经济模型撰写
用途
此技能帮助经济学家使用 LaTeX 撰写和排版经济模型,确保数学符号规范、格式一致,并符合学术惯例。内容涵盖效用最大化、均衡条件、动态规划和博弈论模型。
适用场景
- 撰写论文的理论部分
- 将经济模型形式化
- 编写包含公式的讲义
- 排版优化问题和均衡条件
使用说明
第 1 步:了解模型类型
询问用户:
- 模型属于哪种类型?(静态优化、动态规划、博弈论、一般均衡)
- 有哪些 Agent 类型?(消费者、企业、政府等)
- 有哪些约束条件?
- 是否需要包含证明,还是只需要模型设定?
第 2 步:使用标准符号
遵循经济学惯例:
- 效用:$U$、$u$ 或 $v$
- 生产:$F$、$f$ 或 $Y$
- 价格:$p$、$w$、$r$
- 数量:$q$、$x$、$y$
- 时间下标:$t$、$t+1$
- 参数使用希腊字母:$\alpha$、$\beta$、$\gamma$、$\delta$
第 3 步:组织模型结构
按以下结构组织:
- 环境 - Agent、商品、时间范围
- 偏好/技术 - 效用函数、生产函数
- 约束条件 - 预算、资源、激励相容
- 均衡概念 - 定义和条件
- 求解 - 一阶条件、闭式解
输出示例
\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 宏包
% 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
实用的自定义命令
% 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}}
最佳实践
- 多行公式使用
align环境 - 使用
\label{}标记重要公式,并用\eqref{}引用 - 在公式中的文字部分使用
\text{}(不要直接输入文本) - 使用
\boxed{}框出关键结果 - 为重复使用的符号定义自定义命令
- 统一下标约定(用 $t$ 表示时间,用 $i$ 表示个体)
常见问题
- ❌ 使用
*表示乘法(应使用\cdot或隐式乘法) - ❌ 忘记使用
\left(和\right)自动调整括号大小 - ❌ 论文中的符号不一致
- ❌ 未在
=处对齐公式 - ❌ 使用
$$ ... $$,而非适当的环境
参考资料
- AMS-LaTeX 用户指南
- LaTeX 简短入门
- Mathpix - 将手写公式转换为 LaTeX
更新日志
v1.0.0
- 首次发布,包含消费者、企业和博弈论模板
评论
支持 Markdown