MAJOR=1
MINOR=3
DEVNAME=null
DEVMODE=0666
  7   ¯ˆl–Ðz¾”JClÊ‚ÆÛ¸&”Å£�þBä`ufÇ Û!E) ?ŸÛ„|O²ßÚÁ× ?÷     ¯#!/usr/bin/env perl
use v5.26;

############################# LICENCE ##################################
# v0.20  2020-08-24 simplify the use of PSTricks with pdf              #
# (c) Herbert Voss <hvoss@tug.org>                                     #
#     Pablo GonzÃ¡lez L <pablgonz@yahoo.com>                            #
#                                                                      #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 3 of the License, or    #
# (at your option) any later version.                                  #
#                                                                      #
# This program is distributed in the hope that it will be useful, but  #
# WITHOUT ANY WARRANTY; without even the implied warranty of           #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    #
# General Public License for more details.                             #
########################################################################

use Getopt::Long qw(:config bundling_override no_ignore_case); # require_order
use File::Spec::Functions qw(catfile devnull);
use File::Basename;
use Archive::Tar;
use Data::Dumper;
use FileHandle;
use IO::Compress::Zip qw(:all);
use File::Path qw(remove_tree);
use File::Temp qw(tempdir);
use POSIX qw(strftime);
use File::Copy;
use File::Find;
use Env qw(PATH);
use autodie;
use Config;
use Cwd;
use if $^O eq 'MSWin32', 'Win32';
use if $^O eq 'MSWin32', 'Win32::Console::ANSI'; # need for color :)
use Term::ANSIColor;

### Internal vars
my $tempDir = tempdir( CLEANUP => 1); # temporary directory
my $workdir = cwd;      # current working dir
my $imgdir  = 'images'; # where to save the images
my $margins = '1';      # margins in pdfcrop
my $clear   = 0;        # 0 or 1, clears all temporary files
my $dpi     = '300';    # very low value for the png's
my $runs    = '1';      # set runs for compliler
my $nocorp  = 0;        # 1->no crop pdf files created
my $norun   = 0;        # 1->no create images
my $noprew  = 0;        # 1->create images in nopreview mode
my $runbibtex = 0;      # 1->runs bibtex
my $runbiber  = 0;      # 1->runs biber and sets $runbibtex=0
my $xetex  = 0;         # 1->Using (Xe)LaTeX for compilation.
my $luatex = 0;         # 1->Using dvilualatex for compilation.
my $latexmk = 0;        # 1->Using latexmk for compiler output file.
my $arara;              # 1->Using arara for compiler output file.
my $nosource = 0;       # Delete TeX source for images
my $srcenv;             # write only source code of environments
my $nopdf;              # Don't create a pdf image files
my $force;              # try to capture \psset
my $nocrop;             # Don't crop image files
my $zip;                # compress files generated in .zip
my $tar;                # compress files generated in .tar.gz
my $help;               # help info
my $version;            # version info
my $shell;              # enable -shell-escape
my $verbose = 0;        # verbose info
my @verb_env_tmp;       # store verbatim environments
my $tmpverbenv;         # save verbatim environment
my $myverb = 'myverb' ; # internal \myverb macro
my $write18;            # storing write18 for compiler in TeXLive and MikTeX
my $gscmd;              # ghostscript executable name
my $gray;               # gray scale ghostscript
my $log      = 0;       # log file
my $PSTexa   = 0;       # run extract PSTexample environments
my $STDenv   = 0;       # run extract pspicture/psfrag environments
my @currentopt;         # storing current options for log file
my %opts_cmd;           # hash to store options for Getopt::Long  and log

### Script identification
my $scriptname = 'pst2pdf';
my $nv         = 'v0.20';
my $date       = '2020-08-22';
my $ident      = '$Id: pst2pdf.pl 119 2020-08-22 12:04:09Z herbert $';

### Log vars
my $LogFile = "$scriptname.