\documentclass{article}
% This document illustrates how TIKZ can be used to produce a few
% different pedagogic diagrams for economics.
% \pgfmathparse within the PGF calc library can be used to calculate
% points generically given numerical values describing the figure.
% Thomas F. Rutherford
% Department of Management, Technology and Economics
% ETH Zurich
\usepackage{tikz}
\usetikzlibrary{calc}
\input{tikzecon}
\begin{document}
\begin{figure}[ht]
% Lay out the four figures on a 2x2 grid. Following the LaTeX examples,
% this is done by formatting figures on the left in parbox{} and figures
% on the right as a minipage. I'm not really an expert at this sort of
% thing, but I think that it's not so complicted.
\centering
% ------------------------------------------------------------------------
% Draw a Marshallian market equilibrium using isoelastic
% demand and supply schedules.
\parbox{0.4\textwidth}{%
\begin{tikzpicture}[scale=1.25]
\def\pref{2} % Reference price
\def\qref{1} % Reference quantity
\def\epsilon{0.5} % Elasticity of demand
\def\eta{1.5} % Elasticity of supply
% Scope the line thickness and the clipping rectangle:
\begin{scope}[thick]
\clip (\qref*0.25,\pref*0.25) rectangle (\qref*1.75,\pref*1.75);
% Use library routines to draw the demand and the supply curves:
\color{red}
\isodemand{\qref}{\pref}{\epsilon}
\color{blue}
\isosupply{\qref}{\pref}{\eta}
\end{scope}
% Label with numeric values for the benchmark point:
\draw [gray, very thin] (\qref,0) node[below,black]{\qref} --
(\qref,\pref) -- (0,\pref) node[left,black]{\pref};
\color{black}
% Put a mark at the reference point. Perhaps this could be made less
% verbose? But it is helpful to be able to control the size of the dot.
\draw plot[mark options={scale=0.5},mark=*]coordinates{(\qref,\pref)};
% Draw and label the axes:
\draw[<->](2*\qref,0)node[below] {$q$}--(0,0)--(0,2*\pref) node[left] {$p$};
\end{tikzpicture}
\caption{Elastic Equilibrium}}%
% Lay out the four figures side-by-side -- no black lines permitted:
\qquad
% ------------------------------------------------------------------------
% Draw a Marshallian supply-demand figure with linear demand and supply
% curves. (Do all the graphics explicitly, as it is simple enough not to
% warrant a library routine.)
\begin{minipage}{0.4\textwidth}%
\centering
\begin{tikzpicture}[scale=1.25]
% Definitions are not required, but I include them for the sake of
% transparency:
\def\pref{2} % Reference price
\def\qref{1} % Reference quantity
\def\epsilon{0.5} % Elasticity of demand
\def\eta{0.5} % Elasticity of supply
% Scope the line thickness and the clipping rectangle:
\begin{scope}[very thick]
\clip (\qref*0.25,\pref*0.25) rectangle (\qref*1.75,\pref*1.75);
% Draw a linear demand curve, using PGF to compute points:
\color{red}
\pgfmathparse{1+\epsilon}\let\qmax\pgfmathresult
\pgfmathparse{1+1/\epsilon}\let\pmax\pgfmathresult
\draw (\qref*\qmax,0) -- (0,\pref*\pmax);
% Draw a linear demand curve, using PGF to compute points:
\color{blue}
\pgfmathparse{1-\eta}\let\qzero\pgfmathresult
\pgfmathparse{1+\eta*(\maxp-1)}\let\qmax\pgfmathresult
\draw (\qref*\qzero,0) -- (\qref*\qmax,\pref*\maxp);
\end{scope}
% Add labels and markup (see first figure for comments)
\draw [gray, very thin] (\qref,0) node[below,black]{\qref} -- (\qref,\pref)
-- (0,\pref) node[left,black]{\pref};
\color{black}
\draw plot[mark options={scale=0.5},mark=*]coordinates{(\qref,\pref)};
\draw[<->](2*\qref,0)node[below] {$q$}--(0,0)--(0,2*\pref) node[left] {$p$};
\end{tikzpicture}
\caption{Linear Equilibrium}
\end{minipage}%
\vspace{0.5in}
% ------------------------------------------------------------------------
% CES isoquant/indifference curve:
\parbox{0.4\textwidth}{%
\centering
\begin{tikzpicture}[scale=1.25]
% Make the code easier to modify by using variables to represent the
% reference point:
\def\pref{2} % Reference price X
\def\xref{2} % Reference quantity X
\def\yref{2} % Reference quantity Y
\def\sigma{0.5} % Elasticity of substitution
% Scope the line thickness and the clipping rectangle:
\begin{scope}[very thick]
\clip (\xref*0.1,\yref*0.1) rectangle (\xref*1.9,\yref*1.9);
\color{blue}
% Draw the isoquant/indifference curve using the \ces macro:
\ces{\pref}{\xref}{\yref}{\sigma}
\end{scope}
% Draw a tangent to the reference point:
\begin{scope}[thick]
\clip (0,0) rectangle (\xref*2,\yref*2);
\color{black}
\draw (\xref+\yref/\pref,0) -- (0,\pref*\xref+\yref);
\end{scope}
% Add labels and markup (see first figure for comments)
\draw [gray, very thin] (\xref,0) node[below,black]{\xref} --
(\xref,\yref) -- (0,\yref) node[left,black]{\yref};
\color{black}
\draw plot[mark options={scale=0.5},mark=*]coordinates{(\xref,\yref)};
\draw[<->](2*\yref,0)node[below] {$k$}--(0,0)--(0,2*\xref) node[left] {$\ell$};
\end{tikzpicture}
\caption{CES Choice}}%
% Lay out the four figures side-by-side:
\qquad
% ------------------------------------------------------------------------
\begin{minipage}{0.4\textwidth}%
\centering
\begin{tikzpicture}[scale=1.25]
\def\pref{2} % Reference price of X
\def\xref{2} % Reference quantity X
\def\yref{2} % Reference quantity Y
\def\eta{2} % Elasticity of transformation
% Scope the line thickness and the clipping rectangle:
\begin{scope}[very thick]
\clip (\xref*0.1,\yref*0.1) rectangle (\xref*1.9,\yref*1.9);
\color{red}
% Draw the frontier using the \cet macro:
\cet{\pref}{\xref}{\yref}{\eta}
\end{scope}
% Draw a tangent to the reference point:
\begin{scope}[thick]
\clip (0,0) rectangle (\xref*2,\yref*2);
\color{black}
\draw (\xref+\yref/\pref,0) -- (0,\pref*\xref+\yref);
\end{scope}
% Add labels and markup (see first figure for comments)
\draw [gray, very thin] (\xref,0) node[below,black]{\xref} --
(\xref,\yref) -- (0,\yref) node[left,black]{\yref};
\color{black}
\draw plot[mark options={scale=0.5},mark=*]coordinates{(\xref,\yref)};
\draw[<->](2*\yref,0)node[below] {$k$}--(0,0)--(0,2*\xref) node[left] {$\ell$};
\end{tikzpicture}
\caption{CET Choice}
\end{minipage}%
\end{figure}%
\end{document}