% \iffalse meta-comment
%
% Copyright (c) 2026 David Purton <dcpurton@marshwiggle.net>
%
% 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}
%</driver>
% \fi
%
% \title{The \pkg{sblbook} Class}
% \author{David Purton\thanks{Email: \url{dcpurton@marshwiggle.net}}}
% \date{2026-07-22 v1.1}
%
% \maketitle
%
% \begin{abstract}
%   \pkg{sblbook} provides a LaTeX class for producing articles and papers
%   conforming to the style required by the Society of Biblical Literature. It
%   depends on \pkg{sblfonts} for language support, \pkg{biblatex-sbl} for
%   referencing, \pkg{sblidx} for indexing and \pkg{bibleref-sbl} for
%   Scripture references.
% \end{abstract}
%
% \tableofcontents
%
% \section{Introduction}
%
% The \pkg{sblbook} class creates a print ready book matching the style
% specified in the \emph{Preparing Your Printer-Ready Manuscript}. See
% \url{https://www.sbl-site.org/assets/pdfs/PRMmanual.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).
%
% \subsection{Usage}
%
% Load the class using |\documentclass{sblbook}|. See |sbltex-book.tex| 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|, |\frontmatter|, |\mainmatter|, |\backmatter|
%   \item |\footnote|
%   \item |\caption|
%   \item |\index|
%   \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{sblbook} 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}), \pkg{sblidx} (with
%     \pkg{imakeidx}, \pkg{idxlayout}, \pkg{bibleref-parse} and
%     \pkg{bibleref-sbl})
%   \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-book.pdf| in the documentation is built with tagging enabled and
%   successfully verifies with VeraPDF.
% \end{description}
%
% \section{Package Environments}
%
% \begin{function}{acknowledgements}
%   \begin{syntax}
%     |\begin| \marg{acknowledgements}
%     |\end| \marg{acknowledgements}
%   \end{syntax}
%   Add an Acknowledgements page to the book. The name of the section can be
%   changed by redefining |\acknowledgementsname|.
% \end{function}
%
% \begin{function}{copyrightpage}
%   \begin{syntax}
%     |\begin| \marg{copyrightpage}
%     |\end| \marg{copyrightpage}
%   \end{syntax}
%   Add a copyright page to the book. This page is supplied by SBL Press.
% \end{function}
%
% \begin{function}{dedication}
%   \begin{syntax}
%     |\begin| \marg{dedication}
%     |\end| \marg{dedication}
%   \end{syntax}
%   Add a dedication to the book. This page is empty by default. If there is a
%   dedication, it should be placed on page v.
% \end{function}
%
% \begin{function}{epigraph}
%   \begin{syntax}
%     |\begin| \marg{epigraph}
%     |\end| \marg{epigraph}
%   \end{syntax}
%   Add an epigraph to the book. This page is empty by default. If there is an
%   epigraph, it should be placed on page vii.
% \end{function}
%
% \begin{function}{foreword}
%   \begin{syntax}
%     |\begin| \marg{foreword}
%     |\end| \marg{foreword}
%   \end{syntax}
%   Add a Foreword to the book. The name of the section can be changed by
%   redefining |\forewordname|.
% \end{function}
%
% \begin{function}{introduction}
%   \begin{syntax}
%     |\begin| \marg{introduction}
%     |\end| \marg{introduction}
%   \end{syntax}
%   Add an Introduction to the book. The name of the section can be changed by
%   redefining |\introductionname|.
% \end{function}
%
% \begin{function}{preface}
%   \begin{syntax}
%     |\begin| \marg{preface}
%     |\end| \marg{preface}
%   \end{syntax}
%   Add a Preface to the book. The name of the section can be changed by
%   redefining |\prefacename|.
% \end{function}
%
% \begin{function}{seriespage}
%   \begin{syntax}
%     |\begin| \marg{seriespage}
%     |\end| \marg{seriespage}
%   \end{syntax}
%   Add a series page to the book. This page is supplied by SBL Press.
% \end{function}
%
% \begin{function}{titlepage}
%   \begin{syntax}
%     |\begin| \marg{titlepage}
%     |\end| \marg{titlepage}
%   \end{syntax}
%   Add a title page to the book. This page is supplied by SBL Press.
%   Note that this page is distinct from the half title page which is added
%   with the |\maketitle| command.
% \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{sblbook} class are passed
% through to the \pkg{book} 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=Baskervaldx,|\\
%     \strut\quad |grfont=Alegreya-LF,|\\
%     \strut\quad |hefont=frank|\\
%     |}|
%   \item[Unicode defaults:] \mbox{}\\
%     |{|\\
%     \strut\quad |mainfont=Baskervaldx,|\\
%     \strut\quad |mainfontoptions={Extension=.otf, UprightFont=*-Reg,|\\
%     \strut\qquad |ItalicFont=*-Ita, BoldFont=*-Bol,|\\
%     \strut\qquad |BoldItalicFont=*-BolIta},|\\
%     \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/}.
%
% See the \pkg{sblfonts} package documentation for a full description of
% supported options and usage.
%
% \begin{function}{sblidx}
%   \begin{syntax}
%     sblidx = \marg{arguments}\hfill Default: \emph{Empty}
%   \end{syntax}
%   These options are passed to the \pkg{sblidx} package.
% \end{function}
%
% Note that the \pkg{sblidx} package is only loaded if at least one of
% |ancient sources|, |modern authors| or |subject| is passed to the |sblidx|
% option.
%
% See the \pkg{sblidx} package documentation for a full description of
% supported options and usage.
%
% \begin{function}{trim}
%   \begin{syntax}
%     trim = true \textbar\ false\hfill Default: false
%   \end{syntax}
%   Whether to trim the PDF to 6 $\times$ 9 inches or not.
% \end{function}
%
% \section{Implementation}
%
% \setlength{\parindent}{0em}
%
%    \begin{macrocode}
%<*class>
%<@@=sblbook>
%    \end{macrocode}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesExplClass{sblbook}{2026-07-22}{1.1}
  {Society of Biblical Literature Book Class (DCP)}
