File: subfloat.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 (97 lines) | stat: -rw-r--r-- 4,043 bytes parent folder | download | duplicates (3)
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
# -*- mode: Perl -*-
# /=====================================================================\ #
# |  subfloat                                                           | #
# | 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;
#======================================================================
# Note that here, subfigures is a container for figures
# rather than a sub-figure within a figure!
DefMacro('\subfiguresbegin', '\begin{subfigures}');
DefMacro('\subfiguresend',   '\end{subfigures}');
DefMacro('\subtablesbegin',  '\begin{subtables}');
DefMacro('\subtablesend',    '\end{subtables}');

NewCounter('subfloatfigure', 'figure', idprefix => 'sf', idwithin => 'figure');
NewCounter('subfloattable',  'table',  idprefix => 'st', idwithin => 'table');
DefMacro('\thesubfloatfigure', '\themainfigure\alph{subfloatfigure}');
DefMacro('\thesubfloattable',  '\themaintable\alph{subfloattable}');
DefMacroI('\subfloatfigurename', undef, 'Figure');
DefMacroI('\subfloattablename',  undef, 'Table');

#DefMacro('\thesubfigure', '\alph{subfigure}');
#DefMacro('\thesubtable',  '\alph{subtable}');

DefMacro('\fnum@subfigure', '(\thesubfigure)');

DefEnvironment('{subfigures}',
  "<ltx:figure xml:id='#id' inlist='#inlist'>"
    . "#tags"
    . "#body"
    . "</ltx:figure>",
  properties   => sub { RefStepCounter('figure'); },    # No caption (?)
  beforeDigest => sub {
    Let('\themainfigure', '\thefigure');
    beforeFigure('figure');
    # redefine figure!
    DefEnvironment('{figure}[]',
      "<ltx:figure xml:id='#id' ?#1(placement='#1')>"    # NO inlist for subfigures!(?)
        . "#tags"
        . "#body"
        . "</ltx:figure>",
      properties   => { layout => 'vertical' },
      beforeDigest => sub { beforeFloat('subfloatfigure'); },
      afterDigest  => sub { afterFloat($_[1]); });
    DefEnvironment('{figure*}[]',
      "<ltx:figure xml:id='#id' ?#1(placement='#1')>"
        . "#tags"
        . "#body"
        . "</ltx:figure>",
      properties   => { layout => 'vertical' },
      beforeDigest => sub { beforeFloat('subfloatfigure', double => 1); },
      afterDigest  => sub { afterFloat($_[1]); });
  },
  afterDigest => sub { afterFloat($_[1]); });

DefMacro('\fnum@subtable', '(\thesubtable)');
DefEnvironment('{subtables}',
  "<ltx:table xml:id='#id' inlist='#inlist'>"
    . "#tags"
    . "#body"
    . "</ltx:table>",
  properties   => sub { RefStepCounter('table'); },    # No caption (?)
  beforeDigest => sub {
    Let('\themaintable', '\thetable');
    beforeFigure('table');
    # redefine table!
    DefEnvironment('{table}[]',
      "<ltx:table xml:id='#id' ?#1(placement='#1')>"    # NO inlist for subtables! (?)
        . "#tags"
        . "#body"
        . "</ltx:table>",
      properties   => { layout => 'vertical' },
      beforeDigest => sub { beforeFloat('subfloattable'); },
      afterDigest  => sub { afterFloat($_[1]); });
    DefEnvironment('{table*}[]',
      "<ltx:table xml:id='#id' ?#1(placement='#1')>"
        . "#tags"
        . "#body"
        . "</ltx:table>",
      properties   => { layout => 'vertical' },
      beforeDigest => sub { beforeFloat('subfloattable', double => 1); },
      afterDigest  => sub { afterFloat($_[1]); });
  },
  afterDigest => sub { afterFloat($_[1]); });

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