File: newfloat.sty.ltxml

package info (click to toggle)
latexml 0.8.8-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,920 kB
  • sloc: xml: 109,048; perl: 30,224; sh: 179; javascript: 28; makefile: 13
file content (91 lines) | stat: -rw-r--r-- 4,037 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
# -*- mode: Perl -*-
# /=====================================================================\ #
# |  newfloat                                                           | #
# | 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.     | #
# |---------------------------------------------------------------------| #
# | Thanks to the arXMLiv group for initial implementation              | #
# |    http://arxmliv.kwarc.info/                                       | #
# | Released to the Public Domain                                       | #
# |---------------------------------------------------------------------| #
# | 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;

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Package options (keywords)
#  within=<counter> or none [resets figure & table]
#  chapterlistsgap=value

# \DeclareFloatingEnvironment[options]{type}
# \SetupFloatingEnvironment[options]{type}
# options:
#  fileext=ext  [default=lo<type>]
#  listname=    [default="List of <type>s]
#  placement= [htbp] [default=tbp]
#  within = counter  [default=chapter, if any]
# chapterlistsgap=on/off
#
DefPrimitive('\SetupFloatingEnvironment OptionalKeyVals {}', sub {
    my ($stomach, $options, $type) = @_;
    $type = ToString($type);
    my $within = $options && ToString($options->getValue('within'));
    NewCounter($type, $within);
    my $inlist = $options && $options->getValue('fileext');
    DefMacroI('\ext@' . $type, undef, $inlist || 'lo' . $type);
    my $name = $options && ToString($options->getValue('listname'));
    DefMacroI('\\' . $type . 'name', undef, $name || 'List of ' . $type . 's');
    # Ignore placement, chapterlistgap
});
DefPrimitive('\DeclareFloatingEnvironment OptionalKeyVals {}', sub {
    my ($stomach, $options, $type) = @_;
    $type = ToString($type);
    my $within = $options && ToString($options->getValue('within'));
    NewCounter($type, $within);
    my $inlist = $options && $options->getValue('fileext');
    DefMacroI('\ext@' . $type, undef, $inlist || 'lo' . $type);
    my $name = $options && ToString($options->getValue('listname'));
    # Presumably should get the default float fonts?
    DefMacroI('\fnum@font@' . $type,         undef, '\fnum@font@float');
    DefMacroI('\format@title@font@' . $type, undef, '\format@title@font@float');

    DefMacroI('\\' . $type . 'name', undef, $name || 'List of ' . $type . 's');
    # Ignore placement, chapterlistgap

    # Do we need any \the, \fnum@, \format@title, etc?

    DefEnvironmentI($type, "[]",
      "<ltx:float xml:id='#id' ?#1(placement='#1') inlist='#inlist' class='ltx_float_$type'>"
        . "#tags"
        . "#body"
        . "</ltx:float>",
      properties   => { layout => 'vertical' },
      beforeDigest => sub { beforeFloat($type); },
      afterDigest  => sub { afterFloat($_[1]); });

    DefEnvironmentI("$type*", "[]",
      "<ltx:float xml:id='#id' ?#1(placement='#1') inlist='#inlist' class='ltx_float_$type'>"
        . "#tags"
        . "#body"
        . "</ltx:float>",
      properties   => { layout => 'vertical' },
      beforeDigest => sub { beforeFloat($type, double => 1); },
      afterDigest  => sub { afterFloat($_[1]); });
});

# \ForEachFloatingEnvironment{code{#1}}
# \PrepareListOf{type}{code}

# Ignore (for now)
DefMacro('\ForEachFloatingEnvironment{}', '');
DefMacro('\PrepareListOf{}{}',            '');

#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1;