Jessica Holle wrote:
I've some questions about the Image Database.
I found no answers in the xfigure.pdf.

Can I generate the xml file automaticly?
I can use xmltools --dir --pattern=/home/tralal/*.jpg
--output=tralala.xml
but then in the xml file doesn't stad figure, there is file. so this
doesn't work I think.

Humble, I do not know what xmltools all can do. I use a perl-sript to generate the xml-file. - Please have a look into the attached file make-xml.pl

Must everything be in the same folder? the xmlfile, the images and
my document I'm writing?
Or can I specify a directory in the xmlfile? So that the images can
be on an other folder than the xmlfile?
Normally I prepare a directory with the figures. The xml-file is then generated and compiled. The resulting figure-databse I transfer then to the directory where the tex files reside.



Must the xmlfile be in the same directory than my document?

I hope this will help you.
Kind regards

Willi

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context
#!/usr/bin/perl

## Prepare an XML-file for the preparation of a figure-database with TeX

## XML-file header information:

$Librarylanguage = "en";
$Organization = "Willi";
$Project = "Restauratie";
$Product = "Restauratie-cursus ";
$Comment = "Figure database";
$CopyRight = "WE" ;


## Variables

$Filename = "";
$FileextensionA = "pdf";
$FileextensionB = "png";
#~ $FileextensionC = "1";
$Filedate = "";
$Filetimestamp ;
$Filesize= "";
$Globstring = "*." . $FileextensionA;
$Outfile = ">Figure-lib.xml";

## Date
($Second, $Minute, $Hour, $DayOfMonth, $Month, $Year, $WeekDay, $DayOfYear, 
$IsDST) = localtime(time);
$RealMonth = $Month +1 ;
$RealYear  = $Year + 1900 ;

printf ('%02d.%02d.%04d', $DayOfMonth,$RealMonth,$RealYear);
print   "\n";

## Open the XML-file for writing:
open(OUTFILE, $Outfile);

## Print XML-file header:
Header();

## Collect Figure files into an list:

@Files = glob($Globstring);
$Globstring = "*." . $FileextensionB;
@MoreFiles = glob($Globstring);
push(@Files, @MoreFiles);
#~ $Globstring = "*." . $FileextensionC;
#~ @MoreFiles = glob($Globstring);
#~ push(@Files, @MoreFiles);

## Work on each filename:

foreach $Filename (@Files) {

    #~ $exifinfo = `identify -verbose -format "%[EXIF:*]" $Filename`;
    #~ chomp($exifinfo);
    #~ if(length($exifinfo) < 2){
        #~ $Filetimestamp = (-C $Filename) ;
        #~ $Filedatestamp = time - $Filetimestamp ;
        #~ ($Second, $Minute, $Hour, $DayOfMonth, $Month, $Year, $WeekDay, 
$DayOfYear, $IsDST) = localtime($Filedatestamp);
        #~ $RealMonth = $Month +1 ;
        #~ $RealYear  = $Year + 1900 ;
        #~ $FileDate = $DayOfMonth . "." . $RealMonth . "." . $RealYear ;
    #~ }
    #~ else {
        #~ @exiflines = split(/\n/,$exifinfo);
        #~ foreach $exifline (@exiflines){
        #~ ($exifHeader,$exifData) = split(/=/,$exifline,2);
        #~ if($exifHeader eq "DateTimeOriginal"){
            #~ $FileDate = substr($exifData,8,2) . "." . substr($exifData,5,2) 
. "." . substr($exifData,0,4);
        #~ }
        #~ }
    #~ }
    $Filesize = (-s $Filename) ;
    if ($Filesize > 1024){
        $Filesize = int($Filesize / 1024) . "k";
        }
## Determine first part of filename -> label in figure library
($Label,$Suffix) = split (/\./,$Filename) ;

## Print the XMLblock for the actual figurefile:

Printfigureblock();
}

print OUTFILE  "</figurelibrary>";

close(OUTFILE);

## End of main programme.


sub Header{
    print OUTFILE "<!-- Figurelibrary: $Outfile -->\n" ;
    print OUTFILE "<!-- Date of generation:" ;
    printf OUTFILE ('%02d.%02d.%04d', $DayOfMonth,$RealMonth,$RealYear) ;
    print OUTFILE "-->\n" ;
    print OUTFILE "<!-- Figurelibrary generated automatically by PERL -->\n" ;
    print OUTFILE "<!-- Script by W. Egger, 27.04.2003 -->\n" ;
    print OUTFILE  "\n" ;
    print OUTFILE "<!-- Generation of a PDF file with the database: texexec 
--pdf --use=fig-make figure-lib.xml -->\n" ;
    print OUTFILE  "\n" ;
    print OUTFILE  "<figurelibrary language=\"$Librarylanguage\">\n" ;
    print OUTFILE  "\n" ;
    print OUTFILE  "   <description>\n" ;
    print OUTFILE  "       <organization>$Organization</organization>\n" ;
    print OUTFILE  "       <project>$Project</project>\n" ;
    print OUTFILE  "       <product>$Product</product>\n" ;
    print OUTFILE  "       <comment>$Comment</comment>\n" ;
    print OUTFILE  "   </description>\n" ;
    print OUTFILE  "\n" ;
}

sub Printfigureblock{
    print OUTFILE  "<figure>\n" ;
    print OUTFILE  "   <file>" . lc($Filename) . "</file>\n" ;
        print OUTFILE  "   <label>" .lc($Label). "</label>\n" ;
    print OUTFILE  "   <copyright>$CopyRight</copyright>\n" ;
    print OUTFILE  "   <comment>$FileDate " . $Filesize . "B</comment>\n" ;
    print OUTFILE  "</figure>\n\n" ;

    print "Finished figureblock: $Filename\n";
}
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to