DEFAULT_TEMPLATE = r"""
\documentclass{article}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage[margin=1in]{geometry}

\title{QuantumMetaGPT Report: \\ {{ title }}}
\author{Autonomous Quantum AI Research Agent}
\date{\today}

\begin{document}
\maketitle

\begin{abstract}
This report was automatically generated by the QuantumMetaGPT system. It contains results from 
quantum algorithm development, optimization, and evaluation based on the research paper analysis.
\end{abstract}

\section{Experiment Summary}
\begin{itemize}
    \item \textbf{Algorithm Type}: {{ algorithm_type }}
    \item \textbf{Qubits}: {{ num_qubits }}
    \item \textbf{Optimizer}: {{ optimizer }}
    \item \textbf{Evaluation Backend}: {{ backend }}
\end{itemize}

\section{Performance Metrics}
\begin{table}[h]
\centering
\begin{tabular}{@{}ll@{}}
\toprule
\textbf{Metric} & \textbf{Value} \\ \midrule
Fidelity & {{ metrics.fidelity|round(4) }} \\
Execution Time & {{ metrics.execution_time|round(4) }} seconds \\
Success Rate & {{ metrics.success }} \\
Circuit Depth & {{ metrics.depth }} \\
Gate Count & {{ metrics.gate_count }} \\ \bottomrule
\end{tabular}
\caption{Performance metrics summary}
\end{table}

\section{Circuit Diagram}
\begin{center}
\includegraphics[width=0.8\textwidth]{{ "{" }}{{ circuit_image }}{{ "}" }}
\caption{Optimized quantum circuit}
\end{center}

\section{Measurement Results}
\begin{center}
\includegraphics[width=0.8\textwidth]{{ "{" }}{{ histogram_image }}{{ "}" }}
\caption{Measurement histogram ({{ shots }} shots)}
\end{center}

\section{Performance Visualization}
\begin{center}
\includegraphics[width=0.8\textwidth]{{ "{" }}{{ performance_image }}{{ "}" }}
\caption{Performance metrics visualization}
\end{center}

\section{Conclusion}
The quantum algorithm achieved a fidelity of {{ metrics.fidelity|round(4) }} in 
{{ metrics.execution_time|round(2) }} seconds. {{ conclusion_notes }}

\end{document}
"""

def get_template(template_name="default"):
    """Retrieve LaTeX template by name"""
    templates = {
        "default": DEFAULT_TEMPLATE,
        "compact": DEFAULT_TEMPLATE.replace("0.8\\textwidth", "0.6\\textwidth")
    }
    return templates.get(template_name, DEFAULT_TEMPLATE)