File: array.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 (74 lines) | stat: -rw-r--r-- 3,588 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
# -*- mode: Perl -*-
# /=====================================================================\ #
# |  array                                                              | #
# | 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;

DefRegister('\extrarowheight' => Dimension('0pt'));

# Not sure how to effect these
DefMacroI('\firsthline', undef, '\hline');
DefMacroI('\lasthline',  undef, '\hline');

DefColumnType('>{}', sub { $LaTeXML::BUILD_TEMPLATE->addBeforeColumn($_[1]->unlist); return; });
DefColumnType('<{}', sub { $LaTeXML::BUILD_TEMPLATE->addAfterColumn($_[1]->unlist);  return; });

# This is the same as p
# but really needs to specify vertical alignment as centered
DefColumnType('m{Dimension}', sub {
    $LaTeXML::BUILD_TEMPLATE->addColumn(before => Tokens(T_CS('\vtop'), T_BEGIN),    #Tokens(T_BEGIN),
      after => Tokens(T_END),
      align => 'justify', width => $_[1], vattach => 'middle'); return; });
# This is also the same as p
# but really needs to specify vertical alignment as bottom
DefColumnType('b{Dimension}', sub {
    $LaTeXML::BUILD_TEMPLATE->addColumn(before => Tokens(T_CS('\vbox'), T_BEGIN),    #Tokens(T_BEGIN),
      after => Tokens(T_END),
      align => 'justify', width => $_[1], vattach => 'bottom'); return; });

# Like @{}, but should NOT suppress intercolumn space
DefColumnType('!{}', sub {
    my ($gullet, $filler) = @_;
    $LaTeXML::BUILD_TEMPLATE->addBetweenColumn($filler->unlist); return; });

# Tentative: The following two are (as yet) untested....
# I don't have current array.sty
# Apparently the width is being ignored when alignment is not 'justify'...
# Check this out against expected behaviour in LaTeX.
DefColumnType('w{}{Dimension}', sub {
    my ($gullet, $align, $width) = @_;
    $align = ToString($align);
    my %alignments = (l => 'left', c => 'center', r => 'right');
    my $alignment  = $alignments{$align} || 'center';
    $LaTeXML::BUILD_TEMPLATE->addColumn(before => Tokens(T_CS('\vtop'), T_BEGIN),
      after => Tokens(T_END),
      align => $alignment, width => $width); return; });

DefColumnType('W{}{Dimension}', sub {
    my ($gullet, $align, $width) = @_;
    $align = ToString($align);
    my %alignments = (l => 'left', c => 'center', r => 'right');
    my $alignment  = $alignments{$align} || 'center';
    $LaTeXML::BUILD_TEMPLATE->addColumn(before => Tokens(T_CS('\vtop'), T_BEGIN),
      after => Tokens(T_END),
      align => $alignment, width => $width); return; });

# NOTE:  Come back & check this; is the arglist right??
DefPrimitive('\newcolumntype{}[Number][]{}', sub {
    my ($stomach, $char, $nargs, $opt, $replacement) = @_;
    DefMacroI(T_CS('\NC@rewrite@' . ToString($char)), convertLaTeXArgs($nargs, $opt), $replacement);
    return AddToPreamble(T_CS('\newcolumntype'), $char, $nargs, $opt, $replacement); });

DefMacro('\arraybackslash', '\let\\\\\tabularnewline');
1;