% \iffalse meta-comment % % Copyright (c) 2026 David Purton % % This work may be distributed and/or modified under the conditions of % the LaTeX Project Public License, either version 1.3c of this license % or (at your option) any later version. The latest version of this % license is in % http://www.latex-project.org/lppl.txt % and version 1.3c or later is part of all distributions of LaTeX % version 2005/12/01 or later. % %<*driver> \RequirePackage{pdfmanagement} \documentclass[a4paper]{l3doc} \usepackage[T1]{fontenc} \usepackage{microtype} \usepackage{mlmodern} \usepackage[font=small, skip=6pt]{caption} \usepackage{xcolor} \usepackage{listings} \AddToHook{env/macrocode/before}{% \addvspace{\medskipamount}} \AddToHook{env/macro/before}{% \addvspace{\medskipamount}} \begin{document} \DocInput{\jobname.dtx} \end{document} % % \fi % % \title{The \pkg{sblreport} Class} % \author{David Purton\thanks{Email: \url{dcpurton@marshwiggle.net}}} % \date{2026-07-22 v1.1} % % \maketitle % % \begin{abstract} % \pkg{sblreport} provides a LaTeX class for producing theses conforming to % the style required by the Society of Biblical Literature. It depends on % \pkg{sblfonts} for language support and \pkg{biblatex-sbl} for % referencing. % \end{abstract} % % \tableofcontents % % \section{Introduction} % % The \pkg{sblreport} class creates a thesis matching the style specified % in the \emph{Student Supplement for \emph{The SBL Handbook of Style}, Second % Edition}. See % \url{https://www.sbl-site.org/wp-content/uploads/2025/04/SBLHSsupp2015-02.pdf}. % % The class works with both |pdflatex| and the Unicode engines, but in order % to make use of the SBL fonts you need to install them and use a Unicode % engine (|lualatex| is recommended, especially for Hebrew). % % This class is not intended to be a general flexible starting point for the % requirements of all theological colleges and seminaries. In such cases you % are better off beginning with the \pkg{report} class and loading % \pkg{biblatex-sbl} and (possibly) \pkg{sblfonts} directly. You could use the % code in this class as a guide. % % \subsection{Usage} % % Load the class using |\documentclass{sblreport}|. See |sbltex-thesis.pdf| in % the documentation directory for an extended usage example. % % The following standard commands and environments have been customised for % this class: % \begin{itemize} % \item |\author|, |\title|, |\maketitle| % \item |\tableofcontents|, |\listoffigure|, |\listoftables| % \item |\section|, |\subsection|, |\subsubsection|, |\paragraph|, % |\subparagraph| % \item |\appendix| % \item |\footnote| % \item |\caption| % \item |\printbibliography|, |\printbiblist{abbreviations}| % \item |abstract|, |quotation|, |quote| % \end{itemize} % % American, Greek and Hebrew are set up using \pkg{sblfonts} (and % \pkg{babel}). A different main language can be chosen by passing the % \pkg{babel} language name to the class. % % \subsection{Acknowledgements} % % The \pkg{sblreport} class depends on a number of other packages: % \begin{itemize} % \item \pkg{sblfonts} (with \pkg{fontspec}, \pkg{fontenc} and \pkg{babel}), % \pkg{biblatex-sbl} (with \pkg{biblatex}) % \item \pkg{csquotes}, \pkg{geometry}, \pkg{setspace}, \pkg{ragged2e}, % \pkg{fancyhdr} % \item When \cs{DocumentMetadata} is not in use: \pkg{caption}, % \pkg{footmisc}, \pkg{titlesec}, \pkg{titletoc} % \end{itemize} % % \subsection{Bug Reports and Feature Requests} % % Bug reports and feature requests can be made at the \pkg{sbltex} % GitHub repository. See \url{https://github.com/dcpurton/sbltex}. % % \begin{description} % \item[Note:] This class is compatible with the \LaTeX{} tagging project at % release time. Although, regular updates will continue to be needed as the % tagging project evolves and improves. The demonstration thesis, % |sbltex-thesis.pdf| in the documentation is built with tagging enabled and % successfully verifies with VeraPDF. % \end{description} % % \section{Package Commands} % % \begin{function}{\degree} % \begin{syntax} % |\degree| \marg{Degree name} % \end{syntax} % Set the name of the degree the thesis is for. This is included on the % title page. % \end{function} % % \begin{function}{\institution} % \begin{syntax} % |\institution| \marg{Institution name} % \end{syntax} % Set the name of the institution the thesis will be submitted at. This is % included on the title page. % \end{function} % % \section{Package Environments} % % \begin{function}{acknowledgements} % \begin{syntax} % |\begin| \marg{acknowledgements} % |\end| \marg{acknowledgements} % \end{syntax} % Add an Acknowledgements page to the thesis. The name of the section can be % changed by redefining |\acknowledgementsname|. % \end{function} % % \begin{function}{approvalpage} % \begin{syntax} % |\begin| \marg{approvalpage} % |\end| \marg{approvalpage} % \end{syntax} % Add an approval page to the thesis. This page is empty by default. % \end{function} % % \begin{function}{copyrightpage} % \begin{syntax} % |\begin| \marg{copyrightpage} % |\end| \marg{copyrightpage} % \end{syntax} % Add a copyright page to the thesis. This page is empty by default. % \end{function} % % \begin{function}{dedication} % \begin{syntax} % |\begin| \marg{dedication} % |\end| \marg{dedication} % \end{syntax} % Add a dedication to the thesis. This page is empty by default. % \end{function} % % \begin{function}{epigraph} % \begin{syntax} % |\begin| \marg{epigraph} % |\end| \marg{epigraph} % \end{syntax} % Add an epigraph to the thesis. This page is empty by default. % \end{function} % % \begin{function}{preface} % \begin{syntax} % |\begin| \marg{preface} % |\end| \marg{preface} % \end{syntax} % Add an Preface to the thesis. The name of the section can be changed by % redefining |\prefacename|. % \end{function} % % \section{Package Options} % % Items passed to the options below are \emph{appended} to the default options % rather than replacing them. % % Any unrecognised options passed to the \pkg{sblreport} class are passed % through to the \pkg{report} class. % % \begin{function}{biblatex} % \begin{syntax} % biblatex = \marg{arguments}\hfill Default: \{style=sbl, language=auto, autolang=hyphen\} % \end{syntax} % These options are passed to the \pkg{biblatex} package. % \end{function} % % See the \pkg{biblatex-sbl} package documentation for a full description of % supported options and usage. % % \begin{function}{sblfonts} % \begin{syntax} % sblfonts = \marg{arguments} % \end{syntax} % Options to pass to the \pkg{sblfonts} package. % \end{function} % % The defaults depend on whether the engine in use is 8bit or Unicode: % \begin{description} % \item[8bit defaults:] \mbox{}\\ % |{|\\ % \strut\quad |mainfont=tempora,|\\ % \strut\quad |grfont=Alegreya-LF,|\\ % \strut\quad |hefont=frank|\\ % |}| % \item[Unicode defaults:] \mbox{}\\ % |{|\\ % \strut\quad |mainfont=TeXGyreTermesX,|\\ % \strut\quad |mainfontoptions={Extension=.otf, UprightFont=*-Regular,|\\ % \strut\qquad |ItalicFont=*-Italic, BoldFont=*-Bold,|\\ % \strut\qquad |BoldItalicFont=*-BoldItalic},|\\ % \strut\quad |sblfonts=true|\\ % |}| % \end{description} % % Note that you will need to download and install the SBL fonts yourself from % \url{https://www.sbl-site.org/resources/fonts/}. % % \section{Implementation} % % \setlength{\parindent}{0em} % % \begin{macrocode} %<*class> %<@@=sblreport> % \end{macrocode} % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \ProvidesExplClass{sblreport}{2026-07-22}{1.1} {Society of Biblical Literature Report Class (DCP)} % \end{macrocode} % % \begin{macrocode} \clist_new:N \l_@@_options_to_report_class_clist % \end{macrocode} % % \begin{macrocode} \keys_define:nn { sblreport } { , biblatex .clist_set:N = \l_@@_options_to_biblatex_clist , sblfonts .clist_set:N = \l_@@_options_to_sblfonts_clist , unknown .code:n = { \clist_put_right:No \l_@@_options_to_report_class_clist { \CurrentOption } } } % \end{macrocode} % % \begin{macrocode} \ProcessKeyOptions % \end{macrocode} % % Set default options. % % \begin{macrocode} \clist_put_left:Nn \l_@@_options_to_report_class_clist { , 12pt , titlepage } % \end{macrocode} % % \begin{macrocode} \clist_put_left:Nn \l_@@_options_to_biblatex_clist { , style = sbl , language = auto , autolang = hyphen } % \end{macrocode} % % \begin{macrocode} \sys_if_engine_opentype:TF { \clist_put_left:Nn \l_@@_options_to_sblfonts_clist { , mainfont = TeXGyreTermesX , mainfontoptions = { , Extension = .otf , UprightFont = *-Regular , ItalicFont = *-Italic , BoldFont = *-Bold , BoldItalicFont = *-BoldItalic } , sblfonts = true } } { \clist_put_left:Nn \l_@@_options_to_sblfonts_clist { , mainfont = tempora , grfont = Alegreya-LF , hefont = frank } } % \end{macrocode} % % Load report class. % % \begin{macrocode} \exp_args:No \PassOptionsToClass { \l_@@_options_to_report_class_clist } { report } \LoadClass { report } % \end{macrocode} % % Font and language set up. % % \begin{macrocode} \exp_args:No \PassOptionsToPackage { \l_@@_options_to_sblfonts_clist } { sblfonts } \RequirePackage { sblfonts } % \end{macrocode} % % \pkg{biblatex} set up. % % \begin{macrocode} \exp_args:No \PassOptionsToPackage { \l_@@_options_to_biblatex_clist } { biblatex } \RequirePackage { biblatex } \RequirePackage { csquotes } % \end{macrocode} % % \subsection{Margins} % % \begin{macrocode} \RequirePackage [ margin = 1in, headheight = 14.5pt ] { geometry } % \end{macrocode} % % \subsection{Text layout} % % \begin{macrocode} \RequirePackage { setspace } \RequirePackage { ragged2e } \doublespacing \frenchspacing \dim_set:Nn \RaggedRightParindent { 0.5in } \dim_set:Nn \RaggedLeftParindent { 0.5in } \dim_set:Nn \JustifyingParindent { 0.5in } \RaggedRight \sloppy \raggedbottom \sys_if_engine_luatex:F { \AddBabelHook [ hebrew ] { sblreport } { afterextras } { \raggedleft \parindent 0.5in } \AddBabelHook { sblreport } { afterextras } { \RaggedRight } } % \end{macrocode} % % \subsection{Headers and footers} % % \begin{macrocode} \RequirePackage { fancyhdr } \pagestyle { fancy } \fancyhf { } \fancyhead [ R ] { \thepage } \cs_set_nopar:Npn \headrulewidth { 0pt } \cs_set_nopar:Npn \sectionmark #1 { \markboth { \int_compare:nNnT { \c@secnumdepth } > { \c_zero_int } { \thesection \skip_horizontal:n { 1em } } #1 } { } } % \end{macrocode} % % \subsection{Footnotes} % % Different handling is required for footnotes when tagging code is loaded. % % \begin{macrocode} \IfDocumentMetadataTF { \hook_gput_code:nnn { fntext / para } { sblreport } { \RaggedRight } \socket_new_plug:nnn { fntext / mark } { sblreport } { \skip_horizontal:N \footnotemargin \@thefnmark . \enspace } \socket_assign_plug:nn { fntext / mark } { sblreport } \socket_assign_plug:nn { build / column / outputbox } { floats-space-footnotes } } { \RequirePackage [ bottom, ragged ] { footmisc } \cs_set_protected:Npn \@makefntext #1 { \dim_set_eq:NN \parindent \footnotemargin \@thefnmark . \enspace \footnotelayout #1 } } % \end{macrocode} % % \begin{macrocode} \dim_set:Nn \footnotemargin { 0.5in } \cs_set:Npn \footnoterule { \kern -3pt \hrule width 2in \kern 2.6pt \vskip -8pt } \dim_set:Nn \footnotesep { 20pt } % \end{macrocode} % % \subsection{Captions} % % \begin{macrocode} \skip_set:Nn \abovecaptionskip { 6pt } \skip_set:Nn \belowcaptionskip { 6pt } \cs_set:Npn \thefigure { \arabic { figure } } \cs_set:Npn \thetable { \arabic { table } } \counterwithout { figure } { chapter } \counterwithout { table } { chapter } % \end{macrocode} % % \begin{macrocode} \IfDocumentMetadataTF { \NewSocketPlug { caption / label } { sblreport } { \small #1:~ } \AssignSocketPlug { caption / label } { sblreport } } { \RequirePackage [ font = small , skip = 6pt ] { caption } } % \end{macrocode} % % \subsection{Block quotes} % % \begin{macrocode} \IfDocumentMetadataTF { \EditInstance { blockenv } { quotation } { , final-code = \singlespacing \vspace* { -5pt } \ignorespaces } \EditInstance { block } { quotation-1 } { , begin-extra-vspace = 0pt , begin-vspace = 0pt , left-margin = 0.5in , right-margin = 0pt , para-indent = 0.5in , para-vspace = 0pt } \EditInstance { blockenv } { quote } { , final-code = \singlespacing \vspace* { -5pt } \ignorespaces } \EditInstance { block } { quote-1 } { , begin-extra-vspace = 0pt , begin-vspace = 0pt , left-margin = 0.5in , right-margin = 0pt , para-indent = 0pt , para-vspace = 7pt } } { \renewenvironment { quotation } { \list { } { \dim_set:Nn \leftmargin { 0.5in } \dim_zero:N \rightmargin \dim_zero:N \topsep \dim_zero:N \partopsep \dim_zero:N \itemsep \dim_zero:N \parsep \dim_set:Nn \itemindent { 0.5in } \dim_set:Nn \listparindent { 0.5in } } \item \relax \singlespacing \vspace* { -5pt } } { \endlist } % \end{macrocode} % % \begin{macrocode} \renewenvironment { quote } { \list { } { \dim_set:Nn \leftmargin { 0.5in } \dim_zero:N \rightmargin \dim_zero:N \topsep \dim_zero:N \partopsep \dim_zero:N \itemsep \dim_set:Nn \parsep { 7pt } \dim_zero:N \itemindent \dim_zero:N \listparindent } \item \relax \singlespacing \vspace* { -5pt } } { \endlist } } % \end{macrocode} % % \subsection{Title page} % % \begin{macrocode} \tl_new:N \g_@@_degree_tl \tl_new:N \g_@@_institution_tl % \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \degree #1 { \tl_gset:Nn \g_@@_degree_tl { #1 } } % \end{macrocode} % % \begin{macrocode} \cs_new_protected:Npn \institution #1 { \tl_gset:Nn \g_@@_institution_tl { #1 } } % \end{macrocode} % % \begin{macrocode} \author { [Your ~ Name] } \title { Title ~ of ~ Paper } \tl_gset:Nn \g_@@_degree_tl { [Degree ~ Name] } \tl_gset:Nn \g_@@_institution_tl { [Name ~ of ~ Institution] } % \end{macrocode} % % \begin{macrocode} \NewTaggingSocket{ sblreport / flatblock / begin } { 1 } \NewTaggingSocket{ sblreport / flatblock / end } { 0 } \NewTaggingSocketPlug { sblreport / flatblock / begin } { default } { \tag_struct_begin:n { tag = #1 } \tagpdfsetup { para / flattened = true } } \NewTaggingSocketPlug { sblreport / flatblock / end } { default } { \para_end: \tag_struct_end: } \AssignTaggingSocketPlug { sblreport / flatblock / begin } { default } \AssignTaggingSocketPlug { sblreport / flatblock / end } { default } % \end{macrocode} % % \begin{macrocode} \cs_set_protected:Npn \maketitle { \newgeometry { top=2in, bottom=2in } \pagenumbering { roman } \thispagestyle { empty } \group_begin: \UseTaggingSocket { sblreport / flatblock / begin } { \UseStructureName { title / block } } \singlespacing \centering \MakeUppercase { \g_@@_institution_tl } \para_end: \vfill \doublespacing \IfDocumentMetadataTF { \UseTaggingSocket { title } { } { \MakeUppercase { \@title } } } { \MakeUppercase { \@title } } \para_end: \vfill \singlespacing \MakeUppercase { Submitted ~ to ~ the ~ Faculty } \para_end: \MakeUppercase { in ~ Partial ~ Fulfilment ~ of ~ the } \para_end: \MakeUppercase { Requirements ~ for ~ the ~ Degree } \para_end: \MakeUppercase { \g_@@_degree_tl } \para_end: \vfill \MakeUppercase { By } \para_end: \MakeUppercase { \@author } \para_end: \MakeUppercase { \@date } \para_end: \UseTaggingSocket { sblreport / flatblock / end } \group_end: \restoregeometry } % \end{macrocode} % % \subsection{Front matter environments} % % \begin{macrocode} \RenewDocumentEnvironment { abstract } { } { \chapter* { \abstractname } \addcontentsline { toc } { chapter } { \abstractname } } { } % \end{macrocode} % % \begin{macrocode} \cs_set_nopar:Npn \acknowledgementsname { Acknowledgements } \NewDocumentEnvironment { acknowledgements } { } { \chapter* { \acknowledgementsname } \addcontentsline { toc } { chapter } { \acknowledgementsname } } { } % \end{macrocode} % % \begin{macrocode} \cs_set_nopar:Npn \prefacename { Preface } \NewDocumentEnvironment { preface } { } { \chapter* { \prefacename } \addcontentsline { toc } { chapter } { \prefacename } } { } % \end{macrocode} % % \begin{macrocode} \NewDocumentEnvironment { copyrightpage } { } { \clearpage \thispagestyle { empty } \UseTaggingSocket { sblreport / flatblock / begin } { text-unit } } { \UseTaggingSocket { sblreport / flatblock / end } } % \end{macrocode} % % \begin{macrocode} \NewDocumentEnvironment { approvalpage } { } { \clearpage \thispagestyle { empty } \UseTaggingSocket { sblreport / flatblock / begin } { text-unit } } { \UseTaggingSocket { sblreport / flatblock / end } } % \end{macrocode} % % \begin{macrocode} \NewDocumentEnvironment { dedication } { } { \clearpage \thispagestyle { empty } \UseTaggingSocket { sblreport / flatblock / begin } { text-unit } } { \UseTaggingSocket { sblreport / flatblock / end } } % \end{macrocode} % % \begin{macrocode} \NewDocumentEnvironment { epigraph } { } { \clearpage \thispagestyle { empty } \UseTaggingSocket { sblreport / flatblock / begin } { text-unit } } { \UseTaggingSocket { sblreport / flatblock / end } } % \end{macrocode} % % \subsection{Section titles} % % \begin{macrocode} \int_set:Nn \c@secnumdepth { 0 } \cs_set_nopar:Npn \thepart { \arabic { part } } % \end{macrocode} % % These two functions ensure consistent spacing after section headings whether % body paragraph text follows or another section heading follows. % % \begin{macrocode} \cs_new_nopar:Nn \@@_before_head_correction: { \hook_gclear_next_code:n { para / before } } % \end{macrocode} % % \begin{macrocode} \cs_new_nopar:Nn \@@_after_head_correction: { \vspace* { -5.5pt } \hook_gput_next_code:nn { para / before } { \vspace* { 5.5pt } } } % \end{macrocode} % % For documents using \cs{DocumentMetadata} use standard kernel commands to % redefine section headings, otherwise use the \pkg{titlesec} package. % % \begin{macrocode} \IfDocumentMetadataTF { \EditInstance { heading } { part } { , heading-decls = \singlespacing \normalfont \normalsize \centering , prefix = \MakeUppercase { \partname } , title-decls = , start-code = \cleardoublepage \thispagestyle { empty } \null \vfil } \EditInstance { headformat } { part } { , title-format = \MakeUppercase {#1} , number-title-sep = 12pt } \DeclareDocumentCommand \part { s = { shorttitle } o m } { \ParseLaTeXeHeading { part } {#1} {#2} {#3} } \EditInstance { heading } { chapter } { , placement = top , after-penalty-vspace = 35.7pt , after-vspace = 37pt , prefix = \MakeUppercase { \chaptername } , heading-decls = \singlespacing \normalfont \normalsize \centering , title-decls = } \EditInstance { headformat } { chapter } { , title-format = \MakeUppercase {#1} , number-title-sep = 12pt } \DeclareDocumentCommand \chapter { s = { shorttitle } o m } { \IfBooleanF {#1} { \@@_if_page_numbering:nT { roman } { \cleardoublepage \pagenumbering { arabic } } } \ParseLaTeXeHeading { chapter } {#1} {#2} {#3} \@@_after_head_correction: } \EditInstance { heading } { section } { , before-vspace = 37pt , after-vspace = 0pt , heading-decls = \singlespacing \normalfont \normalsize \bfseries \centering } \EditInstance { heading } { subsection } { , before-vspace = 37pt , after-vspace = 0pt , heading-decls = \singlespacing \normalfont \normalsize \centering } \EditInstance { heading } { subsubsection } { , before-vspace = 37pt , after-vspace = 0pt , heading-decls = \singlespacing \normalfont \normalsize \bfseries \itshape } \DeclareInstance { heading } { paragraph } { display } { , name = paragraph , parent-name = subsubsection , level = 4 , before-vspace = 37pt , after-vspace = 0pt , heading-decls = \singlespacing \normalfont \normalsize , mark-cmd = \paragraphmark {#1} , headformat-instance = paragraph } \DeclareInstanceCopy { headformat } { paragraph } { std } \EditInstance { heading } { subparagraph } { , before-vspace = 37pt , after-vspace = 1em , heading-decls = \normalfont \normalsize \bfseries } \EditInstance { headformat } { subparagraph } { , heading-indent = 0pt } \hook_gput_code:nnn { cmd / section / before } { sblreport } { \@@_before_head_correction: } \hook_gput_code:nnn { cmd / subsection / before } { sblreport } { \@@_before_head_correction: } \hook_gput_code:nnn { cmd / subsubsection / before } { sblreport } { \@@_before_head_correction: } \hook_gput_code:nnn { cmd / paragraph / before } { sblreport } { \@@_before_head_correction: } \hook_gput_code:nnn { cmd / section / after } { sblreport } { \@@_after_head_correction: } \hook_gput_code:nnn { cmd / subsection / after } { sblreport } { \@@_after_head_correction: } \hook_gput_code:nnn { cmd / subsubsection / after } { sblreport } { \@@_after_head_correction: } } { \RequirePackage [ newparttoc ] { titlesec } % \end{macrocode} % % \begin{macrocode} \titleclass { \part } { page } \assignpagestyle { \part } { empty } % \end{macrocode} % % \begin{macrocode} \titlespacing* { \part } { 0pt } { 0pt } { 0pt } \titlespacing* { \chapter } { 0pt } { 35.7pt } { 37pt } \titlespacing* { \section } { 0pt } { 37pt } { 0pt } \titlespacing* { \subsection } { 0pt } { 37pt } { 0pt } \titlespacing* { \subsubsection } { 0pt } { 37pt } { 0pt } \titlespacing* { \paragraph } { 0pt } { 37pt } { 0pt } \titlespacing* { \subparagraph } { 0pt } { 37pt } { 1em } % \end{macrocode} % % \begin{macrocode} \titleformat { \part } [ display ] { \cs_if_exist_use:N \phantomsection \vfil \normalfont \normalsize \singlespacing \filcenter } { \MakeUppercase { \partname } \space \thepart } { 12pt } { \MakeUppercase } [ \vfil ] \titleformat { \chapter } [ display ] { \normalfont \normalsize \singlespacing \filcenter } { \@@_if_page_numbering:nT { roman } { \pagenumbering { arabic } } \MakeUppercase { \chaptername } \space \thechapter } { 12pt } { \MakeUppercase } [ \@@_after_head_correction: ] \titleformat { \section } [ block ] { \@@_before_head_correction: \normalfont \normalsize \singlespacing \bfseries \filcenter } { \thesection } { 1em } { } [ \@@_after_head_correction: ] \titleformat { \subsection } [ block ] { \@@_before_head_correction: \normalfont \normalsize \singlespacing \filcenter } { \thesubsection } { 1em } { } [ \@@_after_head_correction: ] \titleformat { \subsubsection } [ block ] { \@@_before_head_correction: \normalfont \normalsize \singlespacing \bfseries \itshape \filright } { \thesubsubsection } { 1em } { } [ \@@_after_head_correction: ] \titleformat { \paragraph } [ block ] { \@@_before_head_correction: \normalfont \normalsize \singlespacing \filright } { \theparagraph } { 1em } { } \titleformat { \subparagraph } [ runin ] { \normalfont \normalsize \bfseries } { \thesubparagraph } { 1em } { } } % \end{macrocode} % % \subsection{Table of contents and list of figures/tables} % % \begin{macrocode} \int_set:Nn \c@tocdepth { 2 } % \end{macrocode} % % \begin{macrocode} \IfDocumentMetadataT { \hook_gput_code:nnn { cmd / @starttoc / before } { sblreport } { \hook_gput_next_code:nn { cmd / @input / before } { \singlespacing } } } % \end{macrocode} % % \begin{macrocode} \cs_set:Npn \tableofcontents { \chapter* { \contentsname } \@mkboth { \contentsname } { \contentsname } \@starttoc { toc } } % \end{macrocode} % % \begin{macrocode} \cs_set:Npn \listoffigures { \chapter* { \listfigurename } \addcontentsline { toc } { chapter } { \listfigurename } \@mkboth { \listfigurename } { \listfigurename } \@starttoc { lof } } % \end{macrocode} % % \begin{macrocode} \cs_set:Npn \listoftables { \chapter* { \listtablename } \addcontentsline { toc } { chapter } { \listtablename } \@mkboth { \listtablename } { \listtablename } \@starttoc { lot } } % \end{macrocode} % % For documents using \cs{DocumentMetadata} use standard kernel commands to % redefine table of contents lines, otherwise use the \pkg{titletoc} package. % % \begin{macrocode} \IfDocumentMetadataTF { \text_declare_expand_equivalent:Nn \numberline { \exp_not:n { \numberline } } \hook_gput_code:nnn { cmd / @dottedtocline / before } { sblreport } { \addvspace { 14.5pt } } \hook_gput_code_with_args:nnn { contentsline / text / after } { sblreport } { \int_compare:nNnT {#1} > { \c_zero_int } { \cs_set_nopar:Npn \leaders ##1 ##2 { } } } \cs_set_nopar:cpn { contentsline@text@0@format } { \MakeUppercase } \socket_new:nn { sblreport / numberline } { 1 } \socket_new_plug:nnn { sblreport / numberline } { default } { \hook_use:nnw { contentsline / number / before } { 1 } {#1} #1 \skip_horizontal:n { 1em } \hook_use:nnw { contentsline / number / after } { 1 } {#1} } \socket_new_plug:nnn { sblreport / numberline } { chapter } { \hook_use:nnw { contentsline / number / before } { 1 } {#1} \int_compare:nNnTF { \int_use:N \sblreport@appendices } = { 1 } { \InstanceValue { heading } { chapter } { prefix } \int_compare:nNnT { \sblreport@appendix@state } > { 1 } { \skip_horizontal:n { \InstanceValue { headformat } { chapter } { prefix-number-sep } } #1 } } { \InstanceValue { heading } { chapter } { prefix } \skip_horizontal:n { \InstanceValue { headformat } { chapter } { prefix-number-sep } } #1 } : \enspace \hook_use:nnw { contentsline / number / after } { 1 } {#1} } \socket_new_plug:nnn { sblreport / numberline } { part } { \hook_use:nnw { contentsline / number / before } { 1 } {#1} \InstanceValue { heading } { part } { prefix } \skip_horizontal:n { \InstanceValue { headformat } { part } { prefix-number-sep } } #1 : \enspace \hook_use:nnw { contentsline / number / after } { 1 } {#1} } \socket_assign_plug:nn { sblreport / numberline } { default } \cs_set_nopar:Npn \numberline #1 { \socket_use:n { sblreport / numberline } {#1} } % \end{macrocode} % % \begin{macrocode} \cs_set_nopar:cpn { contentsline@text@-1@format } { \MakeUppercase } \cs_set_nopar:Npn \l@part #1#2 { \socket_assign_plug:nn { sblreport / numberline } { part } \addpenalty { -\@highpenalty } \addvspace { 14.5pt } \group_begin: \centering \skip_set:Nn \leftskip { \@pnumwidth plus 1.0fil } \skip_set_eq:NN \rightskip \leftskip { \mode_leave_vertical: \hook_use:nnw { contentsline / text / before } { 4 } { \toclevel@part } {#1} {#2} { \@contentsline@destination } \use:c { contentsline@text@-1@format } {#1} \hook_use:nnw { contentsline / text / after } { 4 } { \toclevel@part } {#1} {#2} { \@contentsline@destination } \hook_use:nnw { contentsline / page / before } { 4 } { \toclevel@part } {#1} {#2} { \@contentsline@destination } \hook_use:nnw { contentsline / page / after } { 4 } { \toclevel@part } {#1} {#2} { \@contentsline@destination } } \par \nobreak \group_end: } \cs_set_nopar:Npn \l@chapter { \socket_assign_plug:nn { sblreport / numberline } { chapter } \@dottedtocline { 0 } { 0em } { 0em } } \cs_set_nopar:Npn \l@section { \socket_assign_plug:nn { sblreport / numberline } { default } \@dottedtocline { 1 } { 1em } { 0em } } \cs_set_nopar:Npn \l@subsection { \socket_assign_plug:nn { sblreport / numberline } { default } \@dottedtocline { 2 } { 2em } { 0em } } \cs_set_nopar:Npn \l@subsubsection { \socket_assign_plug:nn { sblreport / numberline } { default } \@dottedtocline { 3 } { 3em } { 0em } } \cs_set_nopar:Npn \l@paragraph { \socket_assign_plug:nn { sblreport / numberline } { default } \@dottedtocline { 4 } { 4em } { 0em } } \cs_set_nopar:Npn \l@subparagraph { \socket_assign_plug:nn { sblreport / numberline } { default } \@dottedtocline { 5 } { 5em } { 0em } } \cs_set_nopar:Npn \l@figure { \socket_assign_plug:nn { sblreport / numberline } { default } \@dottedtocline { 1 } { 0em } { 0em } } \cs_set_eq:NN \l@table \l@figure } { \RequirePackage { titletoc } % \end{macrocode} % % \begin{macro}{\@@_hyperlink:nn} \marg{link} \marg{text} % % \medskip % % A convenience version of |\hyperlink| that just uses \meta{text} if % \pkg{hyperref} isn't loaded. % % \begin{macrocode} \cs_new_protected:Nn \@@_hyperlink:nn { \cs_if_exist_use:NTF \hyperlink { { #1 } { #2 } } { #2 } } % \end{macrocode} % \end{macro} % % \begin{macrocode} \titlecontents { figure } [ 0pt ] { \singlepacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \makebox [ 2em ] [ r ] { \thecontentslabel . \enspace } } } { } { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage } \titlecontents { table } [ 0pt ] { \singlespacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \makebox [ 2em ] [ r ] { \thecontentslabel . \enspace } } } { } { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage } \titlecontents { part } [ 0pt ] { \singlespacing \filcenter } { \@@_hyperlink:nn { \Hy@tocdestname } { \MakeUppercase { \partname } \space \thecontentslabel : \enspace } \MakeUppercase } { \MakeUppercase } { } \titlecontents { chapter } [ 0pt ] { \singlespacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \MakeUppercase { \chaptername } \space \thecontentslabel : \enspace } \MakeUppercase } { \MakeUppercase } { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage } \titlecontents { section } [ 1em ] { \singlespacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \thecontentslabel \hspace { 1em } } } { } { \hfill \contentspage } \titlecontents { subsection } [ 2em ] { \singlespacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \thecontentslabel \hspace { 1em } } } { } { \hfill \contentspage } \titlecontents { subsubsection } [ 3em ] { \singlespacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \thecontentslabel \hspace { 1em } } } { } { \hfill \contentspage } \titlecontents { paragraph } [ 4em ] { \singlespacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \thecontentslabel \hspace { 1em } } } { } { \hfill \contentspage } \titlecontents { subparagraph } [ 5em ] { \singlespacing \filright } { \@@_hyperlink:nn { \Hy@tocdestname } { \thecontentslabel \hspace { 1em } } } { } { \hfill \contentspage } } % \end{macrocode} % % \subsection{Appendices} % % Set up appendix headings and table of contents. % % \begin{macrocode} \cs_set_eq:NN \sblreport@hyperlink \@@_hyperlink:nn % \end{macrocode} % % Create a state flag indicating if \cs{appendix} has been called. Within % appendices, this flag is set to a value of 1. This is only used when % \cs{DocumentMetadata} is in use. % % \begin{macrocode} \int_new:N \sblreport@appendices % \end{macrocode} % % Create a state flag for number of appendices. A value of 0 indicates there % are no appendices, 1 indicates one appendix and 2 indicates multiple % appendices. % % \begin{macrocode} \int_new:N \sblreport@appendix@state % \end{macrocode} % % \begin{macrocode} \hook_gput_code:nnn { enddocument / afterlastpage } { sblreport } { \protected@write \@auxout { } { \exp_not:N \global \exp_not:N \sblreport@appendix@state \int_use:N \sblreport@appendix@state } } % \end{macrocode} % % \begin{macrocode} \cs_new_protected:Nn \@@_set_up_appendices: { \int_compare:nNnT { \sblreport@appendix@state } = { 1 } { \int_gzero:N \sblreport@appendix@state } \cs_set_nopar:Npn \thechapter { \arabic { chapter } } \IfDocumentMetadataTF { \addtocontents { toc } { \sblreport@appendices 1 } \addtocontents { toc } { \def \protect \chaptername { \appendixname } } \cs_new:Nn \@@_appendix_number_format:n { \int_compare:nNnT { \sblreport@appendix@state } > { 1 } { \theheading } } \cs_new:Nn \@@_appendix_prefix_number_sep: { \int_compare:nNnTF { \sblreport@appendix@state } > { 1 } { 0.5em } { 0em } } \EditInstance { heading } { chapter } { , number-format = \@@_appendix_number_format:n , prefix = \MakeUppercase { \appendixname } } \EditInstance { headformat } { chapter } { , prefix-number-sep = \@@_appendix_prefix_number_sep: } \DeclareDocumentCommand \chapter { s = { shorttitle } o m } { \bool_if:nF {##1} { \int_compare:nNnT { \sblreport@appendix@state } < { 2 } { \int_gincr:N \sblreport@appendix@state } } \ParseLaTeXeHeading { chapter } {##1} {##2} {##3} \@@_after_head_correction: } } { \titleformat { \chapter } [ display ] { \singlespacing \normalfont \normalsize \filcenter } { \int_compare:nNnT { \sblreport@appendix@state } < { 2 } { \int_gincr:N \sblreport@appendix@state } \MakeUppercase { \appendixname } \int_compare:nNnT { \sblreport@appendix@state } > { 1 } { \space \thechapter } } { 12pt } { \MakeUppercase } [ \@@_after_head_correction: ] \titlecontents { chapter } [ 0pt ] { \singlespacing \filright } { \sblreport@hyperlink { \Hy@tocdestname } { \MakeUppercase { \appendixname } \ifnum \sblreport@appendix@state > 1 \strut \space \thecontentslabel \fi : \enspace } \MakeUppercase } { \MakeUppercase } { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage } } } % \end{macrocode} % % \begin{macrocode} \hook_gput_code:nnn { cmd / appendix / after } { sblreport } { \@@_set_up_appendices: } % \end{macrocode} % % \subsection{Bibliography and list of abbreviations} % % \begin{macrocode} \DefineBibliographyStrings { english } { shorthands = { List~of~Abbreviations } } \cs_set_nopar:Npn \bibsetup { \singlespacing } \dim_set:Nn \bibhang { 0.5in } \dim_set:Nn \bibitemsep { 12pt } \dim_set:Nn \biblabelsep { 0.5in } % \end{macrocode} % % \subsection{Helper functions} % % \begin{macro}{\@@_if_page_numbering:nT} \marg{numbering style} % \marg{code if true} % % \medskip % % Test if the current page numbering style matches a particular style. % (e.g., |arabic| or |roman|). % % \begin{macrocode} \prg_new_protected_conditional:Npnn \@@_if_page_numbering:n #1 { T } { \cs_set_nopar:Nn \@@_thepage_test: { \csname @ #1 \endcsname \c@page } \if_meaning:w \thepage \@@_thepage_test: \prg_return_true: \else: \prg_return_false: \fi: } % \end{macrocode} % \end{macro} % % \begin{macrocode} \endinput % \end{macrocode} % % \begin{macrocode} % % \end{macrocode}