summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-08-24 20:34:28 +0000
committerKarl Berry <karl@freefriends.org>2019-08-24 20:34:28 +0000
commitfe171dd7fb9ebc1f289d3d2bc3925f332776e65a (patch)
tree870174b216ff50b425253689539c5308cbbb11d5 /Master
parent509b34215883ebf181d665743177ea82522fa13c (diff)
ltximg (24aug19)
git-svn-id: svn://tug.org/texlive/trunk@51951 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/support/ltximg/README.md4
-rw-r--r--Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdfbin147447 -> 147577 bytes
-rwxr-xr-xMaster/texmf-dist/scripts/ltximg/ltximg.pl95
-rw-r--r--Master/texmf-dist/source/support/ltximg/ltximg-doc.dtx61
4 files changed, 67 insertions, 93 deletions
diff --git a/Master/texmf-dist/doc/support/ltximg/README.md b/Master/texmf-dist/doc/support/ltximg/README.md
index a04221a2310..de487ceabde 100644
--- a/Master/texmf-dist/doc/support/ltximg/README.md
+++ b/Master/texmf-dist/doc/support/ltximg/README.md
@@ -32,7 +32,7 @@ and directories is not supported. If the last `[<options>]` take a *list separat
[default]
-h, --help Display command line help and exit [off]
-l, --license Display GPL license and exit [off]
--v, --version Display current version (1.6) and exit [off]
+-v, --version Display current version (1.7) and exit [off]
-t, --tif Create .tif files using ghostscript [gs]
-b, --bmp Create .bmp files using ghostscript [gs]
-j, --jpg Create .jpg files using ghostscript [gs]
@@ -111,7 +111,7 @@ License for more details.
## Author
-Written by Pablo González L <pablgonz@yahoo.com>, last update 2019-07-13.
+Written by Pablo González L <pablgonz@yahoo.com>, last update 2019-08-24.
## Copyright
diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf
index c862cfd8ba2..b6c3abc991d 100644
--- a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf
+++ b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/scripts/ltximg/ltximg.pl b/Master/texmf-dist/scripts/ltximg/ltximg.pl
index 676c96fa72e..3b61635e426 100755
--- a/Master/texmf-dist/scripts/ltximg/ltximg.pl
+++ b/Master/texmf-dist/scripts/ltximg/ltximg.pl
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-use v5.24;
+use v5.26;
use File::Basename;
use Getopt::Long qw(:config bundling_values require_order no_ignore_case);
use File::Temp qw(tempdir);
@@ -21,16 +21,16 @@ my $null = devnull();
### Program identification
my $program = "LTXimg";
-my $nv = 'v1.6';
+my $nv = 'v1.7';
my $copyright = <<END_COPYRIGHT ;
-[2019-07-13] (c) 2013-2019 by Pablo Gonzalez, pablgonz<at>yahoo.com
+[2019-08-24] (c) 2013-2019 by Pablo Gonzalez, pablgonz<at>yahoo.com
END_COPYRIGHT
### Default values
-my $prefix = 'fig'; # defaul prefix for extract files
+my $prefix = 'fig'; # defaul prefix for extract files
my $skiptag = 'noltximg'; # internal tag for regex
my $extrtag = 'ltximg'; # internal tag for regex
-my $imageDir = "images"; # dir for images
+my $imageDir = "images"; # dir for images
my $verbcmd = "myverb"; # set \myverb command
my $margins = "0"; # margins for pdfcrop
my $DPI = "150"; # dpi for image formats
@@ -267,10 +267,10 @@ END_LICENSE
my $title = "$program $nv $copyright";
my $usage = <<"END_OF_USAGE";
${title}** Description **
- LTXimg is a "perl" script that automates the process of extracting and
+ LTXimg is a "perl" script that automates the process of extracting and
converting "environments" provided by tikz, pstricks and other packages
- from LaTeX file to image formats in "individual files" using ghostscript
- and poppler-utils. Generates a one file with only extracted environments
+ from LaTeX file to image formats in "individual files" using ghostscript
+ and poppler-utils. Generates a one file with only extracted environments
and other with all extracted environments converted to \\includegraphics.
** Syntax **
@@ -281,11 +281,11 @@ ${title}** Description **
\$ ltximg --arara [<options>] <file.tex>
\$ ltximg [<options>] <file.tex>
\$ ltximg <file.tex>
-
+
If used without [<compiler>] and [<options>] the extracted environments
are converted to pdf image format and saved in the "/images" directory
- using "pdflatex" and "preview" package. Relative or absolute paths for
- directories and files is not supported. If the last option take a list
+ using "pdflatex" and "preview" package. Relative or absolute paths for
+ directories and files is not supported. If the last option take a list
separated by commas, you need -- at the end.
** Default environments extract **
@@ -306,26 +306,26 @@ ${title}** Description **
-g, --gray Gray scale for images using ghostscript [off]
-f, --force Capture "\\psset" and "\\tikzset" to extract [off]
-n, --noprew Create images files whitout "preview" package [off]
--d <integer>, --dpi <integer>
+-d <integer>, --dpi <integer>
Dots per inch resolution for images [150]
--m <integer>, --margin <integer>
+-m <integer>, --margin <integer>
Set margins for pdfcrop [0]
--imgdir <dirname> Set name of directory to save images [images]
--zip Compress files generated in .zip format [off]
--tar Compress files generated in .tar.gz format [off]
--o <filename>, --output <filename>
+-o <filename>, --output <filename>
Create output file [off]
--verbose Verbose printing [off]
--srcenv Create files whit only code environment [off]
--subenv Create files whit preamble and code [off]
---latex Using latex>dvips>ps2pdf for compiler input
+--latex Using latex>dvips>ps2pdf for compiler input
and pdflatex for compiler output [off]
---dvips Using latex>dvips>ps2pdf for compiler input
- and latex>dvips>ps2pdf for compiler output [off]
+--dvips Using latex>dvips>ps2pdf for compiler input
+ and latex>dvips>ps2pdf for compiler output [off]
--arara Use arara for compiler input and output [off]
--xetex Using xelatex for compiler input and output [off]
--dvipdf Using dvipdfmx for compiler input and output [off]
---luatex Using lualatex for compiler input and output [off]
+--luatex Using lualatex for compiler input and output [off]
--prefix <string> Set prefix append to each image file [off]
--norun Run script, but no create images files [off]
--nopdf Don't create a ".pdf" image files [off]
@@ -342,17 +342,17 @@ ${title}** Description **
** Example **
\$ ltximg --latex -e -p --srcenv --imgdir=mypics -o test-out test-in.ltx
\$ ltximg --latex -ep --srcenv --imgdir mypics -o test-out test-in.ltx
-
+
Create a "/mypics" directory whit all extracted environments converted to
image formats (.pdf, .eps, .png), individual files whit source code (.tex)
- for all extracted environments, a file "test-out.ltx" whit all extracted
- environments converted to \\includegraphics and file "test-in-fig-all.tex"
- with only the extracted environments using latex>dvips>ps2pdf and preview
+ for all extracted environments, a file "test-out.ltx" whit all extracted
+ environments converted to \\includegraphics and file "test-in-fig-all.tex"
+ with only the extracted environments using latex>dvips>ps2pdf and preview
package for <input file> and pdflatex for <output file>.
** Documentation **
For extended documentation use:
- \$ texdoc ltximg
+ \$ texdoc ltximg
END_OF_USAGE
### Error in command line
@@ -408,7 +408,7 @@ my $result=GetOptions (
'debug!' => \$debug, # debug mode
'verbose!' => \$verbose, # debug mode,
) or die $usage;
-
+
### Remove white space and '=' in array captured from command line
s/^\s*(\=):?|\s*//mg foreach @extr_env_tmp;
s/^\s*(\=):?|\s*//mg foreach @skip_env_tmp;
@@ -529,8 +529,8 @@ push (@verb_env_tmp, @verb_tmp);
### Default verbatim write environment
my @verbw_tmp = qw (
- filecontents tcboutputlisting tcbexternal tcbwritetmp extcolorbox extikzpicture
- VerbatimOut verbatimwrite PSTexample filecontentsdef filecontentshere
+ scontents filecontents tcboutputlisting tcbexternal tcbwritetmp extcolorbox extikzpicture
+ VerbatimOut verbatimwrite PSTexample filecontentsdef filecontentshere filecontentsdefmacro
);
push (@verw_env_tmp, @verbw_tmp);
@@ -867,13 +867,14 @@ my $del = $no_del;
my $llaves = qr/\{ .+? \} /x;
my $no_llaves = qr/(?: $llaves )? /x;
my $corchetes = qr/\[ .+? \] /x;
-my $nestedbr = qr/(\{(?:[^\{\}]++|(?1))*\}) /x;
+my $nestedbr = qr/(\{(?>[^\{\}\\]++|\\.|(?R))*+\}) /x;
my $delimitador = qr/\{ (?<del>.+?) \} /x;
+my $scontents = qr/Scontents [*]? $no_corchete /ix;
my $verb = qr/(?:((spv|(?:q|f)?v|V)erb|$verbcmd)[*]?) /ix;
my $lst = qr/(?:(lst|pyg)inline)(?!\*) $no_corchete /ix;
my $mint = qr/(?: $mintline |SaveVerb) (?!\*) $no_corchete $no_llaves $llaves /ix;
my $no_mint = qr/(?: $mintline) (?!\*) $no_corchete /ix;
-my $marca = qr/\\ (?:$verb | $lst | $mint |$no_mint) (?:\s*)? (\S) .+? \g{-1} /x;
+my $marca = qr/\\ (?:$verb | $lst |$scontents | $mint |$no_mint) (?:\s*)? (\S) .+? \g{-1} /sx;
my $comentario = qr/^ \s* \%+ .+? $ /mx;
my $definedel = qr/\\ (?: DefineShortVerb | lstMakeShortInline| MakeSpecialShortVerb ) [*]? $no_corchete $delimitador /ix;
my $indefinedel = qr/\\ (?: (Undefine|Delete)ShortVerb | lstDeleteShortInline) $llaves /ix;
@@ -907,10 +908,10 @@ while ($document =~
### Regex for verbatim inline whit braces {...}
my $fvextra = qr /\\ (?: (Save|Esc)Verb [*]?) $no_corchete /x;
my $mintedbr = qr /\\ (?:$mintline|pygment) (?!\*) $no_corchete $no_llaves /x;
-my $tcbxverb = qr /\\ (?: tcboxverb [*]?|$verbcmd [*]?|lstinline) $no_corchete /x;
+my $tcbxverb = qr /\\ (?: tcboxverb [*]?| Scontents [*]? |$verbcmd [*]?|lstinline) $no_corchete /x;
my $verb_brace = qr / (?:$tcbxverb|$mintedbr|$fvextra) (?:\s*)? $nestedbr /x;
-### Changue \verb*{code} for verbatim inline
+### Changue \verb*{code} for verbatim inline
while ($document =~ /$verb_brace/pgmx) {
my ($pos_inicial, $pos_final) = ($-[0], $+[0]);
my $encontrado = ${^MATCH};
@@ -948,7 +949,7 @@ my $delenv = join "|", map quotemeta, sort { length $a <=> length $b } @delt_env
### Split file by lines
my @lineas = split /\n/, $document;
-### Hash and Regex for changues
+### Hash and Regex for changues
my %replace = (%change_verb_env,%changes_in,%document);
my $find = join "|", map {quotemeta} sort { length($a)<=>length($b) } keys %replace;
@@ -1144,7 +1145,7 @@ for (@lineas) {
### Join lines in $preamble
$preamble = join("\n", @lineas);
-### Change back betwen \begin{preview} ... \end{preview}
+### Change back betwen \begin{preview} ... \end{preview}
@lineas = split /\n/, $bodydoc;
for (@lineas) {
@@ -1223,7 +1224,7 @@ if (exists $opts_file{options}{output}){
$output = $opts_file{options}{output};
}
-### Validate output file name
+### Validate output file name
if (defined $output) {
# Not contain - at begin
if ($output =~ /(^\-|^\.).*?/) {
@@ -1237,7 +1238,7 @@ if ($output eq "$name$ext") { $output = "$name-out$ext"; }
# Remove .ltx or .tex extension
if ($output =~ /.*?$ext/) { $output =~ s/(.+?)$ext/$1/gms;}
-} # close check
+} # close check
### If output name are ok, then $outfile = 1
if (defined($output)) { $outfile = 1; }
@@ -1507,7 +1508,7 @@ my $format = join " ",grep { defined $format{$_} } keys %format;
if ($run) {
opendir(my $DIR, $tempDir);
while (readdir $DIR) {
-### PDF/PNG/JPG/BMP/TIFF format suported by ghostscript
+### PDF/PNG/JPG/BMP/TIFF format suported by ghostscript
if (/(?<name>$name-$prefix(-exa)?)(?<type>-all\.pdf)/) {
for my $var (qw(pdf png jpg bmp tif)) {
if (defined $opts_cmd{$var}) {
@@ -1518,7 +1519,7 @@ for my $var (qw(pdf png jpg bmp tif)) {
}# close for
} # close if m/.../
-### EPS/PPM/SVG format suported by poppler-utils
+### EPS/PPM/SVG format suported by poppler-utils
if (/(?<name>$name-$prefix)(?<type>-all\.pdf)/) {
for my $var (qw(eps ppm svg)) {
if (defined $opts_cmd{$var}) {
@@ -1565,7 +1566,7 @@ say "Creating the file $output$ext, convert extracted environments to \\includeg
### Convert extracted environments to \includegraphics
my $grap = "\\includegraphics[scale=1]{$name-$prefix-";
my $close = '}';
-my $imgNo = 1;
+my $imgNo = 1;
$bodydoc =~ s/$BP.+?$EP/$grap@{[$imgNo++]}$close/msg; # changes
### Constant
@@ -1622,7 +1623,7 @@ $preamble =~ s/\%<\*ltximgverw> .+?\%<\/ltximgverw>(*SKIP)(*F)|
\\SpecialCoor(?:[\t ]*(?:\r?\n|\r))+//gmsx;
} # close clean{pst}
-### Delete empty package line \usepackage{}
+### Delete empty package line \usepackage{}
$preamble =~ s/^\\usepackage\{\}(?:[\t ]*(?:\r?\n|\r))+/\n/gmsx;
### Append graphicx to end of preamble
@@ -1779,7 +1780,7 @@ foreach my $tmpfile (@delfiles) { move("$tmpfile", "$tempDir"); }
} # close clean tmp files
### Compress images dir whit generated files
-if ($zip or $tar) {
+if ($zip or $tar) {
my $stamp = strftime "%F", localtime;
my $archivetar = "$imageDir-$stamp";
@@ -1790,24 +1791,24 @@ sub zip_tar{
if (-f $filesto && $filesto =~ m/$name-$prefix-.+?$/) { # buscamos
push @savetozt, $File::Find::name;
}
-}
-# Write compressed zip file
-if ($zip) {
+}
+# Write compressed zip file
+if ($zip) {
say "Creating a file $workdir/$archivetar.zip";
- zip \@savetozt => "$archivetar.zip";
+ zip \@savetozt => "$archivetar.zip";
}
# Write compressed tar.gz file
-if ($tar) {
+if ($tar) {
say "Creating a file $workdir/$archivetar.tar.gz";
my $imgdirtar = Archive::Tar->new();
$imgdirtar->add_files( @savetozt );
- $imgdirtar->write( "$archivetar.tar.gz" , 9 );
+ $imgdirtar->write( "$archivetar.tar.gz" , 9 );
}
} #close compress
### End of script process
-if ($run) { say "Finish, image formats: $format are in $workdir/$imageDir/"; }
- else { say "Done"; }
+if ($run) { say "Finish, image formats: $format are in $workdir/$imageDir/"; }
+ else { say "Done"; }
__END__
diff --git a/Master/texmf-dist/source/support/ltximg/ltximg-doc.dtx b/Master/texmf-dist/source/support/ltximg/ltximg-doc.dtx
index 2b1944db673..b703faf7ec5 100644
--- a/Master/texmf-dist/source/support/ltximg/ltximg-doc.dtx
+++ b/Master/texmf-dist/source/support/ltximg/ltximg-doc.dtx
@@ -40,7 +40,7 @@ and directories is not supported. If the last `[<options>]` take a *list separat
[default]
-h, --help Display command line help and exit [off]
-l, --license Display GPL license and exit [off]
--v, --version Display current version (1.6) and exit [off]
+-v, --version Display current version (1.7) and exit [off]
-t, --tif Create .tif files using ghostscript [gs]
-b, --bmp Create .bmp files using ghostscript [gs]
-j, --jpg Create .jpg files using ghostscript [gs]
@@ -119,48 +119,12 @@ License for more details.
## Author
-Written by Pablo González L <pablgonz@yahoo.com>, last update 2019-07-13.
+Written by Pablo González L <pablgonz@yahoo.com>, last update 2019-08-24.
## Copyright
Copyright 2013 - 2019 by Pablo González L
%</readme>
-%<*changues>
-## Changues
-### v1.6 (p) 2019-07-13
-- Add `tar` and `zip` options
-- Add suport for new `Verb` from `fvextra`
-- Update source code and documentation
-### v1.5 (p) 2018-04-12
-- Use GitHub to control version
-- Rewrite and optimize most part of code and options
-- Changue `pdf2svg` for `pdftocairo`
-- Complete support for `pst-exa` packpage
-- `clean` take a optional argument
-### v1.4 (d) 2016-11-29
-- Remove and rewrite code for regex and system call
-- Append `arara` compiler, clean and comment code
-- Append `dvips` and `dvipdfm(x)` for creation images
-- Append `bmp` and `tif` image format
-### v1.3. (d) 2016-10-16
-- All options it's read from command line and input file
-- Rewrite some part of code (`norun`, `nocrop`, `clean`)
-- Suport `minted` and `tcolorbox` packpage
-- Use `/tmp` dir for work process
-- Escape some characters in regex according to v5.2xx
-### v1.2 (p) 2015-04-22
-- Remove unused modules
-### v1.1 (p) 2015-04-21
-- Change `mogrify` to `gs` for image formats
-- Create `output` file
-- Rewrite source code and fix regex
-- Add more image format
-- Change date to iso format
-### v1.0 (p) 2013-12-01
-- First public release
-
-Copyright 2013 - 2019 by Pablo González L <pablgonz@yahoo.com>. $ID
-%</changues>
%<*internal>
\fi
\def\nameofplainTeX{plain}
@@ -175,7 +139,6 @@ Copyright 2013 - 2019 by Pablo González L <pablgonz@yahoo.com>. $ID
\nopreamble\nopostamble
\generate{
\file{README.md}{\from{\jobname.dtx}{readme}}
- \file{CHANGUES.md}{\from{\jobname.dtx}{changues}}
}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
@@ -187,7 +150,7 @@ Copyright 2013 - 2019 by Pablo González L <pablgonz@yahoo.com>. $ID
\documentclass{ltxdoc}
\usepackage[top=0.5in, bottom=0.5in, left=2in, right=1in,footskip=0.2in,%
headsep=10pt]{geometry} % page dimension
-\usepackage{unicode-math}
+\usepackage{unicode-math} %
\setmathfont[Scale = 0.95]{Latin Modern Math}
\setmainfont[
Numbers = OldStyle,
@@ -252,8 +215,8 @@ Copyright 2013 - 2019 by Pablo González L <pablgonz@yahoo.com>. $ID
% Identification
\def\myscript{ltximg}
-\def\fileversion{1.6}
-\def\filedate{2019-07-13}
+\def\fileversion{1.7}
+\def\filedate{2019-08-24}
% Logo whit libertuns and fetamono font
\newsavebox{\logobox}
@@ -484,11 +447,11 @@ Copyright 2013 - 2019 by Pablo González L <pablgonz@yahoo.com>. $ID
{
\textsf{\textcolor{SlateBlue}{#1}}
\SortIndex{packages}{Packages>\small\texttt{#1}}
- \SortIndex{#1}{\texttt{#1} (package)}
+ \SortIndex{#1}{\texttt{#1} ~ (package)}
}%
% \pkgopt{m}
-\DeclareDocumentCommand{ \pkgopt}{ m }
+\DeclareDocumentCommand{\pkgopt}{ m }
{
\textsf{\textcolor{Orange}{#1}}
\SortIndex{package ~ options}{Package ~ options>\small\texttt{#1}}
@@ -961,6 +924,7 @@ supported. They are automatically detected the verbatim command generates by
\item \ics{lstinline}
\item \ics{pyginline}
\item \ics{pygment}
+\item \ics{Scontents}
\item \ics{tcboxverb}
\item \ics{mintinline}
\end{itemize}
@@ -1074,6 +1038,7 @@ or \env{VerbatimOut} environments. The following list is considered as %
\begin{multicols}{3}
\begin{itemize}[font=\sffamily\small, noitemsep,leftmargin=*]
\ttfamily\small
+\item scontents
\item filecontents
\item tcboutputlisting
\item tcbexternal
@@ -1084,6 +1049,7 @@ or \env{VerbatimOut} environments. The following list is considered as %
\item verbatimwrite
\item filecontentsdef
\item filecontentshere
+\item filecontentsdefmacro
\end{itemize}
\end{multicols}
@@ -1674,6 +1640,13 @@ versions, both development (devp) and public (ctan).
\begin{description}[font=\small\sffamily, wide=0pt, style=multiline, leftmargin=\descrwidth, nosep, noitemsep]
\item [v\fileversion{} (ctan), \filedate]
\begin{itemize}
+ \item Add \texttt{scontents} environment support
+ \item Add \texttt{filecontentsdefmacro} environment support
+ \item Fix regex in source code
+ \item Update documentation
+ \end{itemize}
+\item [v1.6 (ctan), 2019-07-13]
+ \begin{itemize}
\item Add \texttt{zip} and \texttt{tar} options
\item Add new \texttt{Verb} from \texttt{fvextra}
\item Fix and update source code and documentation