summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/keytheorems/tex/class-support/keythms-memoir-support.tex
blob: 4fa28040426e8eb60b1d5e9e1dcfb0caedf4f403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
% Maintained by Matthew Bertucci, 2024-present
% Please report all issues and feature requests at https://github.com/mbertucci47/keytheorems
% This work is licensed under the LPPL version 1.3c or later: https://www.latex-project.org/lppl.txt
\ProvidesExplFile{keythms-memoir-support}{2024-09-16}{0.1.2}
  {keytheorems~support~for~the~memoir~class}

\bool_new:N \l__keythms_support_titlecode_bool

\keys_define:nn { keytheorems/listof }
  {
    indent     .initial:n = 0pt,
    title-code .code:n    =
      {
        \bool_set_true:N \l__keythms_support_titlecode_bool
        \cs_set:Npn \__keythms_listof_titlecmd:n ##1 { #1 }
      },
  }

% use memoir's list function; not using \newlistentry, though
\newlistof{ keythms_support_memoir_listof:w }{ thlist }
  { \l__keythms_listof_title_tl }

\RenewDocumentCommand \listofkeytheorems { O{} }
  {
    \bool_gset_true:N \g__keythms_listof_writefile_bool
    \group_begin:
    \keys_set:nn { keytheorems/listof } { #1 }
    \bool_if:NT \l__keythms_listof_nochapskip_bool
      {
        \cs_set_eq:NN \KeyThmsAddvspace \use_none:n
      }
    \bool_if:NTF \l__keythms_listof_notitle_bool
      {
        \cs_set:Npn \@thlistmaketitle {}
        \keythms_support_memoir_listof:w*
      }
      {
        \bool_if:NT \l__keythms_support_titlecode_bool
          {
            \cs_set:Npn \@thlistmaketitle
              { \__keythms_listof_titlecmd:n { \l__keythms_listof_title_tl } }
          }
        \bool_if:NTF \l__keythms_listof_notoc_bool
          { \keythms_support_memoir_listof:w* }
          { \keythms_support_memoir_listof:w }
      }
    \group_end:
  }