1# -*- mode: Perl -*-
2# /=====================================================================\ #
3# |  epsf                                                               | #
4# | Implementation for LaTeXML                                          | #
5# |=====================================================================| #
6# | Part of LaTeXML:                                                    | #
7# |  Public domain software, produced as part of work done by the       | #
8# |  United States Government & not subject to copyright in the US.     | #
9# |---------------------------------------------------------------------| #
10# | Bruce Miller <bruce.miller@nist.gov>                        #_#     | #
11# | http://dlmf.nist.gov/LaTeXML/                              (o o)    | #
12# \=========================================================ooo==U==ooo=/ #
13package LaTeXML::Package::Pool;
14use strict;
15use warnings;
16use LaTeXML::Package;
17
18#**********************************************************************
19# (See  LaTeXML::Post::Graphics for suggested postprocessing)
20# Provides alternative argument syntax.
21RawTeX(<<'EOTeX');
22\newif\ifepsfatend
23\newif\ifepsfdraft
24\newif\ifepsfframe
25\newif\ifepsfshow
26\epsfshowtrue
27\newif\ifepsfshowfilename
28\newif\ifepsfverbose
29\newdimen\epsfframemargin
30\newdimen\epsfframethickness
31\newdimen\epsfxsize
32\newdimen\epsfysize
33\newdimen\pspoints
34\pspoints = 1bp
35\epsfxsize = 0pt
36\epsfysize = 0pt
37\epsfframemargin = 0pt
38\epsfframethickness = 0.4pt
39EOTeX
40
41DefPrimitive('\epsfclipon',  sub { AssignValue(epsf_clip => 1); return; });
42DefPrimitive('\epsfclipoff', sub { AssignValue(epsf_clip => 0); return; });
43DefConstructor('\epsfbox[] Semiverbatim', sub {
44    my ($document, $bb, $graphic) = @_;
45    my $clip = LookupValue('epsf_clip');
46    my $options = ($clip ? ($bb ? "viewport=$bb, clip" : "clip") : '');
47    $graphic = ToString($graphic); $graphic =~ s/^\s+//; $graphic =~ s/\s+$//;
48    my @candidates = pathname_findall($graphic, types => ['*'], paths => LookupValue('GRAPHICSPATHS'));
49    if (my $base = LookupValue('SOURCEDIRECTORY')) {
50      @candidates = map { pathname_relative($_, $base) } @candidates; }
51    $document->insertElement('ltx:graphics', undef, graphic => $graphic,
52      candidates => join(',', @candidates), options => $options); });
53
54Let('\epsfgetlitbb', '\epsfbox');
55Let('\epsfnormal',   '\epsfbox');
56Let('\epsffile',     '\epsfbox');
57
58DefPrimitive('\epsfgetbb Semiverbatim', undef);
59DefPrimitive('\epsfframe',              undef);    # Ignore (?), and process the arg.
60
61#**********************************************************************
621;
63
64