---
name: arXiv Preprint
description: arXiv-compatible preprint format with minimal styling
input_type: rdf
output_type: latex
author: ggen core team
version: 1.0.0
tags: [paper, arxiv, preprint, latex]
---
\documentclass[11pt,a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{cite}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{geometry}

\geometry{margin=1in}

\lstset{
  basicstyle=\ttfamily\small,
  breaklines=true,
  commentstyle=\color{gray},
  keywordstyle=\color{blue},
  stringstyle=\color{red},
}

\title{ {{- paper.title -}} }

\author{
{% for author in paper.hasAuthor | sort_by("authorOrder") %}
  {{- author.authorName -}}
  {% if author.hasAffiliation %}
    {% if author.hasAffiliation.affiliationName %}^{{loop.index}}{% endif %}
  {% endif %}
  {% if not loop.last %}, {% endif %}
{% endfor %}
}

\date{\today}

\begin{document}

\maketitle

% ============================================================================
% ABSTRACT
% ============================================================================

\begin{abstract}
{{- paper.abstract }}
\end{abstract}

\noindent\textbf{Keywords:} {{- paper.keywords }}

% ============================================================================
% AFFILIATIONS
% ============================================================================

{% set affiliations = [] %}
{% for author in paper.hasAuthor | sort_by("authorOrder") %}
  {% if author.hasAffiliation and author.hasAffiliation not in affiliations %}
    {% set _ = affiliations.push(author.hasAffiliation) %}
  {% endif %}
{% endfor %}

{% if affiliations | length > 0 %}
\section*{Affiliations}
{% for aff in affiliations %}
$^{{loop.index}}$ {{- aff.affiliationName }}{% if aff.department %}, {{- aff.department }}{% endif %}{% if aff.country %}, {{- aff.country }}{% endif %} \\
{% endfor %}
{% endif %}

% ============================================================================
% INTRODUCTION
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="introduction") %}
\section{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}
{% endfor %}

% ============================================================================
% RELATED WORK
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="related-work") %}
\section{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}
{% endfor %}

% ============================================================================
% METHODS
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="methods") %}
\section{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}

{% for subsection in section.subsectionOf | sort_by("sectionOrder") %}
\subsection{ {{- subsection.sectionTitle -}} }
{{- subsection.sectionContent }}
{% endfor %}
{% endfor %}

% ============================================================================
% RESULTS
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="results") %}
\section{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}

{% for figure in paper.hasFigure | sort_by("figureOrder") %}
\begin{figure}[ht]
  \centering
  \includegraphics[width={{- figure.figureWidth | default("0.6\\textwidth") -}}]{ {{- figure.figureFile -}} }
  \caption{ {{- figure.figureCaption -}} }
  \label{fig: {{- figure.figureName -}} }
\end{figure}

{% endfor %}

{% for table in paper.hasTable | sort_by("tableOrder") %}
\begin{table}[ht]
  \centering
  \caption{ {{- table.tableCaption -}} }
  \label{tbl: {{- table.tableName -}} }
  {{- table.tableContent }}
\end{table}

{% endfor %}
{% endfor %}

% ============================================================================
% DISCUSSION
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="discussion") %}
\section{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}
{% endfor %}

% ============================================================================
% CONCLUSION
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="conclusion") %}
\section{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}
{% endfor %}

% ============================================================================
% ACKNOWLEDGMENTS
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="acknowledgments") %}
\section*{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}
{% endfor %}

% ============================================================================
% REFERENCES
% ============================================================================

\bibliographystyle{plain}
\bibliography{references}

% ============================================================================
% APPENDICES
% ============================================================================

{% for section in paper.hasSection | filter(attribute="sectionType", value="appendix") %}
\appendix

\section{ {{- section.sectionTitle -}} }
{{- section.sectionContent }}
{% endfor %}

\end{document}
