Debian Codegraph @

texmf-dist/source/latex/sblreport/sblreport.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (c) 2026 David Purton <[email protected]>
4 %
5 % This work may be distributed and/or modified under the conditions of
6 % the LaTeX Project Public License, either version 1.3c of this license
7 % or (at your option) any later version. The latest version of this
8 % license is in
9 % http://www.latex-project.org/lppl.txt
10 % and version 1.3c or later is part of all distributions of LaTeX
11 % version 2005/12/01 or later.
12 %
13 %<*driver>
14 \RequirePackage{pdfmanagement}
15 \documentclass[a4paper]{l3doc}
16 \usepackage[T1]{fontenc}
17 \usepackage{microtype}
18 \usepackage{mlmodern}
19 \usepackage[font=small, skip=6pt]{caption}
20 \usepackage{xcolor}
21 \usepackage{listings}
22
23 \AddToHook{env/macrocode/before}{%
24 \addvspace{\medskipamount}}
25
26 \AddToHook{env/macro/before}{%
27 \addvspace{\medskipamount}}
28
29 \begin{document}
30 \DocInput{\jobname.dtx}
31 \end{document}
32 %</driver>
33 % \fi
34 %
35 % \title{The \pkg{sblreport} Class}
36 % \author{David Purton\thanks{Email: \url{[email protected]}}}
37 % \date{2026-04-04 v1.0}
38 %
39 % \maketitle
40 %
41 % \begin{abstract}
42 % \pkg{sblreport} provides a LaTeX class for producing theses conforming to
43 % the style required by the Society of Biblical Literature. It depends on
44 % \pkg{sblfonts} for language support and \pkg{biblatex-sbl} for
45 % referencing.
46 % \end{abstract}
47 %
48 % \tableofcontents
49 %
50 % \section{Introduction}
51 %
52 % The \pkg{sblreport} class creates a thesis matching the style specified
53 % in the \emph{Student Supplement for \emph{The SBL Handbook of Style}, Second
54 % Edition}. See
55 % \url{https://www.sbl-site.org/wp-content/uploads/2025/04/SBLHSsupp2015-02.pdf}.
56 %
57 % The class works with both |pdflatex| and the Unicode engines, but in order
58 % to make use of the SBL fonts you need to install them and use a Unicode
59 % engine (|lualatex| is recommended, especially for Hebrew).
60 %
61 % This class is not intended to be a general flexible starting point for the
62 % requirements of all theological colleges and seminaries. In such cases you
63 % are better off beginning with the \pkg{report} class and loading
64 % \pkg{biblatex-sbl} and (possibly) \pkg{sblfonts} directly. You could use the
65 % code in this class as a guide.
66 %
67 % \subsection{Usage}
68 %
69 % Load the class using |\documentclass{sblreport}|. See |sbltex-thesis.pdf| in
70 % the documentation directory for an extended usage example.
71 %
72 % The following standard commands and environments have been customised for
73 % this class:
74 % \begin{itemize}
75 % \item |\author|, |\title|, |\maketitle|
76 % \item |\tableofcontents|, |\listoffigure|, |\listoftables|
77 % \item |\section|, |\subsection|, |\subsubsection|, |\paragraph|,
78 % |\subparagraph|
79 % \item |\appendix|
80 % \item |\footnote|
81 % \item |\caption|
82 % \item |\printbibliography|, |\printbiblist{abbreviations}|
83 % \item |abstract|, |quotation|, |quote|
84 % \end{itemize}
85 %
86 % American, Greek and Hebrew are set up using \pkg{sblfonts} (and
87 % \pkg{babel}). A different main language can be chosen by passing the
88 % \pkg{babel} language name to the class.
89 %
90 % \subsection{Acknowledgements}
91 %
92 % The \pkg{sblreport} class depends on a number of other packages:
93 % \begin{itemize}
94 % \item \pkg{sblfonts} (with \pkg{fontspec}, \pkg{fontenc} and \pkg{babel}),
95 % \pkg{biblatex-sbl} (with \pkg{biblatex})
96 % \item \pkg{csquotes}, \pkg{geometry}, \pkg{setspace}, \pkg{ragged2e},
97 % \pkg{fancyhdr}
98 % \item When \cs{DocumentMetadata} is not in use: \pkg{caption},
99 % \pkg{footmisc}, \pkg{titlesec}, \pkg{titletoc}
100 % \end{itemize}
101 %
102 % \subsection{Bug Reports and Feature Requests}
103 %
104 % Bug reports and feature requests can be made at the \pkg{sbltex}
105 % GitHub repository. See \url{https://github.com/dcpurton/sbltex}.
106 %
107 % \begin{description}
108 % \item[Note:] This class is only partially compatible with the \LaTeX{}
109 % tagging project at this stage. As the tagging project stabilises and
110 % dependent packages are updated, compatibility will improve.
111 % \end{description}
112 %
113 % \section{Package Commands}
114 %
115 % \begin{function}{\degree}
116 % \begin{syntax}
117 % |\degree| \marg{Degree name}
118 % \end{syntax}
119 % Set the name of the degree the thesis is for. This is included on the
120 % title page.
121 % \end{function}
122 %
123 % \begin{function}{\institution}
124 % \begin{syntax}
125 % |\institution| \marg{Institution name}
126 % \end{syntax}
127 % Set the name of the institution the thesis will be submitted at. This is
128 % included on the title page.
129 % \end{function}
130 %
131 % \section{Package Environments}
132 %
133 % \begin{function}{acknowledgements}
134 % \begin{syntax}
135 % |\begin| \marg{acknowledgements}
136 % |\end| \marg{acknowledgements}
137 % \end{syntax}
138 % Add an Acknowledgements page to the thesis. The name of the section can be
139 % changed by redefining |\acknowledgementsname|.
140 % \end{function}
141 %
142 % \begin{function}{approvalpage}
143 % \begin{syntax}
144 % |\begin| \marg{approvalpage}
145 % |\end| \marg{approvalpage}
146 % \end{syntax}
147 % Add an approval page to the thesis. This page is empty by default.
148 % \end{function}
149 %
150 % \begin{function}{copyrightpage}
151 % \begin{syntax}
152 % |\begin| \marg{copyrightpage}
153 % |\end| \marg{copyrightpage}
154 % \end{syntax}
155 % Add a copyright page to the thesis. This page is empty by default.
156 % \end{function}
157 %
158 % \begin{function}{dedication}
159 % \begin{syntax}
160 % |\begin| \marg{dedication}
161 % |\end| \marg{dedication}
162 % \end{syntax}
163 % Add a dedication to the thesis. This page is empty by default.
164 % \end{function}
165 %
166 % \begin{function}{epigraph}
167 % \begin{syntax}
168 % |\begin| \marg{epigraph}
169 % |\end| \marg{epigraph}
170 % \end{syntax}
171 % Add an epigraph to the thesis. This page is empty by default.
172 % \end{function}
173 %
174 % \begin{function}{preface}
175 % \begin{syntax}
176 % |\begin| \marg{preface}
177 % |\end| \marg{preface}
178 % \end{syntax}
179 % Add an Preface to the thesis. The name of the section can be changed by
180 % redefining |\prefacename|.
181 % \end{function}
182 %
183 % \section{Package Options}
184 %
185 % Items passed to the options below are \emph{appended} to the default options
186 % rather than replacing them.
187 %
188 % Any unrecognised options passed to the \pkg{sblreport} class are passed
189 % through to the \pkg{report} class.
190 %
191 % \begin{function}{biblatex}
192 % \begin{syntax}
193 % biblatex = \marg{arguments}\hfill Default: \{style=sbl, language=auto, autolang=hyphen\}
194 % \end{syntax}
195 % These options are passed to the \pkg{biblatex} package.
196 % \end{function}
197 %
198 % See the \pkg{biblatex-sbl} package documentation for a full description of
199 % supported options and usage.
200 %
201 % \begin{function}{sblfonts}
202 % \begin{syntax}
203 % sblfonts = \marg{arguments}
204 % \end{syntax}
205 % Options to pass to the \pkg{sblfonts} package.
206 % \end{function}
207 %
208 % The defaults depend on whether the engine in use is 8bit or Unicode:
209 % \begin{description}
210 % \item[8bit defaults:] \mbox{}\\
211 % |{|\\
212 % \strut\quad |mainfont=tempora,|\\
213 % \strut\quad |grfont=Alegreya-LF,|\\
214 % \strut\quad |hefont=frank|\\
215 % |}|
216 % \item[Unicode defaults:] \mbox{}\\
217 % |{|\\
218 % \strut\quad |mainfont=TeXGyreTermesX,|\\
219 % \strut\quad |mainfontoptions={Extension=.otf, UprightFont=*-Regular,|\\
220 % \strut\qquad |ItalicFont=*-Italic, BoldFont=*-Bold,|\\
221 % \strut\qquad |BoldItalicFont=*-BoldItalic},|\\
222 % \strut\quad |sblfonts=true|\\
223 % |}|
224 % \end{description}
225 %
226 % Note that you will need to download and install the SBL fonts yourself from
227 % \url{https://www.sbl-site.org/resources/fonts/}.
228 %
229 % \section{Implementation}
230 %
231 % \setlength{\parindent}{0em}
232 %
233 % \begin{macrocode}
234 %<*class>
235 %<@@=sblreport>
236 % \end{macrocode}
237 %
238 % \begin{macrocode}
239 \NeedsTeXFormat{LaTeX2e}
240 \ProvidesExplClass{sblreport}{2026-04-04}{1.0}
241 {Society of Biblical Literature Report Class (DCP)}
242 % \end{macrocode}
243 %
244 % \begin{macrocode}
245 \clist_new:N \l_@@_options_to_report_class_clist
246 % \end{macrocode}
247 %
248 % \begin{macrocode}
249 \keys_define:nn { sblreport }
250 {
251 , biblatex .clist_set:N = \l_@@_options_to_biblatex_clist
252 , sblfonts .clist_set:N = \l_@@_options_to_sblfonts_clist
253 , unknown .code:n = {
254 \clist_put_right:No
255 \l_@@_options_to_report_class_clist
256 { \CurrentOption }
257 }
258 }
259 % \end{macrocode}
260 %
261 % \begin{macrocode}
262 \ProcessKeyOptions
263 % \end{macrocode}
264 %
265 % Set default options.
266 %
267 % \begin{macrocode}
268 \clist_put_left:Nn \l_@@_options_to_report_class_clist
269 {
270 , 12pt
271 , titlepage
272 }
273 % \end{macrocode}
274 %
275 % \begin{macrocode}
276 \clist_put_left:Nn \l_@@_options_to_biblatex_clist
277 {
278 , style = sbl
279 , language = auto
280 , autolang = hyphen
281 }
282 % \end{macrocode}
283 %
284 % \begin{macrocode}
285 \sys_if_engine_opentype:TF
286 {
287 \clist_put_left:Nn \l_@@_options_to_sblfonts_clist
288 {
289 , mainfont = TeXGyreTermesX
290 , mainfontoptions = {
291 , Extension = .otf
292 , UprightFont = *-Regular
293 , ItalicFont = *-Italic
294 , BoldFont = *-Bold
295 , BoldItalicFont = *-BoldItalic
296 }
297 , sblfonts = true
298 }
299 }
300 {
301 \clist_put_left:Nn \l_@@_options_to_sblfonts_clist
302 {
303 , mainfont = tempora
304 , grfont = Alegreya-LF
305 , hefont = frank
306 }
307 }
308 % \end{macrocode}
309 %
310 % Load report class.
311 %
312 % \begin{macrocode}
313 \exp_args:No \PassOptionsToClass
314 { \l_@@_options_to_report_class_clist }
315 { report }
316 \LoadClass { report }
317 % \end{macrocode}
318 %
319 % Font and language set up.
320 %
321 % \begin{macrocode}
322 \exp_args:No \PassOptionsToPackage
323 { \l_@@_options_to_sblfonts_clist }
324 { sblfonts }
325 \RequirePackage { sblfonts }
326 % \end{macrocode}
327 %
328 % \pkg{biblatex} set up.
329 %
330 % \begin{macrocode}
331 \exp_args:No \PassOptionsToPackage
332 { \l_@@_options_to_biblatex_clist }
333 { biblatex }
334 \RequirePackage { biblatex }
335 \RequirePackage { csquotes }
336 % \end{macrocode}
337 %
338 % \subsection{Margins}
339 %
340 % \begin{macrocode}
341 \RequirePackage [ margin = 1in, headheight = 14.5pt ] { geometry }
342 % \end{macrocode}
343 %
344 % \subsection{Text layout}
345 %
346 % \begin{macrocode}
347 \RequirePackage { setspace }
348 \RequirePackage { ragged2e }
349 \doublespacing
350 \frenchspacing
351 \dim_set:Nn \RaggedRightParindent { 0.5in }
352 \dim_set:Nn \RaggedLeftParindent { 0.5in }
353 \dim_set:Nn \JustifyingParindent { 0.5in }
354 \RaggedRight
355 \sloppy
356 \raggedbottom
357 \sys_if_engine_luatex:F
358 {
359 \AddBabelHook [ hebrew ] { sblreport } { afterextras }
360 {
361 \raggedleft
362 \parindent 0.5in
363 }
364 \AddBabelHook { sblreport } { afterextras } { \RaggedRight }
365 }
366 % \end{macrocode}
367 %
368 % \subsection{Headers and footers}
369 %
370 % \begin{macrocode}
371 \RequirePackage { fancyhdr }
372 \pagestyle { fancy }
373 \fancyhf { }
374 \fancyhead [ R ] { \thepage }
375 \cs_set_nopar:Npn \headrulewidth { 0pt }
376 \cs_set_nopar:Npn \sectionmark #1
377 {
378 \markboth
379 { \int_compare:nNnT
380 { \c@secnumdepth } > { \c_zero_int }
381 { \thesection \skip_horizontal:n { 1em } }
382 #1
383 }
384 { }
385 }
386 % \end{macrocode}
387 %
388 % \subsection{Footnotes}
389 %
390 % Different handling is required for footnotes when tagging code is loaded.
391 %
392 % \begin{macrocode}
393 \IfDocumentMetadataTF
394 {
395 \hook_gput_code:nnn { fntext / para } { sblreport }
396 { \RaggedRight }
397 \socket_new_plug:nnn { fntext / mark } { sblreport }
398 {
399 \skip_horizontal:N \footnotemargin
400 \@thefnmark . \enspace
401 }
402 \socket_assign_plug:nn { fntext / mark } { sblreport }
403 \socket_assign_plug:nn
404 { build / column / outputbox }
405 { floats-space-footnotes }
406 }
407 {
408 \RequirePackage [ bottom, ragged ] { footmisc }
409 \cs_set:Npn \@makefntext #1
410 {
411 \dim_set_eq:NN \parindent \footnotemargin
412 \@thefnmark . \enspace
413 \footnotelayout #1
414 }
415 }
416 % \end{macrocode}
417 %
418 % \begin{macrocode}
419 \dim_set:Nn \footnotemargin { 0.5in }
420 \cs_set:Npn \footnoterule
421 {
422 \kern -3pt
423 \hrule width 2in
424 \kern 2.6pt
425 \vskip -8pt
426 }
427 \dim_set:Nn \footnotesep { 20pt }
428 % \end{macrocode}
429 %
430 % \subsection{Captions}
431 %
432 % \begin{macrocode}
433 \skip_set:Nn \abovecaptionskip { 6pt }
434 \skip_set:Nn \belowcaptionskip { 6pt }
435 \cs_set:Npn \thefigure
436 {
437 \arabic { figure }
438 }
439 \cs_set:Npn \thetable
440 {
441 \arabic { table }
442 }
443 \counterwithout { figure } { chapter }
444 \counterwithout { table } { chapter }
445 % \end{macrocode}
446 %
447 % \begin{macrocode}
448 \IfDocumentMetadataTF
449 {
450 \NewSocketPlug { caption / label } { sblreport }
451 {
452 \small
453 #1:~
454 }
455 \AssignSocketPlug { caption / label } { sblreport }
456 }
457 {
458 \RequirePackage [ font = small , skip = 6pt ] { caption }
459 }
460 % \end{macrocode}
461 %
462 % \subsection{Block quotes}
463 %
464 % \begin{macrocode}
465 \IfDocumentMetadataTF
466 {
467 \hook_gput_code:nnn { begindocument / before } { sblreport }
468 {
469 \RenewDocumentEnvironment { quotation } { !O { } }
470 {
471 \UseInstance { blockenv } { quotation }
472 {
473 , begin-extra-vspace = 0pt
474 , begin-vspace = 0pt
475 , left-margin = 0.5in
476 , right-margin = 0pt
477 , para-indent = 0.5in
478 , para-vspace = 0pt
479 , final-code = \singlespacing
480 \vspace* { -5pt }
481 \ignorespaces
482 , #1
483 }
484 }
485 { \endblockenv }
486 \RenewDocumentEnvironment { quote } { !O { } }
487 {
488 \UseInstance { blockenv } { quote }
489 {
490 , begin-extra-vspace = 0pt
491 , begin-vspace = 0pt
492 , left-margin = 0.5in
493 , right-margin = 0pt
494 , para-indent = 0pt
495 , para-vspace = 7pt
496 , final-code = \singlespacing
497 \vspace* { -5pt }
498 \ignorespaces
499 , #1
500 }
501 }
502 { \endblockenv }
503 }
504 }
505 {
506 \renewenvironment { quotation }
507 {
508 \list { }
509 {
510 \dim_set:Nn \leftmargin { 0.5in }
511 \dim_zero:N \rightmargin
512 \dim_zero:N \topsep
513 \dim_zero:N \partopsep
514 \dim_zero:N \itemsep
515 \dim_zero:N \parsep
516 \dim_set:Nn \itemindent { 0.5in }
517 \dim_set:Nn \listparindent { 0.5in }
518 }
519 \item \relax
520 \singlespacing
521 \vspace* { -5pt }
522 }
523 {
524 \endlist
525 }
526 % \end{macrocode}
527 %
528 % \begin{macrocode}
529 \renewenvironment { quote }
530 {
531 \list { }
532 {
533 \dim_set:Nn \leftmargin { 0.5in }
534 \dim_zero:N \rightmargin
535 \dim_zero:N \topsep
536 \dim_zero:N \partopsep
537 \dim_zero:N \itemsep
538 \dim_set:Nn \parsep { 7pt }
539 \dim_zero:N \itemindent
540 \dim_zero:N \listparindent
541 }
542 \item \relax
543 \singlespacing
544 \vspace* { -5pt }
545 }
546 {
547 \endlist
548 }
549 }
550 % \end{macrocode}
551 %
552 % \subsection{Title page}
553 %
554 % \begin{macrocode}
555 \tl_new:N \g_@@_degree_tl
556 \tl_new:N \g_@@_institution_tl
557 % \end{macrocode}
558 %
559 % \begin{macrocode}
560 \cs_new_protected:Npn \degree #1
561 {
562 \tl_gset:Nn \g_@@_degree_tl { #1 }
563 }
564 % \end{macrocode}
565 %
566 % \begin{macrocode}
567 \cs_new_protected:Npn \institution #1
568 {
569 \tl_gset:Nn \g_@@_institution_tl { #1 }
570 }
571 % \end{macrocode}
572 %
573 % \begin{macrocode}
574 \author { [Your ~ Name] }
575 \title { Title ~ of ~ Paper }
576 \tl_gset:Nn \g_@@_degree_tl { [Degree ~ Name] }
577 \tl_gset:Nn \g_@@_institution_tl { [Name ~ of ~ Institution] }
578 % \end{macrocode}
579 %
580 % \begin{macrocode}
581 \cs_set_protected:Npn \maketitle
582 {
583 \newgeometry { top=2in, bottom=2in }
584 \pagenumbering { roman }
585 \thispagestyle { empty }
586 \group_begin:
587 \singlespacing
588 \centering
589 \MakeUppercase { \g_@@_institution_tl } \para_end:
590 \vfill
591 \doublespacing
592 \MakeUppercase { \@title } \para_end:
593 \vfill
594 \singlespacing
595 \MakeUppercase { Submitted ~ to ~ the ~ Faculty } \para_end:
596 \MakeUppercase { in ~ Partial ~ Fulfilment ~ of ~ the } \para_end:
597 \MakeUppercase { Requirements ~ for ~ the ~ Degree } \para_end:
598 \MakeUppercase { \g_@@_degree_tl } \para_end:
599 \vfill
600 \MakeUppercase { By } \para_end:
601 \MakeUppercase { \@author } \para_end:
602 \MakeUppercase { \@date } \para_end:
603 \group_end:
604 \restoregeometry
605 }
606 % \end{macrocode}
607 %
608 % \subsection{Front matter environments}
609 %
610 % \begin{macrocode}
611 \RenewDocumentEnvironment { abstract } { }
612 {
613 \chapter* { \abstractname }
614 \addcontentsline { toc } { chapter } { \abstractname }
615 }
616 { }
617 % \end{macrocode}
618 %
619 % \begin{macrocode}
620 \cs_set_nopar:Npn \acknowledgementsname { Acknowledgements }
621 \NewDocumentEnvironment { acknowledgements } { }
622 {
623 \chapter* { \acknowledgementsname }
624 \addcontentsline { toc } { chapter } { \acknowledgementsname }
625 }
626 { }
627 % \end{macrocode}
628 %
629 % \begin{macrocode}
630 \cs_set_nopar:Npn \prefacename { Preface }
631 \NewDocumentEnvironment { preface } { }
632 {
633 \chapter* { \prefacename }
634 \addcontentsline { toc } { chapter } { \prefacename }
635 }
636 { }
637 % \end{macrocode}
638 %
639 % \begin{macrocode}
640 \NewDocumentEnvironment { copyrightpage } { }
641 {
642 \clearpage
643 \thispagestyle { empty }
644 }
645 { }
646 % \end{macrocode}
647 %
648 % \begin{macrocode}
649 \NewDocumentEnvironment { approvalpage } { }
650 {
651 \clearpage
652 \thispagestyle { empty }
653 }
654 { }
655 % \end{macrocode}
656 %
657 % \begin{macrocode}
658 \NewDocumentEnvironment { dedication } { }
659 {
660 \clearpage
661 \thispagestyle { empty }
662 }
663 { }
664 % \end{macrocode}
665 %
666 % \begin{macrocode}
667 \NewDocumentEnvironment { epigraph } { }
668 {
669 \clearpage
670 \thispagestyle { empty }
671 }
672 { }
673 % \end{macrocode}
674 %
675 % \subsection{Section titles}
676 %
677 % These two functions ensure consistent spacing after section headings whether
678 % body paragraph text follows or another section heading follows.
679 %
680 % \begin{macrocode}
681 \cs_new_nopar:Nn \@@_before_head_correction:
682 {
683 \hook_gclear_next_code:n { para / before }
684 }
685 % \end{macrocode}
686 %
687 % \begin{macrocode}
688 \cs_new_nopar:Nn \@@_after_head_correction:
689 {
690 \vspace* { -5.5pt }
691 \hook_gput_next_code:nn { para / before } { \vspace* { 5.5pt } }
692 }
693 % \end{macrocode}
694 %
695 % For documents using \cs{DocumentMetadata} use standard kernel commands to
696 % redefine section headings, otherwise use the \pkg{titlesec} package.
697 %
698 % \begin{macrocode}
699 \IfDocumentMetadataTF
700 {
701 \cs_set:Npn \section
702 {
703 \hook_gput_next_code:nn { para / end }
704 { \dim_zero:N \hangindent }
705 \@@_before_head_correction:
706 \hook_gput_next_code:nn { para / after }
707 { \@@_after_head_correction: }
708 \@startsection { section } { 1 } { 0pt } { -37pt } { 1sp }
709 { \singlespacing \normalfont \normalsize \bfseries \centering }
710 }
711 \cs_set:Npn \subsection
712 {
713 \hook_gput_next_code:nn { para / end }
714 { \dim_zero:N \hangindent }
715 \@@_before_head_correction:
716 \hook_gput_next_code:nn { para / after }
717 { \@@_after_head_correction: }
718 \@startsection { subsection } { 2 } { 0pt } { -37pt } { 1sp }
719 { \singlespacing \normalfont \normalsize \centering }
720 }
721 \cs_set:Npn \subsubsection
722 {
723 \@@_before_head_correction:
724 \hook_gput_next_code:nn { para / after }
725 { \@@_after_head_correction: }
726 \@startsection { subsubsection } { 3 } { 0pt } { -37pt } { 1sp }
727 { \singlespacing \normalfont \normalsize \bfseries \itshape }
728 }
729 \cs_set:Npn \paragraph
730 {
731 \@@_before_head_correction:
732 \hook_gput_next_code:nn { para / end } { \strut }
733 \@startsection { paragraph } { 4 } { 0pt } { -37pt } { 1sp }
734 { \singlespacing \normalfont \normalsize }
735 }
736 \cs_set:Npn \subparagraph
737 {
738 \@startsection { subparagraph } { 5 } { 0pt } { -37pt } { -1em }
739 { \singlespacing \normalfont \normalsize \bfseries }
740 }
741 % \end{macrocode}
742 %
743 % Redefine \cs{@chapter} and \cs{@schapter} to format chapter headings.
744 %
745 % \begin{macrocode}
746 \cs_set_nopar:Npn \@chapter [#1]#2
747 {
748 \@@_if_page_numbering:nT { roman }
749 { \pagenumbering { arabic } }
750 \mode_leave_vertical:
751 \par
752 \addvspace { 37pt }
753 \int_compare:nNnTF { \c@secnumdepth } > { -1 }
754 {
755 \refstepcounter { chapter }
756 \addcontentsline { toc } { chapter }
757 { \chaptername \space \thechapter : \enspace #1 }
758 }
759 {
760 \addcontentsline { toc } { chapter } {#1}
761 }
762 \group_begin:
763 \dim_zero:N \parindent
764 \centering
765 \interlinepenalty 10000
766 \normalfont
767 \int_compare:nNnT { \c@secnumdepth } > { -1 }
768 {
769 \MakeUppercase { \chaptername } \nobreakspace \thechapter
770 \par
771 \nobreak
772 }
773 \singlespacing
774 \MakeUppercase {#2}
775 \hook_gput_next_code:nn { para / after }
776 { \@@_after_head_correction: }
777 \markboth { } { }
778 \par
779 \group_end:
780 \nobreak
781 \skip_vertical:n { 39pt }
782 \@afterheading
783 }
784 % \end{macrocode}
785 %
786 % \begin{macrocode}
787 \cs_set_nopar:Npn \@schapter #1
788 {
789 \mode_leave_vertical:
790 \par
791 \addvspace { 37pt }
792 \group_begin:
793 \dim_zero:N \parindent
794 \centering
795 \interlinepenalty 10000
796 \normalfont
797 \singlespacing
798 \MakeUppercase {#1}
799 \hook_gput_next_code:nn { para / after }
800 { \@@_after_head_correction: }
801 \par
802 \group_end:
803 \nobreak
804 \skip_vertical:n { 39pt }
805 \@afterheading
806 }
807 }
808 {
809 \RequirePackage { titlesec }
810 % \end{macrocode}
811 %
812 % \begin{macrocode}
813 \titlespacing* { \chapter } { 0pt } { 41pt } { 37pt }
814 \titlespacing* { \section } { 0pt } { 37pt } { 0pt }
815 \titlespacing* { \subsection } { 0pt } { 37pt } { 0pt }
816 \titlespacing* { \subsubsection } { 0pt } { 37pt } { 0pt }
817 \titlespacing* { \paragraph } { 0pt } { 37pt } { 0pt }
818 \titlespacing* { \subparagraph } { 0pt } { 37pt } { 0pt }
819 % \end{macrocode}
820 %
821 % \begin{macrocode}
822 \titleformat
823 { \chapter }
824 [ display ]
825 { \normalfont \normalsize \singlespacing \filcenter }
826 {
827 \@@_if_page_numbering:nT { roman }
828 { \pagenumbering { arabic } }
829 \MakeUppercase { \chaptername } \space \thechapter
830 }
831 { 12pt }
832 { \MakeUppercase }
833 [ \@@_after_head_correction: ]
834 \titleformat
835 { \section }
836 [ block ]
837 {
838 \@@_before_head_correction:
839 \normalfont \normalsize \singlespacing \bfseries \filcenter
840 }
841 { \thesection }
842 { 0.5em }
843 { }
844 [ \@@_after_head_correction: ]
845 \titleformat
846 { \subsection }
847 [ block ]
848 {
849 \@@_before_head_correction:
850 \normalfont \normalsize \singlespacing \filcenter
851 }
852 { \thesubsection }
853 { 0.5em }
854 { }
855 [ \@@_after_head_correction: ]
856 \titleformat
857 { \subsubsection }
858 [ block ]
859 {
860 \@@_before_head_correction:
861 \normalfont \normalsize \singlespacing \bfseries \itshape \filright
862 }
863 { \thesubsubsection }
864 { 0.5em }
865 { }
866 [ \@@_after_head_correction: ]
867 \titleformat
868 { \paragraph }
869 [ block ]
870 {
871 \@@_before_head_correction:
872 \normalfont \normalsize \singlespacing \filright
873 }
874 { \theparagraph }
875 { 0.5em }
876 { }
877 \titleformat
878 { \subparagraph }
879 [ runin ]
880 { \normalfont \normalsize \bfseries }
881 { \thesubparagraph }
882 { 1em }
883 { }
884 }
885 % \end{macrocode}
886 %
887 % \subsection{Table of contents and list of figures/tables}
888 %
889 % \begin{macrocode}
890 \int_set:Nn \c@tocdepth { 2 }
891 % \end{macrocode}
892 %
893 % \begin{macrocode}
894 \hook_gput_code:nnn { cmd / @starttoc / before } { sblreport }
895 {
896 \hook_gput_next_code:nn { cmd / @input / before }
897 { \singlespacing }
898 }
899 % \end{macrocode}
900 %
901 % \begin{macrocode}
902 \cs_set:Npn \tableofcontents
903 {
904 \chapter* { \contentsname }
905 \@mkboth
906 { \contentsname }
907 { \contentsname }
908 \@starttoc { toc }
909 }
910 % \end{macrocode}
911 %
912 % \begin{macrocode}
913 \cs_set:Npn \listoffigures
914 {
915 \chapter* { \listfigurename }
916 \addcontentsline { toc } { chapter } { \listfigurename }
917 \@mkboth
918 { \listfigurename }
919 { \listfigurename }
920 \@starttoc { lof }
921 }
922 % \end{macrocode}
923 %
924 % \begin{macrocode}
925 \cs_set:Npn \listoftables
926 {
927 \chapter* { \listtablename }
928 \addcontentsline { toc } { chapter } { \listtablename }
929 \@mkboth
930 { \listtablename }
931 { \listtablename }
932 \@starttoc { lot }
933 }
934 % \end{macrocode}
935 %
936 % For documents using \cs{DocumentMetadata} use standard kernel commands to
937 % redefine table of contents lines, otherwise use the \pkg{titletoc} package.
938 %
939 % \begin{macrocode}
940 \IfDocumentMetadataTF
941 {
942 \text_declare_expand_equivalent:Nn \numberline
943 {
944 \exp_not:n { \numberline }
945 }
946 \hook_gput_code:nnn { cmd / @dottedtocline / before }
947 { sblreport }
948 {
949 \addvspace { \baselineskip }
950 }
951 \hook_gput_code_with_args:nnn { contentsline / text / after }
952 { sblreport }
953 {
954 \int_compare:nNnT {#1} > { -1 }
955 {
956 \cs_set_nopar:Npn \leaders ##1 ##2 { }
957 \hook_gput_next_code:nn { cmd / SuspendTagging / after }
958 {
959 \cs_set_nopar:Npn \leaders ##1 ##2 { }
960 }
961 }
962 }
963 \cs_set_nopar:cpn { contentsline@text@0@format }
964 { \MakeUppercase }
965 \cs_set_nopar:Npn \numberline #1
966 {
967 \hook_use:nnw { contentsline / number / before } { 1 } {#1}
968 #1 \enspace
969 \hook_use:nnw { contentsline / number / after } { 1 } {#1}
970 }
971 % \end{macrocode}
972 %
973 % \begin{macrocode}
974 \cs_set_nopar:Npn \l@chapter
975 {
976 \@dottedtocline { 0 } { 0em } { 0em }
977 }
978 \cs_set_nopar:Npn \l@section
979 {
980 \@dottedtocline { 1 } { 1em } { 0em }
981 }
982 \cs_set_nopar:Npn \l@subsection
983 {
984 \@dottedtocline { 2 } { 2em } { 0em }
985 }
986 \cs_set_nopar:Npn \l@subsubsection
987 {
988 \@dottedtocline { 3 } { 3em } { 0em }
989 }
990 \cs_set_nopar:Npn \l@paragraph
991 {
992 \@dottedtocline { 4 } { 4em } { 0em }
993 }
994 \cs_set_nopar:Npn \l@subparagraph
995 {
996 \@dottedtocline { 5 } { 5em } { 0em }
997 }
998 \cs_set_nopar:Npn \l@figure
999 {
1000 \@dottedtocline { 1 } { 0em } { 0em }
1001 }
1002 \cs_set_eq:NN \l@table \l@figure
1003 }
1004 {
1005 \RequirePackage { titletoc }
1006 % \end{macrocode}
1007 %
1008 % \begin{macro}{\@@_hyperlink:nn} \marg{link} \marg{text}
1009 %
1010 % \medskip
1011 %
1012 % A convenience version of |\hyperlink| that just uses \meta{text} if
1013 % \pkg{hyperref} isn't loaded.
1014 %
1015 % \begin{macrocode}
1016 \cs_new_protected:Nn \@@_hyperlink:nn
1017 {
1018 \cs_if_exist_use:NTF \hyperlink
1019 { { #1 } { #2 } }
1020 { #2 }
1021 }
1022 % \end{macrocode}
1023 % \end{macro}
1024 %
1025 % \begin{macrocode}
1026 \titlecontents { figure }
1027 [ 0pt ]
1028 { \singlepacing \filright }
1029 {
1030 \@@_hyperlink:nn
1031 { \Hy@tocdestname }
1032 { \makebox [ 2em ] [ r ] { \thecontentslabel . \enspace } }
1033 }
1034 { }
1035 { \hspace { 0.5em } \titlerule* [ 0.5pc ] { . } \contentspage }
1036 \titlecontents { table }
1037 [ 0pt ]
1038 { \singlespacing \filright }
1039 {
1040 \@@_hyperlink:nn
1041 { \Hy@tocdestname }
1042 { \makebox [ 2em ] [ r ] { \thecontentslabel . \enspace } }
1043 }
1044 { }
1045 { \hspace { 0.5em } \titlerule* [ 0.5pc ] { . } \contentspage }
1046 \titlecontents { chapter }
1047 [ 0pt ]
1048 { \singlespacing \filright }
1049 {
1050 \@@_hyperlink:nn
1051 { \Hy@tocdestname }
1052 {
1053 \MakeUppercase { \chaptername } \space
1054 \thecontentslabel : \enspace
1055 }
1056 \MakeUppercase
1057 }
1058 { \MakeUppercase }
1059 { \hspace { 0.5em } \titlerule* [ 0.5pc ] { . } \contentspage }
1060 \titlecontents { section }
1061 [ 1em ]
1062 { \singlespacing \filright }
1063 { }
1064 { }
1065 { \hfill \contentspage }
1066 \titlecontents { subsection }
1067 [ 2em ]
1068 { \singlespacing \filright }
1069 { }
1070 { }
1071 { \hfill \contentspage }
1072 \titlecontents { subsubsection }
1073 [ 3em ]
1074 { \singlespacing \filright }
1075 { }
1076 { }
1077 { \hfill \contentspage }
1078 \titlecontents { paragraph }
1079 [ 4em ]
1080 { \singlespacing \filright }
1081 { }
1082 { }
1083 { \hfill \contentspage }
1084 \titlecontents { subparagraph }
1085 [ 5em ]
1086 { \singlespacing \filright }
1087 { }
1088 { }
1089 { \hfill \contentspage }
1090 }
1091 % \end{macrocode}
1092 %
1093 % \subsection{Appendices}
1094 %
1095 % Set up appendix headings and table of contents.
1096 %
1097 % \begin{macrocode}
1098 \cs_set_eq:NN \sblreport@hyperlink \@@_hyperlink:nn
1099 \newcounter { sblreport@appendix@count }
1100 % \end{macrocode}
1101 %
1102 % \begin{macrocode}
1103 \cs_new_protected:Nn \@@_set_up_appendices:
1104 {
1105 \cs_set_nopar:Npn \chaptername { \appendixname }
1106 \addtocontents { toc } { \def \protect \chaptername { \appendixname } }
1107 \int_compare:nNnT { \c@sblreport@appendix@count } = { \c_one_int }
1108 {
1109 \int_zero:N \c@sblreport@appendix@count
1110 }
1111 \IfDocumentMetadataTF
1112 {
1113 \cs_set_nopar:Npn \@chapter [##1]##2
1114 {
1115 \mode_leave_vertical:
1116 \par
1117 \addvspace { 37pt }
1118 \stepcounter { sblreport@appendix@count }
1119 \int_compare:nNnTF { \c@secnumdepth } > { -1 }
1120 {
1121 \refstepcounter { chapter }
1122 \protected@write \@auxout
1123 { }
1124 {
1125 \string \setcounter
1126 { sblreport@appendix@count } { \the \c@chapter }
1127 }
1128 \addcontentsline { toc } { chapter }
1129 {
1130 \chaptername
1131 \ifnum \c@sblreport@appendix@count > 1
1132 \space \thechapter
1133 \fi
1134 : \enspace ##1
1135 }
1136 }
1137 {
1138 \addcontentsline { toc } { chapter } {##1}
1139 }
1140 \group_begin:
1141 \dim_zero:N \parindent
1142 \centering
1143 \interlinepenalty 10000
1144 \normalfont
1145 \int_compare:nNnT { \c@secnumdepth } > { -1 }
1146 {
1147 \MakeUppercase { \chaptername }
1148 \int_compare:nNnT
1149 { \c@sblreport@appendix@count } > { \c_one_int }
1150 {
1151 \nobreakspace \thechapter
1152 }
1153 \par
1154 \nobreak
1155 }
1156 \singlespacing
1157 \MakeUppercase {##2}
1158 \hook_gput_next_code:nn { para / after }
1159 { \@@_after_head_correction: }
1160 \markboth { } { }
1161 \par
1162 \group_end:
1163 \nobreak
1164 \skip_vertical:n { 39pt }
1165 \@afterheading
1166 }
1167 }
1168 {
1169 \titleformat
1170 { \chapter }
1171 [ display ]
1172 {
1173 \stepcounter { sblreport@appendix@count }
1174 \protected@write \@auxout
1175 { }
1176 {
1177 \protect \setcounter
1178 { sblreport@appendix@count } { \the \c@chapter }
1179 }
1180 \singlespacing \normalfont \normalsize \filcenter
1181 }
1182 {
1183 \MakeUppercase { \chaptername }
1184 \ifnum \c@sblreport@appendix@count > 1
1185 \strut \space \thechapter
1186 \fi
1187 }
1188 { 12pt }
1189 { \MakeUppercase }
1190 \titlecontents { chapter }
1191 [ 0pt ]
1192 { \singlespacing \filright }
1193 {
1194 \sblreport@hyperlink
1195 { \Hy@tocdestname }
1196 {
1197 \MakeUppercase { \chaptername }
1198 \ifnum \c@sblreport@appendix@count > 1
1199 \strut \space \thecontentslabel
1200 \fi
1201 : \enspace
1202 }
1203 \MakeUppercase
1204 }
1205 { \MakeUppercase }
1206 { \hspace { 0.5em } \titlerule* [ 0.5pc ] { . } \contentspage }
1207 }
1208 }
1209 % \end{macrocode}
1210 %
1211 % \begin{macrocode}
1212 \hook_gput_code:nnn
1213 { cmd / appendix / after }
1214 { sblreport }
1215 { \@@_set_up_appendices: }
1216 % \end{macrocode}
1217 %
1218 % \subsection{Bibliography and list of abbreviations}
1219 %
1220 % \begin{macrocode}
1221 \DefineBibliographyStrings { english }
1222 {
1223 shorthands = { List~of~Abbreviations }
1224 }
1225 \cs_set_nopar:Npn \bibsetup { \singlespacing }
1226 \dim_set:Nn \bibhang { 0.5in }
1227 \dim_set:Nn \bibitemsep { 12pt }
1228 \dim_set:Nn \biblabelsep { 0.5in }
1229 % \end{macrocode}
1230 %
1231 % \subsection{Helper functions}
1232 %
1233 % \begin{macro}{\@@_if_page_numbering:nT} \marg{numbering style}
1234 % \marg{code if true}
1235 %
1236 % \medskip
1237 %
1238 % Test if the current page numbering style matches a particular style.
1239 % (e.g., |arabic| or |roman|).
1240 %
1241 % \begin{macrocode}
1242 \prg_new_conditional:Npnn \@@_if_page_numbering:n #1 { T }
1243 {
1244 \cs_set_nopar:Nn \@@_thepage_test:
1245 { \csname @ #1 \endcsname \c@page }
1246 \if_meaning:w \thepage \@@_thepage_test:
1247 \prg_return_true:
1248 \else:
1249 \prg_return_false:
1250 \fi:
1251 }
1252 % \end{macrocode}
1253 % \end{macro}
1254 %
1255 % \begin{macrocode}
1256 \endinput
1257 % \end{macrocode}
1258 %
1259 % \begin{macrocode}
1260 %</class>
1261 % \end{macrocode}