# Code to allow a master "Generator" and derived "Generated" versions
#   - allows "$nb-Problems-And-Solutions → $nb-Problems → $nb"
Generator=False # Is this notebook the master or is it generated?

# Whether to save the figures to Figures_dir
saveFigs=True

# Whether to draw the figures
drawFigs=True

import HARK
if HARK.__version__ < '0.10.6':
    raise ImportError('This notebook requires at least econ-ark v0.10.6,  please update your installation pip install -U econ-ark or conda install -c conda-forge econ-ark')

from HARK.utilities import find_gui, make_figs, determine_platform, test_latex_installation, setup_latex_env_notebook
pf = determine_platform()
try:
    latexExists = test_latex_installation(pf)
except ImportError: # windows and MacOS requires manual install
    latexExists = False

setup_latex_env_notebook(pf, latexExists)

# check if GUI is present if not then switch drawFigs to False and force saveFigs to be True
if not find_gui():
    drawFigs = False
    saveFigs = True

# this can be removed if we pass in saveFigs and drawFigs in every call to make('figure')
def make(figure_name, target_dir="../../Figures"):
    make_figs(figure_name, saveFigs, drawFigs, target_dir)
    plot_funcs, find_gui, make_figs, determine_platform,
    test_latex_installation, setup_latex_env_notebook)
from HARK.ConsumptionSaving.ConsIndShockModel import (
    PerfForesightConsumerType, IndShockConsumerType, init_perfect_foresight, init_idiosyncratic_shocks)

# Code to allow a master "Generator" and derived "Generated" versions
# Generator marking  - allows "$nb-Problems-And-Solutions → $nb-Problems → $nb" 
Generator = True  # Is this notebook the master or is it generated?

# Whether to save the figures to Figures_dir
saveFigs = True

# Whether to draw the figures
drawFigs = True

pf = determine_platform() # latex checking depends on platform
try: # test whether latex is installed on command line 
    latexExists = test_latex_installation(pf)
except ImportError:  # windows and MacOS requires manual latex install
    latexExists = False

setup_latex_env_notebook(pf, latexExists)

# check if GUI is present; if not then switch drawFigs to False and force saveFigs to be True
if not find_gui():
    drawFigs, saveFigs = False, True

# Font sizes for figures
fssml, fsmid, fsbig = 18, 22, 26

def makeFig(figure_name, target_dir="../../Figures"):