File: appendix.sty.ltxml

package info (click to toggle)
latexml 0.8.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 29,128 kB
  • sloc: xml: 98,982; perl: 29,706; sh: 179; javascript: 28; makefile: 15
file content (103 lines) | stat: -rw-r--r-- 4,145 bytes parent folder | download | duplicates (4)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# -*- mode: Perl -*-
# /=====================================================================\ #
# | appendix.sty                                                        | #
# | Implementation for LaTeXML                                          | #
# |=====================================================================| #
# | Part of LaTeXML:                                                    | #
# |  Public domain software, produced as part of work done by the       | #
# |  United States Government & not subject to copyright in the US.     | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov>                        #_#     | #
# | http://dlmf.nist.gov/LaTeXML/                              (o o)    | #
# \=========================================================ooo==U==ooo=/ #
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;

#======================================================================
#  /--------------------------------------------------------------------\
# | INCOMPLETE IMPLEMENTATION                                            |
# | remove this comment, when done.                                      |
# | Drafted by texscan --stub appendix.sty                               |
#  \--------------------------------------------------------------------/
# options:
#  toc, page, title, titletoc, header

# Something like a \part*{Appendices}
# DefMacro('\appendixpage',Tokens());
# And add it to the toc
# DefMacro('\addappheadtotoc',Tokens());

DefMacro('\appendixname',     "Appendix");
DefMacro('\appendixtocname',  "Appendices");
DefMacro('\appendixpagename', "Appendices");

# Whether the entry in toc gets page number; Ignorable
DefMacro('\appendicestocpagenum',   Tokens());
DefMacro('\noappendicestocpagenum', Tokens());

# Switches, mostly ignorable(?)
DefConditional('\if@dotoc@pp');
DefConditional('\if@dotitle@pp');
DefConditional('\if@dotitletoc@pp');
DefConditional('\if@dohead@pp');
DefConditional('\if@dopage@pp');

DefMacro('\appendixtocon',       '\@dotoc@pptrue');
DefMacro('\appendixtocoff',      '\@dotoc@ppfalse');
DefMacro('\appendixpageon',      '\@dopage@pptrue');
DefMacro('\appendixpageoff',     '\@dopage@ppfalse');
DefMacro('\appendixtitleon',     '\@dotitle@pptrue');
DefMacro('\appendixtitleoff',    '\@dotitle@ppfalse');
DefMacro('\appendixtitletocon',  '\@dotitletoc@pptrue');
DefMacro('\appendixtitletocoff', '\@dotitletoc@ppfalse');
DefMacro('\appendixheaderon',    '\@dohead@pptrue');
DefMacro('\appendixheaderoff',   '\@dohead@ppfalse');

# DefMacro('\phantomsection',Tokens());

# DefMacro('\restoreapp',Tokens());

# DefMacro('\sectionname',Tokens());
# DefMacro('\subsectionname',Tokens());

DefMacro('\setthesection',    '\Alph{section}');
DefMacro('\setthesubsection', '\thesection.\Alph{subsection}');

DefPrimitive('\lx@pp@appendix@begin', sub {
    if (LookupDefinition(T_CS('\c@chapter'))) {
      beginAppendices('chapter'); }
    else {
      beginAppendices('section'); } });

DefConstructor('\lx@pp@appendix@end', sub {
    $_[0]->maybeCloseElement('ltx:appendix'); },
  beforeDigest => sub { endAppendices(); });

# Adjust numbering!!!
DefPrimitive('\lx@pp@subappendix@begin', sub {
    if (LookupDefinition(T_CS('\c@chapter'))) {
      beginAppendices('section'); }
    else {
      beginAppendices('subsection'); } });

#DefEnvironment('{appendices}','#body');
DefMacro('\appendices',
  '\lx@pp@appendix@begin'
    . '\if@dotoc@pp\addappheadtotoc\fi'
    . '\if@dopage@pp\appendixpage\fi'
    . '\if@dotitle@pp\def\fnum@appendix{\lx@refnum@compose{\appendixname}{\lx@the@@{appendix}}}\fi'
    . '\if@dotitle@pp\def\fnum@toc@appendix{\lx@refnum@compose{\appendixname}{\lx@the@@{appendix}}}\fi'
);

# These must END appendices!!!!
# AND CLOSE an open appendix!
DefMacro(T_CS('\endappendices'), '\lx@pp@appendix@end');

# DefEnvironment('{subappendices}','#body');
DefMacro(T_CS('\subappendices'),    '\lx@pp@subappendix@begin');
DefMacro(T_CS('\endsubappendices'), '\lx@pp@appendix@end');

#======================================================================
1;