IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38857


Ignore:
Timestamp:
Oct 13, 2015, 4:46:59 PM (11 years ago)
Author:
watersc1
Message:

Add code to ensure page geometry is set directly so pdflatex can choose the page size correctly. Add render_by_name.text output that attempts to group columns by name so similar fields can be compared without having to track them between tables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/config/render.pl

    r38842 r38857  
    55
    66my @data = ();
     7my %phot_keys = ();
     8
    79
    810open(RR,">./render.tex");
     
    6466                elsif ($_ =~ /\<\/FIELD/) {
    6567                    render_row($name,$datatype1,$unit,$def,$desc);
     68
    6669                    $field = 0;
     70
     71                    # Load the information for the "other way sorted" table
     72                    push @data, [$name, $tab_name, $datatype1, $unit, $def, $desc];
     73                    if ($name =~ /^[DFgrizy]/) {
     74                        (my $possible_phot_key = $name) =~ s/^[DFgrizy]//;
     75                        $phot_keys{$possible_phot_key} ++;
     76                    }
    6777                }
    6878            }
     
    7686}
    7787render_post();
     88close RR;
     89
     90if (1) {
     91    open(RR,">./render_by_name.tex");
     92    # Sort by not-a-phot-key, then phot-key alphabetica, then table sequential.
     93    foreach my $ppk (sort (keys (%phot_keys))) {
     94        if ($phot_keys{$ppk} < 4) {
     95            delete($phot_keys{$ppk});
     96        }
     97    }
     98
     99    my @non_phot_rows = ();
     100    my @phot_rows = ();
     101    for ($i = 0; $i <= $#data; $i++) {
     102        my $is_phot = 0;
     103        foreach my $ppk (sort (keys (%phot_keys))) {
     104            if ($data[$i][0] =~ /^[DFgrizy]?${ppk}$/i) {
     105                push @phot_rows, $data[$i];
     106                $is_phot = 1;
     107                next;
     108            }
     109        }
     110        unless ($is_phot) {
     111            push @non_phot_rows, $data[$i];
     112        }
     113    }
     114   
     115    render_pre();
     116    render_tab2();
     117    foreach my $row (sort { $a->[0] cmp $b->[0] } (@non_phot_rows)) {
     118        render_row2(@{ $row });
     119    }
     120    render_row2('','','','','','');
     121    foreach my $ppk (sort (keys %phot_keys)) {
     122        foreach my $row (@phot_rows) {
     123            if (${ $row }[0] =~ /^[DFgrizy]?${ppk}$/i) {
     124                render_row2(@{ $row });
     125            }
     126        }
     127    }
     128    render_end();
     129    render_bottom();
     130    render_post();
     131   
     132
     133}
    78134
    79135sub pRRx {
     
    88144
    89145sub render_pre {
    90     pRR '\documentclass[10pt,letter]{article}';
     146    pRR '\documentclass[10pt]{article}';
     147    pRR '\usepackage[paperheight=17in,paperwidth=11in]{geometry}';
    91148    pRR '\usepackage{longtable}';
    92149    pRR '\usepackage{lscape}';
     
    100157    pRR '\setlength{\topmargin}{0pt}';
    101158    pRR '\setlength{\footskip}{0pt}';
    102     pRR '\setlength{\textheight}{13.5in}';
     159    pRR '\setlength{\textheight}{16in}';
    103160    pRR '\setlength{\textwidth}{10.5in}';
    104161   
     
    124181    pRR '\setlength{\LTleft}{0pt}';
    125182}
     183sub render_tab2 {
     184    pRR '\footnotesize';
     185    pRR '\begin{center}';
     186    pRR '\begin{longtable}{|l|l|l|l|l|l|}';
     187    pRR '\setlength{\LTleft}{0pt}';
     188}
     189
    126190sub render_row {
    127191    my ($name, $type, $unit, $def, $desc) = @_;
     
    142206}
    143207
     208sub render_row2 {
     209    my ($name, $table, $type, $unit, $def, $desc) = @_;
     210    $name =~ s/^\s+//;
     211    $name =~ s/_/\\_/g;
     212    $unit =~ s/\^([\d\/-]*)/\$^$1\$/g;
     213    $desc =~ s/\^([\d\/-]*)/\$^$1\$/g;
     214    $desc =~ s/_/\\_/g;
     215    $desc =~ s/\&/\\\&/g;
     216    $desc =~ s/\%/\\\%/g;
     217
     218    pRRx '\parbox[t][][t]{1.5in}{\bf ' . $name  . '} & ';
     219    pRRx '\parbox[t][][t]{1.5in}{'     . $table . '} & ';
     220    pRRx '\parbox[t][][t]{1.0in}{'     . $type  . '} & ';
     221    pRRx '\parbox[t][][t]{1.5in}{'     . $unit  . '} & ';
     222    pRRx '\parbox[t][][t]{0.5in}{'     . $def   . '} & ';
     223    pRR  '\parbox[t][][t]{7.8in}{'     . $desc  . '} \\\\' ;
     224
     225}
     226
    144227sub render_end {
    145228    pRR '\end{longtable}';
Note: See TracChangeset for help on using the changeset viewer.