\documentclass<* if template.class_options|length > 0 *>[<+ template.class_options|join(', ') +>]<* endif *>{<+ template.doctype +>}
<* if template.geometry is defined *>
\usepackage[<* for key, value in template.geometry.items() *><+ key +>=<+ value +><+ ', ' if not loop.last +><* endfor *>]{geometry}
<* endif *>
<* if template.styles|length > 0 *>

% style packages
<* for pack in template.styles *>
\usepackage{<+ config.project_data_folder+>/<+ pack|data_name('style') +>}
<* endfor *>
<* endif *>
<* if template.macros|length > 0 *>

% macro packages
<* for pack in template.macros *>
\usepackage{<+ config.project_data_folder+>/<+ pack|data_name('macro') +>}
<* endfor *>
\usepackage{<+ config.project_macro_file +>}
<* endif *>
