From 1b57e6d1cfd80b2ccc1d385a261bb4d0b5f26880 Mon Sep 17 00:00:00 2001
From: Luke Naylor <l.naylor@sms.ed.ac.uk>
Date: Mon, 29 Jan 2024 21:33:01 +0000
Subject: [PATCH] Refactor preamble into separate files for manual handling

---
 main.tex          | 53 ++++++++---------------------------------------
 newcommands.tex   | 13 ++++++++++++
 preamble.tex      | 21 +++++++++++++++++++
 theoremstyles.tex | 12 +++++++++++
 4 files changed, 55 insertions(+), 44 deletions(-)
 create mode 100644 newcommands.tex
 create mode 100644 preamble.tex
 create mode 100644 theoremstyles.tex

diff --git a/main.tex b/main.tex
index 0f518cd..3e5fd3e 100644
--- a/main.tex
+++ b/main.tex
@@ -1,52 +1,14 @@
-\documentclass[12pt]{article}
-\usepackage{amsmath}
-\usepackage{amssymb}
-\usepackage{amsthm}
-\usepackage{graphicx}
-\usepackage{hyperref}
-\usepackage{color}
+\documentclass[class=article, crop=false]{standalone}
+\usepackage[subpreambles=false]{standalone}
+\input{preamble.tex}
+\onlyifstandalone{
 \usepackage{sagetex}
-\usepackage{subcaption}
-\usepackage{cancel}
-\usepackage{mathtools}
-\usepackage[]{breqn}
-\usepackage[
-backend=biber,
-style=alphabetic,
-sorting=ynt
-]{biblatex}
-\addbibresource{references.bib}
-
-\newcommand{\QQ}{\mathbb{Q}}
-\newcommand{\ZZ}{\mathbb{Z}}
-\newcommand{\RR}{\mathbb{R}}
-\newcommand{\NN}{\mathbb{N}}
-\newcommand{\PP}{\mathbb{P}}
-\newcommand{\chern}{\operatorname{ch}}
-\newcommand{\coh}{\operatorname{coh}}
-\newcommand{\homol}{\mathcal{H}}
-\newcommand{\lcm}{\operatorname{lcm}}
-\newcommand{\firsttilt}[1]{\mathcal{B}^{#1}}
-\newcommand{\bddderived}{\mathcal{D}^{b}}
-\newcommand{\centralcharge}{\mathcal{Z}}
-\newcommand{\minorheading}[1]{{\noindent\normalfont\normalsize\bfseries #1}}
-
-\newtheorem{theorem}{Theorem}[section]
-\newtheorem{corollary}{Corollary}[section]
-\newtheorem{lemma}{Lemma}[section]
-\newtheorem{fact}{Fact}[section]
-\newtheorem{example}{Example}[section]
-\newtheorem{lemmadfn}{Lemma/Definition}[section]
-
-\theoremstyle{definition}
-\newtheorem{definition}{Definition}[section]
-\newtheorem{problem}{Problem Statement}
-
-\newtheorem*{note}{Note:}
+}
 
 \begin{document}
 
 
+\onlyifstandalone{
 \title{Tighter Bounds for Ranks of Tilt Semistabilizers on Picard Rank 1 Surfaces
 \\[1em] \large
 Practical Methods for Narrowing Down Possible Walls}
@@ -63,6 +25,7 @@ Practical Methods for Narrowing Down Possible Walls}
 
 \newpage
 \tableofcontents
+}
 
 \newpage
 \section{Introduction}
@@ -2059,8 +2022,10 @@ to the problem for this choice of $v$.
 
 
 
+\onlyifstandalone{
 \newpage
 \printbibliography
+}
 
 \end{document}
 % comment
diff --git a/newcommands.tex b/newcommands.tex
new file mode 100644
index 0000000..bd2e3b5
--- /dev/null
+++ b/newcommands.tex
@@ -0,0 +1,13 @@
+\newcommand{\QQ}{\mathbb{Q}}
+\newcommand{\ZZ}{\mathbb{Z}}
+\newcommand{\RR}{\mathbb{R}}
+\newcommand{\NN}{\mathbb{N}}
+\newcommand{\PP}{\mathbb{P}}
+\newcommand{\chern}{\operatorname{ch}}
+\newcommand{\coh}{\operatorname{coh}}
+\newcommand{\homol}{\mathcal{H}}
+\newcommand{\lcm}{\operatorname{lcm}}
+\newcommand{\firsttilt}[1]{\mathcal{B}^{#1}}
+\newcommand{\bddderived}{\mathcal{D}^{b}}
+\newcommand{\centralcharge}{\mathcal{Z}}
+\newcommand{\minorheading}[1]{{\noindent\normalfont\normalsize\bfseries #1}}
diff --git a/preamble.tex b/preamble.tex
new file mode 100644
index 0000000..000cbc8
--- /dev/null
+++ b/preamble.tex
@@ -0,0 +1,21 @@
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{amsthm}
+\usepackage{graphicx}
+\usepackage{hyperref}
+\usepackage{color}
+\usepackage{subcaption}
+\usepackage{cancel}
+\usepackage{mathtools}
+\usepackage[]{breqn}
+\usepackage[
+backend=biber,
+style=alphabetic,
+sorting=ynt
+]{biblatex}
+\onlyifstandalone{
+\addbibresource{references.bib}
+}
+
+\input{newcommands.tex}
+\input{theoremstyles.tex}
diff --git a/theoremstyles.tex b/theoremstyles.tex
new file mode 100644
index 0000000..8d562ed
--- /dev/null
+++ b/theoremstyles.tex
@@ -0,0 +1,12 @@
+\newtheorem{theorem}{Theorem}[section]
+\newtheorem{corollary}{Corollary}[section]
+\newtheorem{lemma}{Lemma}[section]
+\newtheorem{fact}{Fact}[section]
+\newtheorem{example}{Example}[section]
+\newtheorem{lemmadfn}{Lemma/Definition}[section]
+
+\theoremstyle{definition}
+\newtheorem{definition}{Definition}[section]
+\newtheorem{problem}{Problem Statement}
+
+\newtheorem*{note}{Note:}
-- 
GitLab