%    \end{macrocode}
%
%    \begin{macrocode}
\clist_new:N \l_@@_options_to_book_class_clist
%    \end{macrocode}
%
%    \begin{macrocode}
\keys_define:nn { sblbook }
  {
    , biblatex .clist_set:N = \l_@@_options_to_biblatex_clist
    , sblfonts .clist_set:N = \l_@@_options_to_sblfonts_clist
    , sblidx   .clist_set:N = \l_@@_options_to_sblidx_clist
    , trim     .bool_set:N  = \l_@@_trim_bool
    , trim     .default:n   = true
    , trim     .initial:n   = false
    , unknown  .code:n = {
                           \clist_put_right:No
                             \l_@@_options_to_book_class_clist
                             { \CurrentOption }
                         }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\ProcessKeyOptions
%    \end{macrocode}
%
% Set default options.
%
%    \begin{macrocode}
\clist_put_left:Nn \l_@@_options_to_book_class_clist
  { }
%    \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        = Baskervaldx
        , mainfontoptions = {
                              , Extension      = .otf
                              , UprightFont    = *-Reg
                              , ItalicFont     = *-Ita
                              , BoldFont       = *-Bol
                              , BoldItalicFont = *-BolIta
                            }
        , sblfonts        = true
      }
  }
  {
    \clist_put_left:Nn \l_@@_options_to_sblfonts_clist
      {
        , mainfont = Baskervaldx
        , grfont   = Alegreya-LF
        , hefont   = frank
      }
  }
%    \end{macrocode}
%
% Load book class.
%
%    \begin{macrocode}
\exp_args:No \PassOptionsToClass
  { \l_@@_options_to_book_class_clist }
  { book }
\LoadClass { book }
%    \end{macrocode}
%
% Font and language set up.
%
%    \begin{macrocode}
\exp_args:No \PassOptionsToPackage
  { \l_@@_options_to_sblfonts_clist }
  { sblfonts }
\RequirePackage { sblfonts }
%    \end{macrocode}
%
% Set up upper case kerning.
%
%    \begin{macrocode}
\sys_if_engine_opentype:T
  {
    \hook_gput_code:nnn
      { cmd / MakeUppercase / before }
      { sblbook }
      { \addfontfeature { Kerning = Uppercase } }
    \hook_gput_code:nnn
      { cmd / MakeUppercase / after }
      { sblbook }
      { \addfontfeature { Kerning = UppercaseOff } }
  }
%    \end{macrocode}
%
% \pkg{biblatex} set up.
%
%    \begin{macrocode}
\exp_args:No \PassOptionsToPackage
  { \l_@@_options_to_biblatex_clist }
  { biblatex }
\RequirePackage { biblatex }
\RequirePackage { csquotes }
%    \end{macrocode}
%
%    \begin{macrocode}
\clist_if_exist:NT \l_@@_options_to_sblidx_clist
  {
    \exp_args:No \PassOptionsToPackage
      { \l_@@_options_to_sblidx_clist }
      { sblidx }
    \RequirePackage { sblidx }
    \@ifpackageloaded { bibleref }
      {
        \RequirePackage { bibleref-parse }
      }
      { }
  }
%    \end{macrocode}
%
% \subsection{Margins}
%
%    \begin{macrocode}
\bool_if:NTF \l_@@_trim_bool
  {
    \RequirePackage
      [
        , paperwidth  = 6in
        , paperheight = 9in
      ]
      { geometry }
  }
  {
    \RequirePackage { geometry }
  }
\dim_new:N \l_@@_top_margin_dim
\dim_new:N \l_@@_inner_margin_dim
\dim_set:Nn \l_@@_top_margin_dim
  { 0.5 \paperheight - 3.75in }
\dim_set:Nn \l_@@_inner_margin_dim
  { 0.5 \paperwidth - 2.25in }
\geometry
  {
    , includehead    = true
    , marginparwidth = 0.5in
    , textwidth      = 4.5in
    , height         = 7.5in
    , top            = \l_@@_top_margin_dim
    , inner          = \l_@@_inner_margin_dim
    , headsep        = 12pt
    , headheight     = 12pt
    , footskip       = 12pt
  }
