File: caption.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 (134 lines) | stat: -rw-r--r-- 6,217 bytes parent folder | download | duplicates (2)
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# -*- mode: Perl -*-
# /=====================================================================\ #
# |  caption.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;

# Basically all of this is ignorable (other than needing the macros defined).
# In principle, we could make use of some of the fonts...
#RequirePackage('ragged2e');
#RequirePackage('keyval');

# Should learn how to use the new KeyVals code to get these to make appropriate assignments!
# Most caption keyvals are ignorable, though.
DefKeyVal('caption', 'format',      '',          '');      # plain, hang,...
DefKeyVal('caption', 'indentation', 'Dimension', '0pt');
DefKeyVal('caption', 'labelformat', '', 'default'); # default, empty, simple, brace, parens; Use this!
DefKeyVal('caption', 'labelsep',      '', '');    # none, colon, period, space, quad, newline,endash
DefKeyVal('caption', 'textformat',    '', '');    # empty, simple, period
DefKeyVal('caption', 'justification', '', '');    # justified, centering, centerlast, centerfirst,
# raggedright, RaggedRight, raggedleft
DefKeyVal('caption', 'singlelinecheck', '', '');
# These font values are, in effect, keyvals lists!
DefKeyVal('caption', 'font',       '',          '');
DefKeyVal('caption', 'labelfont',  '',          '');
DefKeyVal('caption', 'textfont',   '',          '');
DefKeyVal('caption', 'font+',      '',          '');      # These add to the font
DefKeyVal('caption', 'labelfont+', '',          '');
DefKeyVal('caption', 'textfont+',  '',          '');
DefKeyVal('caption', 'margin',     'Dimension', '0pt');
DefKeyVal('caption', 'margin*',    'Dimension', '0pt');
DefKeyVal('caption', 'minmargin',  'Dimension', '0pt');
DefKeyVal('caption', 'maxmargin',  'Dimension', '0pt');
DefKeyVal('caption', 'parskip',    'Dimension', '0pt');
DefKeyVal('caption', 'width',      'Dimension', '0pt');
DefKeyVal('caption', 'oneside',    '',          '');
DefKeyVal('caption', 'twoside',    '',          '');
DefKeyVal('caption', 'hangindent', 'Dimension', '0pt');

DefKeyVal('caption', 'style', '', '');    # base, ...

DefKeyVal('caption', 'skip',           'Dimension', '0pt');
DefKeyVal('caption', 'position',       '',          '');      #  top, above, bottom, below
DefKeyVal('caption', 'figureposition', '',          '');
DefKeyVal('caption', 'tableposition',  '',          '');

DefKeyVal('caption', 'list',       '', '');                   # boolean (no)
DefKeyVal('caption', 'listformat', '', '');                   # name of list
DefKeyVal('caption', 'name',       '', '');                   # \<float>name ?
DefKeyVal('caption', 'type',       '', '');                   # table or figure

DefMacro('\captionsetup[]{}', Tokens());
DefPrimitive('\captionsetup[] RequiredKeyVals:caption', sub {
    my ($stomach, $ignore, $kv) = @_;
    my $hash = $kv->getKeyVals;
    foreach my $key (keys %$hash) {
      my $value = $kv->getValue($key);
      AssignValue('CAPTION_' . $key => $value); }
    return; });

DefMacro('\DeclareCaptionStyle{}[]{}',        Tokens());
DefMacro('\DeclareCaptionLabelFormat{}{}',    Tokens());
DefMacro('\DeclareCaptionLabelSeparator{}{}', Tokens());

DefMacro('\DeclareCaptionFont{}{}',          Tokens());
DefMacro('\DeclareCaptionFormat{}{}',        Tokens());
DefMacro('\DeclareCaptionJustification{}{}', Tokens());
DefMacro('\DeclareCaptionOption{}[]{}',      Tokens());
DefMacro('\DeclareCaptionPackage{}',         Tokens());

DefMacro('\bothIfFirst{}{}', sub {
    my ($gullet, $first, $second) = @_;
    (IsEmpty($first) ? () : ($first->unlist, $second->unlist)); });

DefMacro('\bothIfSecond{}{}', sub {
    my ($gullet, $first, $second) = @_;
    (IsEmpty($second) ? () : ($first->unlist, $second->unlist)); });

DefMacro('\AtBeginCaption{}',       Tokens());
DefMacro('\AtEndCaption{}',         Tokens());
DefMacro('\ContinuedFloat',         Tokens());
DefMacro('\ProcessOptionsWithKV{}', Tokens());

DefMacro('\captionfont', Tokens());
DefMacro('\captionsize', Tokens());

DefRegister('\captionparindent'  => Dimension(0));
DefRegister('\captionindent'     => Dimension(0));
DefRegister('\captionhangindent' => Dimension(0));
DefRegister('\captionmargin'     => Dimension(0));
DefRegister('\captionwidth'      => Dimension(0));

DefMacro('\caption',
  '\lx@donecaptiontrue
 \@ifundefined{@captype}
    {\maybe@@generic@caption}
    {\@ifstar{\@scaption}{\expandafter\@caption\expandafter{\@captype}}}');
DefMacro('\@scaption {}', '\@@caption{#1}');

# Check if caption type set by \captionsetup
DefMacro('\maybe@@generic@caption', sub {
    if (my $type = LookupValue('CAPTION_type')) {
      return Tokens(T_CS('\@captionof'), T_BEGIN, $type, T_END); }
    else {
      return T_CS('\@@generic@caption'); } });
# This is a horrible thing that fakes a caption anywhere.
# It isn't necessarily IN a figure or any float, so we'll wrap it in an otherwise empty one!
DefMacro('\captionof', '\@ifstar{\@scaptionof}{\@captionof}');
DefMacro('\@captionof{}[]{}',
  '\@ifnext\label{\@captionof@postlabel{#1}{#2}{#3}}{\@captionof@{#1}{#2}{#3}}');
# Check for trailing \label!
DefMacro('\@captionof@postlabel{}{}{} SkipMatch:\label Semiverbatim',
  '\@captionof@{#1}{#2}{#3\label{#4}}');
DefMacro('\@captionof@ {}{}{}',
  '\begin{#1}\@caption@{#1}{#2}{#3}\end{#1}');

DefMacro('\@scaptionof {}{}',
  '\begin{#1*}\@scaption{#2}\end{#1*}');

DefMacro('\clearcaptionsetup',    Tokens());
DefMacro('\rotcaption',           Tokens());
DefMacro('\showcaptionsetup[]{}', Tokens());

1;