From d94cfc08d186e5bd14657e30854a27ca3bf9eaef Mon Sep 17 00:00:00 2001
From: John Swinbank <swinbank@astron.nl>
Date: Fri, 16 Apr 2021 16:12:53 +0200
Subject: [PATCH] Set up clever references

---
 texmf/tex/latex/astron/astron.cls | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/texmf/tex/latex/astron/astron.cls b/texmf/tex/latex/astron/astron.cls
index bb4a8e6..cd82dfb 100644
--- a/texmf/tex/latex/astron/astron.cls
+++ b/texmf/tex/latex/astron/astron.cls
@@ -89,11 +89,27 @@
 \RequirePackage{parskip}
 \RequirePackage{tabularx}
 \RequirePackage{booktabs}
+\RequirePackage[capitalize]{cleveref}
+
+% Set up “clever” references.
+%
+% Use lower-case-p for pages references.
+\crefname{page}{page}{pages}
+% Abbreviations for appendix when not at the start of a sentence
+\crefname{appendix}{Appx.}{Appxs.}
+\Crefname{appendix}{Appendix}{Appendices}
+% Use § for section references, except at the beginning of sentences.
+\crefformat{section}{\S#2#1#3}
+\crefrangeformat{section}{\S\S#3#1#4--#5#2#6}
+\crefmultiformat{section}{\S\S#2#1#3}{ \&~#2#1#3}{, #2#1#3}{ \&~#2#1#3}
+\Crefformat{section}{Section~#2#1#3}
+\Crefrangeformat{section}{Sections~#3#1#4 to~#5#2#6}
+\Crefmultiformat{section}{Sections~#2#1#3}{ and~#2#1#3}{, #2#1#3}{ and~#2#1#3}
 
 % Set up glossaries
+%
 \input{astron-abbreviations}
 \makeglossaries
-
 % Don't expand these acronyms in the text.
 \glsunset{API}
 \glsunset{Apertif}
-- 
GitLab