%    \end{macrocode}
%
% \subsection{Text layout}
%
%    \begin{macrocode}
\dim_set:Nn \parindent { 0.25in }
\RequirePackage [ all ] { nowidow }
\RequirePackage [ hyphenation , lastparline ] { impnattypo }
\RequirePackage { microtype }
%    \end{macrocode}
%
% Commands to disable and enable the |lastparline| feature of the
% \pkg{impnattype} package.
%
%    \begin{macrocode}
\cs_new_protected:Nn \@@_lastparline_off:
  {
    \sys_if_engine_luatex:T
      {
        \lua_now:e
          {
            luatexbase.remove_from_callback("pre_linebreak_filter",
              "lastparline")
          }
      }
  }
\cs_new_protected:Nn \@@_lastparline_on:
  {
    \sys_if_engine_luatex:T
      {
        \lua_now:e
          {
            luatexbase.add_to_callback("pre_linebreak_filter",
              last_line_minimal_length, "lastparline")
          }
      }
  }
%    \end{macrocode}
%
% \subsection{Headers and footers}
%
%    \begin{macrocode}
\RequirePackage { fancyhdr }
\pagestyle { fancy }
\fancyhf { }
\fancyhead [ LE , RO ] { \thepage }
\fancyhead [ CE ] { \itshape \nouppercase { \leftmark } }
\fancyhead [ CO ] { \itshape \nouppercase { \rightmark } }
\cs_set_nopar:Npn \headrulewidth { 0pt }
\cs_set_nopar:Npn \chaptermark #1
  {
    \markboth { \@title } { #1 }
  }
\cs_set_nopar:Npn \sectionmark #1 { }
\fancypagestyle { plain }
  {
    \fancyhf { }
    \fancyfoot
      [ C ]
      {
        \smash { \raisebox { 12pt } { -\,\thepage\,- } }
      }
    \cs_set_nopar:Npn \headrulewidth { 0pt }
    \cs_set_nopar:Npn \footrulewidth { 0pt }
  }
\cs_set_nopar:Npn \thispagestyle #1
  {
    \cs_if_exist:cTF { ps@#1 }
      {
        \tl_if_eq:nnT {#1} { plain }
          {
            \enlargethispage { -24pt }
          }
        \legacy_if_gset_true:n { @specialpage }
        \cs_gset_nopar:Npn \@specialstyle {#1}
      }
      {
        \undefinedpagestyle
      }
  }
\cs_set_nopar:Npn \cleardoublepage
  {
    \clearpage
    \int_if_even:nT { \c@page }
      {
        \hbox:n { }
        \thispagestyle { empty }
        \newpage
      }
  }
%    \end{macrocode}
%
% \subsection{Footnotes}
%
% Different handling is required for footnotes when tagging code is loaded.
%
%    \begin{macrocode}
\IfDocumentMetadataTF
  {
    \socket_new_plug:nnn { fntext / mark } { sblbook }
      {
        \skip_horizontal:N \footnotemargin
        \@thefnmark . \enspace
      }
    \socket_assign_plug:nn { fntext / mark } { sblbook }
    \socket_assign_plug:nn
      { build / column / outputbox }
      { floats-space-footnotes }
  }
  {

    \RequirePackage [ bottom ] { 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.25in }
\cs_set:Npn \footnoterule
  {
    \kern -3pt
    \hrule width 1.5in height .5pt depth 0pt
    \kern 0.0625in
  }
%    \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 } { sblbook }
     {
       \small
       #1:~
     }
    \AssignSocketPlug { caption / label } { sblbook }
  }
  {
    \RequirePackage [ font = small , skip = 6pt ] { caption }
  }
%    \end{macrocode}
%
% \subsection{Block quotes}
%
%    \begin{macrocode}
\IfDocumentMetadataTF
  {
    \EditInstance { blockenv } { quotation }
      {
        , final-code = \small \ignorespaces
      }
    \EditInstance { block } { quotation-1 }
      {
        , begin-extra-vspace = 0pt
        , begin-vspace       = 11pt plus 5pt minus 3pt
        , left-margin        = \parindent
        , right-margin       = \parindent
        , para-indent        = \parindent
        , para-vspace        = 0pt
      }
    \EditInstance { blockenv } { quote }
      {
        , final-code = \small \ignorespaces
      }
    \EditInstance { block } { quote-1 }
      {
        , begin-extra-vspace = 0pt
        , begin-vspace       = 11pt plus 5pt minus 3pt
        , left-margin        = \parindent
        , right-margin       = \parindent
        , para-indent        = 0pt
        , para-vspace        = 6pt plus 2pt minus 1pt
      }
  }
  {
    \renewenvironment { quotation }
      {
        \small
        \list { }
          {
            \dim_set_eq:NN \leftmargin \parindent
            \dim_set_eq:NN \rightmargin \leftmargin
            \skip_set:Nn   \topsep { 11pt plus 5pt minus 3pt }
            \skip_zero:N   \partopsep
            \skip_zero:N   \itemsep
            \skip_zero:N   \parsep
            \dim_set_eq:NN \itemindent \parindent
            \dim_set_eq:NN \listparindent \parindent
          }
        \item \ignorespaces
      }
      {
        \endlist
      }
%    \end{macrocode}
%
%    \begin{macrocode}
    \renewenvironment { quote }
      {
        \small
        \list { }
          {
            \dim_set_eq:NN \leftmargin \parindent
            \dim_set_eq:NN \rightmargin \leftmargin
            \skip_set:Nn   \topsep { 11pt plus 5pt minus 3pt }
            \skip_zero:N   \partopsep
            \skip_zero:N   \itemsep
            \skip_set:Nn   \parsep { 6pt plus 2pt minus 1pt }
            \dim_zero:N    \itemindent
            \dim_zero:N    \listparindent
          }
        \item \ignorespaces
      }
      {
        \endlist
      }
  }
%    \end{macrocode}
%
% \subsection{Title page}
%
% Some pages are supplied by SBL Press and this command notes this at the
% bottom of the page.
%
%    \begin{macrocode}
\cs_new_protected:Nn \@@_supplied_page:
  {
    \group_begin:
      \vfill
      \normalfont
      \footnotesize
      \centering
      This ~ page ~ is ~ supplied ~ by ~ SBL ~ Press
      \para_end:
    \group_end:
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\tl_new:N \g_@@_subtitle_tl
\cs_set_protected:Npn \subtitle #1
  {
    \tl_gset:Nn \g_@@_subtitle_tl {#1}
  }
\tl_new:N \g_@@_series_tl
\cs_set_protected:Npn \series #1
  {
    \tl_gset:Nn \g_@@_series_tl {#1}
  }
\title    { [Title ~ of ~ Book] }
\subtitle { [Subtitle ~ of ~ Book] }
\author   { [Your ~ Name] }
\series   { [Series ~ Name] }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewTaggingSocket{ sblbook / flatblock / begin } { 1 }
\NewTaggingSocket{ sblbook / flatblock / end } { 0 }
\NewTaggingSocketPlug { sblbook / flatblock / begin } { default }
  {
    \tag_struct_begin:n
      {
        tag = #1
      }
    \tagpdfsetup { para / flattened = true }
  }
\NewTaggingSocketPlug { sblbook / flatblock / end } { default }
  {
    \para_end:
    \tag_struct_end:
  }
\AssignTaggingSocketPlug { sblbook / flatblock / begin } { default }
\AssignTaggingSocketPlug { sblbook / flatblock / end } { default }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_set_protected:Npn \maketitle
  {
    \group_begin:
      \UseTaggingSocket { sblbook / flatblock / begin }
        { \UseStructureName { title / block } }
      \thispagestyle { empty }
      \centering
      \vspace* { 0.5in }
      \LARGE
      \IfDocumentMetadataTF
        {
          \UseTaggingSocket { title } { } { \MakeUppercase { \@title } }
        }
        {
          \MakeUppercase { \@title }
        }
      \para_end:
      \tl_if_empty:NF \g_@@_subtitle_tl
        {
          \vspace { 0.5in }
          \Large
          \g_@@_subtitle_tl
          \para_end:
        }
      \@@_supplied_page:
      \UseTaggingSocket { sblbook / flatblock / end }
    \group_end:
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\RenewDocumentEnvironment { titlepage } { }
  {
    \clearpage
    \UseTaggingSocket { sblbook / flatblock / begin }
      { \UseStructureName { title / block } }
    \thispagestyle { empty }
    \centering
    \vspace* { 0.5in }
    \LARGE
    \IfDocumentMetadataTF
      {
        \UseTaggingSocket { title } { } { \MakeUppercase { \@title } }
      }
      {
        \MakeUppercase { \@title }
      }
    \para_end:
    \tl_if_empty:NF \g_@@_subtitle_tl
      {
        \vspace { 0.5in }
        \Large
        \g_@@_subtitle_tl
        \para_end:
      }
    \vspace { 0.5in }
    \large
    By
    \para_end:
    \@author
    \para_end:
    \normalsize
  }
  {
    \@@_supplied_page:
    \UseTaggingSocket { sblbook / flatblock / end }
  }
%    \end{macrocode}
%
% \subsection{Front matter environments}
%
%    \begin{macrocode}
\NewDocumentEnvironment { copyrightpage } { }
  {
    \clearpage
    \UseTaggingSocket { sblbook / flatblock / begin } { text-unit }
    \thispagestyle { empty }
    \vspace* { 0.5in }
    \noindent
    Copyright ~ © ~ \number \year \space by ~ \@author
  }
  {
    \@@_supplied_page:
    \UseTaggingSocket { sblbook / flatblock / end }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { seriespage } { }
  {
    \clearpage
    \UseTaggingSocket { sblbook / flatblock / begin } { text-unit }
    \thispagestyle { empty }
    \centering
    \vspace* { 0.5in }
    \LARGE
    \MakeUppercase { \g_@@_series_tl }
    \para_end:
    \normalsize
  }
  {
    \@@_supplied_page:
    \UseTaggingSocket { sblbook / flatblock / end }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { dedication } { }
  {
    \cleardoublepage
    \UseTaggingSocket { sblbook / flatblock / begin } { text-unit }
    \int_compare:nNnT { \c@page } < { 5 }
      {
        \int_gset:Nn \c@page { 5 }
      }
    \thispagestyle { empty }
    \centering
    \vspace* { 1.5in }
    \itshape
  }
  {
    \para_end:
    \UseTaggingSocket { sblbook / flatblock / end }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\NewDocumentEnvironment { epigraph } { }
  {
    \cleardoublepage
    \UseTaggingSocket { sblbook / flatblock / begin } { text-unit }
    \int_compare:nNnT { \c@page } < { 5 }
      {
        \int_gset:Nn \c@page { 5 }
      }
    \thispagestyle { empty }
    \vspace* { 0.5in }
  }
  {
    \para_end:
    \UseTaggingSocket { sblbook / flatblock / end }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_nopar:Npn \acknowledgementsname { Acknowledgements }
\NewDocumentEnvironment { acknowledgements } { }
  {
    \chapter* { \acknowledgementsname }
    \chaptermark { \acknowledgementsname }
    \addcontentsline { toc } { chapter } { \acknowledgementsname }
  }
  { \para_end: }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_nopar:Npn \forewordname { Foreword }
\NewDocumentEnvironment { foreword } { }
  {
    \chapter* { \forewordname }
    \chaptermark { \forewordname }
    \addcontentsline { toc } { chapter } { \forewordname }
  }
  { \para_end: }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_nopar:Npn \introductionname { Introduction }
\NewDocumentEnvironment { introduction } { }
  {
    \chapter* { \introductionname }
    \chaptermark { \introductionname }
    \addcontentsline { toc } { chapter } { \introductionname }
  }
  { \para_end: }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_nopar:Npn \prefacename { Preface }
\NewDocumentEnvironment { preface } { }
  {
    \chapter* { \prefacename }
    \chaptermark { \prefacename }
    \addcontentsline { toc } { chapter } { \prefacename }
  }
  { \para_end: }
%    \end{macrocode}
%
% \subsection{Section titles}
%
% For documents using \cs{DocumentMetadata} use standard kernel commands to
% redefine section headings, otherwise use the \pkg{titlesec} package. 
%
%    \begin{macrocode}
\int_set:Nn \c@secnumdepth { 0 }
\cs_set_nopar:Npn \thepart { \arabic { part } }
%    \end{macrocode}
%
%    \begin{macrocode}
\IfDocumentMetadataTF
  {
    \EditInstance { heading } { part }
      {
        , heading-decls = \normalfont \Large \scshape \centering
        , title-decls   =
        , start-code    = \cleardoublepage
                          \thispagestyle { empty }
                          \null \vfil
      }
    \EditInstance { headformat } { part }
      {
        , number-title-sep = 12pt
      }
    \DeclareDocumentCommand \part { s = { shorttitle } o m }
      {
        \ParseLaTeXeHeading { part } {#1} {#2} {#3}
      }
    \EditInstance { heading } { chapter }
      {
        , placement            = top
        , after-penalty-vspace = 0.5in
        , after-vspace         = 0.5in plus 12pt minus 6pt
        , prefix               = 
        , heading-decls        = \normalfont \normalsize \Large \centering
        , title-decls          =
      }
    \EditInstance { headformat } { chapter }
      {
        , number-title-sep = 12pt
      }
    \DeclareDocumentCommand \chapter { s = { shorttitle } o m }
      {
        \bool_if:nF {#1}
          {
            \@@_if_page_numbering:nT { roman }
              {
                \cleardoublepage
                \pagenumbering { arabic }
              }
            \addtocontents { toc } { \addvspace { 12pt ~ plus ~ 1pt } }
          }
        \legacy_if:nTF { @mainmatter }
          {
            \ParseLaTeXeHeading { chapter } {#1} {#2} {#3}
          }
          {
            \bool_if:nTF {#1}
              {
                \ParseLaTeXeHeading { chapter } {#1} {#2} {#3}
              }
              {
                \tl_if_novalue:nTF {#2}
                  {
                    \ParseLaTeXeHeading { chapter } { \c_true_bool }
                      { shorttitle = {#3} } {#3}
                  }
                  {
                    \ParseLaTeXeHeading { chapter } { \c_true_bool }
                      {#2} {#3}
                  }
              }
          }
      }
    \EditInstance { heading } { section }
      {
        , before-vspace = 12pt plus 2pt minus 1pt
        , after-vspace  = 10.5pt plus 4pt minus 2pt
        , heading-decls = \normalfont \normalsize \centering
      }
    \EditInstance { headformat } { section }
      {
        , title-format = \MakeUppercase {#1}
      }
    \EditInstance { heading } { subsection }
      {
        , before-vspace = 6pt plus 2pt minus 1pt
        , after-vspace  = 4pt plus 2pt minus 1pt
        , heading-decls = \normalfont \normalsize \scshape \raggedright
      }
    \DeclareInstance { heading } { subsubsection } { runin }
      {
        , name                = subsubsection
        , parent-name         = subsection
        , level               = 3
        , before-vspace       = 6pt plus 2pt minus 1pt
        , after-vspace        = 1em
        , heading-decls       = \normalfont \normalsize \scshape
        , mark-cmd            = \subsubsectionmark {#1}
        , headformat-instance = subsubsection
      }
    \DeclareInstance { headformat } { subsubsection } { runin }
      {
        , heading-indent = 0pt
      }
    \EditInstance { heading } { paragraph }
      {
        , before-vspace = 6pt plus 2pt minus 1pt
        , after-vspace  = 1em
        , heading-decls = \normalfont \normalsize \itshape
      }
    \EditInstance { heading } { subparagraph }
      {
        , before-vspace = 6pt plus 2pt minus 1pt
        , after-vspace  = 1em
        , heading-decls = \normalfont \normalsize \itshape
      }
    \EditInstance { headformat } { subparagraph }
      {
        , heading-indent = 0.25in
      }
  }
  {
    \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 }    { 0.5in }
      { 0.5in plus 12pt minus 6pt }
    \titlespacing* { \section }      { 0pt }    { 12pt plus 4pt minus 2pt }
      { 10pt plus 4pt minus 2pt }
    \titlespacing* { \subsection }   { 0pt }    { 6pt plus 2pt minus 1pt }
      { 4pt plus 2pt minus 1pt }
    \titlespacing* {\subsubsection } { 0pt }    { 6pt plus 2pt minus 1pt }
      { 1em }
    \titlespacing* { \paragraph }    { 0pt }    { 6pt plus 2pt minus 1pt }
      { 1em }
    \titlespacing* { \subparagraph } { 0.25in } { 6pt plus 2pt minus 1pt }
      { 1em }
%    \end{macrocode}
%
%    \begin{macrocode}
    \titleformat
      { \part }
      [ display ]
      { \vfil \normalfont \Large \scshape \filcenter }
      { \partname \space \thepart }
      { 12pt }
      { }
      [ \vfil ]
    \titleformat
      { \chapter }
      [ display ]
      { \normalfont \Large \filcenter }
      { \thechapter }
      { 12pt }
      { }
    \titleformat
      { \section }
      [ block ]
      { \normalfont \normalsize \filcenter }
      { \thesection }
      { 1em }
      { \MakeUppercase }
    \titleformat
      { \subsection }
      [ block ]
      { \normalfont \normalsize \scshape \filright }
      { \thesubsection }
      { 1em }
      { }
    \titleformat
      { \subsubsection }
      [ runin ]
      { \normalfont \normalsize \scshape }
      { \thesubsubsection }
      { 1em }
      { }
    \titleformat
      { \paragraph }
      [ runin ]
      { \normalfont \normalsize \itshape }
      { \theparagraph }
      { 1em }
      { }
    \titleformat
      { \subparagraph }
      [ runin ]
      { \normalfont \normalsize \itshape }
      { \thesubparagraph }
      { 1em }
      { }
  }
%    \end{macrocode}
%
% \subsection{Table of contents and list of figures/tables}
%
%    \begin{macrocode}
\int_set:Nn \c@tocdepth { 1 }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_set_protected:Npn \tableofcontents
  {
    \chapter* { \contentsname }
    \@mkboth
      { \contentsname }
      { \contentsname }
    \int_compare:nNnT { \c@page } < { 5 }
      { \int_gset:Nn \c@page { 5 } }
    \@@_lastparline_off:
    \@starttoc { toc }
    \@@_lastparline_on:
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_set_protected:Npn \listoffigures
  {
    \chapter* { \listfigurename }
    \addcontentsline { toc } { chapter } { \listfigurename }
    \@mkboth
      { \listfigurename }
      { \listfigurename }
    \@@_lastparline_off:
    \@starttoc { lof }
    \@@_lastparline_on:
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_set_protected:Npn \listoftables
  {
    \chapter* { \listtablename }
    \addcontentsline { toc } { chapter } { \listtablename }
    \@mkboth
      { \listtablename }
      { \listtablename }
    \@@_lastparline_off:
    \@starttoc { lot }
    \@@_lastparline_on:
  }
%    \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
  {
    \cs_set:Npn \@pnumwidth { 2em }
    \hook_gput_code_with_args:nnn { contentsline / text / after }
      { sblbook }
      {
        \int_compare:nNnT {#1} > { \c_zero_int }
          {
            \cs_set_nopar:Npn \leaders ##1 ##2 { }
          }
      }
    \socket_new:nn { sblbook / numberline } { 1 }
    \socket_new_plug:nnn { sblbook / numberline }
      { boxed }
      {
        \hbox_to_wd:nn
          { \@tempdima }
          {
            \hook_use:nnw { contentsline / number / before } { 1 } {#1}
            \hfill #1. \enspace
            \hook_use:nnw { contentsline / number / after } { 1 } {#1}
          }
      }
    \socket_new_plug:nnn { sblbook / numberline }
      { default }
      {
        \hook_use:nnw { contentsline / number / before } { 1 } {#1}
        #1. \enspace
        \hook_use:nnw { contentsline / number / after } { 1 } {#1}
      }
    \socket_new_plug:nnn { sblbook / numberline }
      { chapter }
      {
        \int_compare:nNnTF { \int_use:N \sblbook@appendices } = { 1 }
          {
            \hook_use:nnw { contentsline / number / before } { 1 } {#1}
            \chaptername
            \int_compare:nNnT { \sblbook@appendix@state } > { 1 }
              {
                \skip_horizontal:n
                  {
                    \InstanceValue
                      { headformat } { chapter } { prefix-number-sep }
                  }
                #1
              }
            : \enspace
            \hook_use:nnw { contentsline / number / after } { 1 } {#1}
          }
          {
            \hbox_to_wd:nn
              { \@tempdima }
              {
                \hook_use:nnw { contentsline / number / before } { 1 } {#1}
                \hfill #1. \enspace
                \hook_use:nnw { contentsline / number / after } { 1 } {#1}
              }
          }
      }
    \socket_new_plug:nnn { sblbook / 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
      { sblbook / numberline } { default }
    \cs_set_nopar:Npn \numberline #1
      {
        \socket_use:n { sblbook / numberline } {#1}
      }
%    \end{macrocode}
%
%    \begin{macrocode}
    \cs_set_nopar:Npn \l@part #1#2
      {
        \int_compare:nNnT { \c@tocdepth } > { -2 }
          {
            \socket_assign_plug:nn { sblbook / numberline } { part }
            \addpenalty { -\@highpenalty }
            \addvspace { 12pt plus 1pt }
            \group_begin:
              \centering
              \skip_set:Nn \leftskip  { \@pnumwidth plus 1.0fil }
              \skip_set_eq:NN \rightskip \leftskip
              {
                \mode_leave_vertical:
                \scshape
                \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 { sblbook / numberline } { chapter }
        \@dottedtocline { 0 } { 0em } { 2em }
      }
    \cs_set_nopar:Npn \l@section
      {
        \socket_assign_plug:nn { sblbook / numberline } { default }
        \@dottedtocline { 1 } { 2em } { 0em }
      }
    \cs_set_nopar:Npn \l@subsection
      {
        \socket_assign_plug:nn { sblbook / numberline } { default }
        \@dottedtocline { 2 } { 4em } { 0em }
      }
    \cs_set_nopar:Npn \l@subsubsection
      {
        \socket_assign_plug:nn { sblbook / numberline } { default }
        \@dottedtocline { 3 } { 6em } { 0em }
      }
    \cs_set_nopar:Npn \l@paragraph
      {
        \socket_assign_plug:nn { sblbook / numberline } { default }
        \@dottedtocline { 4 } { 8em } { 0em }
      }
    \cs_set_nopar:Npn \l@subparagraph
      {
        \socket_assign_plug:nn { sblbook / numberline } { default }
        \@dottedtocline { 5 } { 10em } { 0em }
      }
    \cs_set_nopar:Npn \l@figure
      {
        \socket_assign_plug:nn { sblbook / numberline } { boxed }
        \@dottedtocline { 0 } { 0em } { 2em }
      }
    \cs_set_eq:NN \l@table \l@figure
  }
  {
    \RequirePackage { titletoc }
    \contentsmargin { 2em }
%    \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{macro}{\@@_contents_label_box:nn} \marg{width} \marg{alignment}
%
%   \medskip
%
%   Create a boxed contents label with a hyperlink if \pkg{hyperref} is
%   loaded.
%
%    \begin{macrocode}
    \cs_new_protected:Nn \@@_contents_label_box:nn
      {
        \@@_hyperlink:nn
          { \Hy@tocdestname }
          {
            \makebox [ #1 ] [ #2 ] { \thecontentslabel . \enspace }
          }
      }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_contents_label:}
%
%   \medskip
%
%   Create an unboxed contents label with a hyperlink if \pkg{hyperref} is
%   loaded.
%
%    \begin{macrocode}
    \cs_new_protected:Nn \@@_contents_label:
      {
        \@@_hyperlink:nn
          { \Hy@tocdestname }
          { \thecontentslabel . \enspace }
      }
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_contents_above:n} \marg{dimen}
%
%   \medskip
%
%   Convenience macro for code before contents line. \meta{dimen} is a
%   horizontal offset the line.
%
%    \begin{macrocode}
    \cs_new_protected:Nn \@@_contents_above:n
      {
        \hspace* { -#1 }
        \filright
      }
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
    \titlecontents { figure }
      [ 2em ]
      {
        \@@_contents_above:n { 2em }
      }
      {
        \@@_contents_label_box:nn { 2em } { r }
      }
      { }
      { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage }
    \titlecontents { table }
      [ 2em ]
      {
        \@@_contents_above:n { 2em }
      }
      {
        \@@_contents_label_box:nn { 2em } { r }
      }
      { }
      { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage }
    \titlecontents { part }
      [ 0pt ]
      {
        \addvspace { 12pt plus 1pt }
        \scshape \filcenter
        \skip_set:Nn \leftskip { \@pnumwidth plus 1.0fil }
        \skip_set_eq:NN \rightskip \leftskip
      }
      {
        \@@_hyperlink:nn
          { \Hy@tocdestname }
          {
            \partname \space \thecontentslabel : \hspace { 0.5em }
          }
      }
      { }
      { }
    \titlecontents { chapter }
      [ 2em ]
      {
        \tl_if_empty:NF \thecontentslabel
          {
            \addvspace { 12pt plus 1pt }
          }
        \@@_contents_above:n { 2em }
      }
      {
        \@@_contents_label_box:nn { 2em } { r }
      }
      { }
      { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage }
    \titlecontents { section }
      [ 2em ]
      {
        \@@_contents_above:n { 1sp }
      }
      { \@@_contents_label: }
      { }
      { \hfill \contentspage }
    \titlecontents { subsection }
      [ 4em ]
      {
        \@@_contents_above:n { 1sp }
      }
      { \@@_contents_label: }
      { }
      { \hfill \contentspage }
    \titlecontents { subsubsection }
      [ 6em ]
      {
        \@@_contents_above:n { 1sp }
      }
      { \@@_contents_label: }
      { }
      { \hfill \contentspage }
    \titlecontents { paragraph }
      [ 8em ]
      {
        \@@_contents_above:n { 1sp }
      }
      { \@@_contents_label: }
      { }
      { \hfill \contentspage }
    \titlecontents { subparagraph }
      [ 10em ]
      {
        \@@_contents_above:n { 1sp }
      }
      { \@@_contents_label: }
      { }
      { \hfill \contentspage }
  }
%    \end{macrocode}
%
% Insert a space in the table of contents at the backmatter.
%
%    \begin{macrocode}
\hook_gput_code:nnn
  { cmd / backmatter / after }
  { sblbook }
  {
    \int_compare:nNnF { \int_use:N \sblbook@appendices } = { \c_zero_int }
      {
        \addtocontents { toc } { \addvspace { 12pt ~ plus ~ 1pt } }
      }
  }
%    \end{macrocode}
%
% \subsection{Appendices}
%
% Set up appendix headings and table of contents.
%
%    \begin{macrocode}
\cs_set_eq:NN \sblbook@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 \sblbook@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 \sblbook@appendix@state
%    \end{macrocode}
%
%    \begin{macrocode}
\hook_gput_code:nnn { enddocument / afterlastpage } { sblbook }
  {
    \protected@write \@auxout
      { }
      {
        \exp_not:N \global
        \exp_not:N \sblbook@appendix@state
        \int_use:N \sblbook@appendix@state
      }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\cs_new_protected:Nn \@@_set_up_appendices:
  {
    \addtocontents { toc } { \sblbook@appendices 1 }
    \addtocontents { toc } { \addvspace { 12pt ~ plus ~ 1pt } }
    \int_compare:nNnT { \sblbook@appendix@state } = { 1 }
      { \int_gzero:N \sblbook@appendix@state }
    \cs_set_nopar:Npn \thechapter { \arabic { chapter } }
    \IfDocumentMetadataTF
      {
        \addtocontents { toc }
          { \def \protect \chaptername { \appendixname } }
        \cs_new:Nn \@@_appendix_number_format:n
          {
            \int_compare:nNnT
              { \sblbook@appendix@state } > { 1 }
              { \theheading }
          }
        \cs_new:Nn \@@_appendix_prefix_number_sep:
          {
            \int_compare:nNnTF
              { \sblbook@appendix@state } > { 1 }
              { 0.5em }
              { 0em }
          }
        \EditInstance { heading } { chapter }
          {
            , number-format = \@@_appendix_number_format:n
            , prefix        = \appendixname
          }
        \EditInstance { headformat } { chapter }
          {
            , prefix-number-sep = \@@_appendix_prefix_number_sep:
          }
        \DeclareDocumentCommand \chapter { s = { shorttitle } o m }
          {
            \legacy_if:nTF { @mainmatter }
              {
                \bool_if:nF {##1}
                  {
                    \int_compare:nNnT { \sblbook@appendix@state } < { 2 }
                      { \int_gincr:N \sblbook@appendix@state }
                  }
                \ParseLaTeXeHeading { chapter } {##1} {##2} {##3}
              }
              {
                \bool_if:nTF {##1}
                  {
                    \ParseLaTeXeHeading { chapter } {##1} {##2} {##3}
                  }
                  {
                    \tl_if_novalue:nTF {##2}
                      {
                        \ParseLaTeXeHeading { chapter } { \c_true_bool }
                          { shorttitle = {##3} } {##3}
                      }
                      {
                        \ParseLaTeXeHeading { chapter } { \c_true_bool }
                          {##2} {##3}
                      }
                  }
              }
          }
      }
      {
        \titleformat
          { \chapter }
          [ display ]
          {
            \normalfont \Large \filcenter
          }
          {
            \int_compare:nNnT { \sblbook@appendix@state } < { 2 }
              { \int_gincr:N \sblbook@appendix@state }
            \appendixname
            \int_compare:nNnT { \sblbook@appendix@state } > { 1 }
              {
                \space \thechapter
              }
          }
          { 12pt }
          { }
        \titlecontents { chapter }
          [ 2em ]
          {
            \hspace* { -2em }
            \filright
          }
          {
            \sblbook@hyperlink
              { \Hy@tocdestname }
              {
                \appendixname
                \ifnum \sblbook@appendix@state > 1
                  \strut \space \thecontentslabel
                \fi
                : \enspace
              }
          }
          { }
          { \hspace { 0.5em } \titlerule* [ 0.65pc ] { . } \contentspage }
      }
  }
%    \end{macrocode}
%
%    \begin{macrocode}
\hook_gput_code:nnn
  { cmd / appendix / after }
  { sblbook }
  { \@@_set_up_appendices: }
%    \end{macrocode}
%
% \subsection{Bibliography and list of abbreviations}
%
%    \begin{macrocode}
\cs_set_nopar:Npn \bibfont { \small }
\dim_set:Nn \bibhang { 0.25in }
\dim_set:Nn \biblabelsep { 0.25in }
%    \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}
%</class>
%    \end{macrocode}
