diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-22 20:16:30 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-22 20:16:30 +0000 |
commit | 0d82bc72dfbcd013449447046870edb514c81784 (patch) | |
tree | 02884ad03c5b9126c748947c99638910389cd88d /Master | |
parent | 0b7bb0e5c26e2e478a73d0308ec2b5411a2b1ad2 (diff) |
ltximg (22may21)
git-svn-id: svn://tug.org/texlive/trunk@59309 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/support/ltximg/README.md | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf | bin | 316588 -> 319369 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex | 208 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/ltximg/ltximg.1 | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/support/ltximg/ltximg.man1.pdf | bin | 27866 -> 27866 bytes | |||
-rwxr-xr-x | Master/texmf-dist/scripts/ltximg/ltximg.pl | 25 |
6 files changed, 151 insertions, 92 deletions
diff --git a/Master/texmf-dist/doc/support/ltximg/README.md b/Master/texmf-dist/doc/support/ltximg/README.md index 955b3b75987..8ac445354be 100644 --- a/Master/texmf-dist/doc/support/ltximg/README.md +++ b/Master/texmf-dist/doc/support/ltximg/README.md @@ -1,6 +1,6 @@ ## LTXimg – LaTeX environments to image and standalone files -Release v2.0 \[2021-01-24\] +Release v2.1 \[2021-05-21\] ## Description @@ -42,7 +42,7 @@ and saved in the `./images` directory using `pdflatex` and `preview` package to ``` [default] -h, --help Display command line help and exit [off] --v, --version Display current version (2.0) and exit [off] +-v, --version Display current version (2.1) and exit [off] -V, --verbose Verbose printing information [off] -l, --log Write .log file with debug information [off] -t, --tif Create .tif files using ghostscript [gs] @@ -127,7 +127,7 @@ Pablo González L, `<pablgonz@yahoo.com>`. ## Copyright and Licence -Copyright 2013 - 2020 Pablo González L `<pablgonz@yahoo.com>`. +Copyright 2013 - 2021 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, diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf Binary files differindex 0a6f44fe497..377d2ae9bb4 100644 --- a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf +++ b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.pdf diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex index 3d41f5c6cbf..72908c02337 100644 --- a/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex +++ b/Master/texmf-dist/doc/support/ltximg/ltximg-doc.tex @@ -85,8 +85,8 @@ % Identification \def\myscript{ltximg} -\def\fileversion{2.0} -\def\filedate{2021-01-24} +\def\fileversion{2.1} +\def\filedate{2021-05-21} % Logo with fetamont and libertuns font \ExplSyntaxOn @@ -400,7 +400,17 @@ \SortIndex{#2}{\texttt{\small\textbackslash#2}} } -% file extention +% \module{m} +\NewDocumentCommand{\module}{m} + { + \SortIndex{Perl ~ module}{Perl ~ module >\small\texttt{#1}} + \tl_set:Nn \l_tmpa_tl { #1 } + \regex_replace_all:nnN { (\:\:) } { \c{textcolor}\cB\{MediumOrchid\cE\}\cB\{\1\cE\} } \l_tmpa_tl + \textcolor{blue!75}{\ttfamily{\tl_use:N \l_tmpa_tl}} + %\SortIndex{Perl ~ module}{Perl ~ module >\small\texttt{\tl_use:N \l_tmpa_tl}} + } + +% File extention \NewDocumentCommand{\fext}{m} { \mbox{\textcolor{OrangeRed}{\texttt{.#1}}} @@ -414,8 +424,7 @@ \SortIndex{file}{File >\small\texttt{#1.#2}} } - -% image format/extention +% Image format/extention \NewDocumentCommand{\iext}{m} { \textcolor{optcolor}{\texttt{#1}} @@ -572,8 +581,8 @@ % Important words 2 (macros) keywordstyle=[2]{\color{blue!75}},% keywords=[2]{graphicspath,RequirePackage,renewcommand,includegraphics,coordinate,draw,approx,% - PreviewBbAdjust,setlength,parindent,usetikzlibrary,tikzexternalize,psset,tikzset,PrependGraphicsExtensions,% - DefineShortVerb,lstMakeShortInline,MakeSpecialShortVerb,UndefineShortVerb,verb,myverb,macro,put,line},% + PreviewBbAdjust,setlength,parindent,usetikzlibrary,tikzexternalize,psset,tikzset,PrependGraphicsExtensions,cmd,% + DefineShortVerb,lstMakeShortInline,MakeSpecialShortVerb,UndefineShortVerb,verb,myverb,macro,put,line,Win32::Console::ANSI},% % Important words 3, options in input file keywordstyle=[3]{\color{optcolor!85}},% keywords=[3]{extrenv,deltenv,skipenv,options,arara,extensions,luatex,env,norun,% @@ -756,16 +765,19 @@ to \emph{any type} of environment covering three central points: \item Generate a standalone files with only the extracted environments. \item Generate a file replacing the environments by \ics{includegraphics}. + \end{enumerate} -From the side of \hologo{TeX} there are some packages that cover several of these -points such as the \pkgname{preview}\cite{preview}, \pkgname{xcomment}\cite{xcomment}, \pkgname{extract}\cite{extract} -and \pkgname{cachepic}\cite{cachepic} packages among others, but none covered all points. +From the side of \hologo{TeX} there are some packages that cover +several of these points such as the \pkgname{preview}\cite{preview}, +\pkgname{xcomment}\cite{xcomment}, \pkgname{extract}\cite{extract} and +\pkgname{cachepic}\cite{cachepic} packages among others, but none +covered all points. -In the network there are some solutions in \texttt{bash} that were able to -extract and convert environments, but in general they presented problems -when the document contained \emph{\enquote{verbatim style}} code or were only -available for \OSsystem{Linux}. +In the network there are some solutions in \texttt{bash} that were able +to extract and convert environments, but in general they presented +problems when the document contained \emph{\enquote{verbatim style}} +code or were only available for \OSsystem{Linux}. \thispagestyle{plain} @@ -773,9 +785,9 @@ available for \OSsystem{Linux}. \pagestyle{myheader} -Analysed the situation the best thing was to create a new \emph{\enquote{script}} that -was able to cover the three points and was multi platform, the union of all -these ideas is born \ltximg. +Analysed the situation the best thing was to create a new +\emph{\enquote{script}} that was able to cover the three points and was +multi platform, the union of all these ideas is born \ltximg. This script would not be possible without the great work of Herbert Voß author of \scriptname{pst2pdf}\footnote{\url{https://ctan.org/pkg/pst2pdf}} @@ -791,49 +803,91 @@ a version equal to or greater than \liningnums{5.28} of \prgname{perl}, a version equal to or greater than \liningnums{9.52} of \prgname{ghostscript}, a version equal to or greater than \liningnums{1.40} of \scriptname{pdfcrop} and have a version equal to or greater than \liningnums{0.52} of % -\prgname{poppler-utils}. - -The script uses only packages from the core of the \prgname{perl}, the -distribution encapsulated in \hologo{TeX} Live 2020 for \OSsystem{Windows} -does not have the \verb|Win32::Console::ANSI| package, this does not -affect the operation of the script, but it does affect the presentation -of the messages when invoked from \verb|cmd|, it is recommended to use -a more modern (and comfortable) application such as \prgname{Windows Terminal}. -\hologo{MiKTeX} users must install the appropriate software for full -operation. - -The script auto detects the \prgname{ghostscript}, but not \prgname{poppler-utils}. +\prgname{poppler-utils}. \hologo{MiKTeX} and \prgname{cygwin} users +must install the appropriate software for full operation. + +\ltximg{} auto detects the \prgname{ghostscript}, but not \prgname{poppler-utils}. You should keep this in mind if you are using the script directly and not the version provided in your \hologo{TeX} distribution. -The script has been tested on \OSsystem{Windows} v10, \prgname{cygwin} v3.1.6, \prgname{Git for Windows} v2.30 and % -\OSsystem{Linux} (fedora 33) using \prgname{ghostscript} v9.53.3, \prgname{poppler-utils} v0.90, \prgname{perl} v5.32 -and the standard classes offers by \hologo{LaTeX}: \myclass{book}, \myclass{report}, \myclass{article} and -\myclass{letter}. The \pkgname{preview}\cite{preview} and \pkgname{pst-pdf}\cite{pst-pdf} packages are -required to process the \meta{input file} and if an \meta{output file} is generated, the \pkgname{graphicx}\cite{graphicx} -and \pkgname{grfext}\cite{grfext} packages will be needed. +The script has been tested on \OSsystem{Windows} 10, \prgname{cygwin} +3.1.6, \prgname{Git for Windows} 2.30 and \OSsystem{Linux} (fedora 34) +using \prgname{ghostscript} 9.53.3, \prgname{poppler-utils} 0.90, +\prgname{perl} 5.32 and the standard classes offers by \hologo{LaTeX}: +\myclass{book}, \myclass{report}, \myclass{article} and +\myclass{letter}. The \pkgname{preview}\cite{preview} and +\pkgname{pst-pdf}\cite{pst-pdf} packages are required to process the +\meta{input file} and if an \meta{output file} is generated, the +\pkgname{graphicx}\cite{graphicx} and \pkgname{grfext}\cite{grfext} +packages will be needed. + + +\subsection{Modules required} + +\ltximg{} uses only packages from the core of the \prgname{perl}, the +distribution encapsulated in \hologo{TeX} Live 2020 for +\OSsystem{Windows} does not have the module +\module{Win32::Console::ANSI}, this does not affect the operation of +the script, but it does affect the presentation of the messages when +invoked from \emph{standart} \prgname{cmd}, it is recommended to use a +more modern (and comfortable) application such as \prgname{Windows +Terminal}. + +\setlength{\multicolsep}{2ex} +\begin{multicols}{2} +\begin{itemize}[font=\sffamily\small,first=\small,partopsep=5pt,parsep=5pt,nosep,leftmargin=*] + \item \module{Getopt::Long} + \item \module{File::Spec::Functions} + \item \module{File::Basename} + \item \module{Archive::Tar} + \item \module{Data::Dumper} + \item \module{FileHandle} + \item \module{IO::Compress::Zip} + \item \module{File::Path} + \item \module{File::Temp} + \item \module{POSIX} + \item \module{File::Copy} + \item \module{File::Find} + \item \module{Env} + \item \module{autodie} + \item \module{Config} + \item \module{Cwd} + \item \module{Term::ANSIColor} + \item \module{Module::Load::Conditional} + \item Only on \OSsystem{Windows}: + \begin{itemize}[font=\sffamily\small,first=\small,nosep] + \item \module{Win32} + \item \module{Win32::Console::ANSI} + \item \module{Win32::TieRegistry} + \end{itemize} +\end{itemize} +\end{multicols} \section{How it works} \label{sec:howtowork} -It is important to have a general idea of how the \emph{\enquote{extraction and conversion}} -process works and the requirements that must be fulfilled so -that everything works correctly, for this we must be clear about some -concepts related to how to work with the \meta[cf=optcolor]{input file}, the \meta{verbatim content} +It is important to have a general idea of how the +\emph{\enquote{extraction and conversion}} process works and the +requirements that must be fulfilled so that everything works correctly, +for this we must be clear about some concepts related to how to work +with the \meta[cf=optcolor]{input file}, the \meta{verbatim content} and the \meta{steps process}. \subsection{The input file} \label{sec:inputfile} -The \meta[cf=optcolor]{input file} must comply with \emph{certain characteristics} in order to -be processed, the content at the beginning and at the end of the \meta{input -file} is treated in a special way, before \lstinline|\documentclass| and after -\lstinline|\end{document}| can go any type of content, internally the script will -\emph{\enquote{split}} the \meta[cf=optcolor]{input file} at this points. - -If the \meta[cf=optcolor]{input file} contains files using \ics{input}\marg[type=tt]{file} or -\ics{include}\marg[type=tt]{file} these will not be processed, from the side of -the \emph{script} they only represent lines within the file, if you want +The \meta[cf=optcolor]{input file} must comply with \emph{certain +characteristics} in order to be processed, the content at the beginning +and at the end of the \meta{input file} is treated in a special way, +before \lstinline|\documentclass| and after \lstinline|\end{document}| +can go any type of content, internally the script will +\emph{\enquote{split}} the \meta[cf=optcolor]{input file} at this +points. + +If the \meta[cf=optcolor]{input file} contains files using +\ics{input}\marg[type=tt]{file} or \ics{include}\marg[type=tt]{file} +these will not be processed, from the side of the \emph{script} they +only represent lines within the file, if you want them to be processed it is better to use the \scriptname{latexpand}\footnote{\url{https://www.ctan.org/pkg/latexpand}} first and then process the file. @@ -865,22 +919,22 @@ parts and then processing them: % Part Four: Everything after \end{document} \end{examplecode} -If for some reason you have an environment \LWenv{filecontens} before \lstinline|\documentclass| or -in the preamble of the \meta{input file} that contains a \emph{sub-document} or \emph{environment} -you want to extract, the script will ignore them. Similarly, the content after \lstinline|\end{document}| -is ignored in the extraction process. - -\newpage +If for some reason you have an environment \LWenv{filecontents} before +\lstinline|\documentclass| or in the preamble of the \meta{input file} +that contains a \emph{sub-document} or \emph{environment} you want to +extract, the script will ignore them. Similarly, the content after +\lstinline|\end{document}| is ignored in the extraction process. \subsection{Verbatim contents} \label{sec:verbatim} -One of the greatest capabilities of this script is to \emph{\enquote{skip}} -the complications that \meta{verbatim content} produces with the extraction -of environments using tools outside the \enquote{\hologo{TeX} world}\footnote{Only \hologo{TeX} can -understand \hologo{TeX}, all other languages and programs are just lines in a file.}. -In order to \emph{\enquote{skip}} the complications, the \meta{verbatim content} is classified into -three types: +One of the greatest capabilities of this script is to +\emph{\enquote{skip}} the complications that \meta{verbatim content} +produces with the extraction of environments using tools outside the +\enquote{\hologo{TeX} world}\footnote{Only \hologo{TeX} can understand +\hologo{TeX}, all other languages and programs are just lines in a +file.}. In order to \emph{\enquote{skip}} the complications, the +\meta{verbatim content} is classified into three types: \begin{itemize}[nosep] \item Verbatim in line. @@ -936,9 +990,9 @@ it correctly. The solution is quite simple, just add in \meta[cf=optcolor]{input \DefineShortVerb{\|} \end{examplecode} -depending on the package you are using. If your \emph{\enquote{verbatim macro}} is not -supported by default or can not detect, use the options described in \ref% -{sec:optline} and \ref{sec:optfile}. +depending on the package you are using. If your \emph{\enquote{verbatim macro}} +is not supported by default or can not detect, use the options +described in \ref{sec:optline} and \ref{sec:optfile}. \subsection*{Verbatim standard} \label{sec:verbatim:std} @@ -1110,8 +1164,6 @@ and create a temporary directory \sysdir{/tmp/hG45uVklv9}. The entire \sysfile{test.tex} file is loaded into memory and \emph{\enquote{split}} to start the extraction process. -\newpage - \subsection*{Comment and ignore} In the second step, once the file \sysfile{test.tex} is loaded and divided in memory, proceeds (in general terms) as follows: @@ -1283,7 +1335,7 @@ package with the [\pkgopt{swpl}] or [\pkgopt{tcb}] option and run the script using \cmdopt{latex}{} or \cmdopt{xetex}. This environment is reserved for the internal process of extraction and conversion, it cannot be passed as an argument to the option \cmdopt{skipenv}{}. -\vspace{0.25\baselineskip} +\newpage \DescribeTE{pspicture} Environment provide by \pkgname{PStricks}\cite{pstricks} package. The plain \hologo{TeX} @@ -1297,7 +1349,7 @@ Environment provide by \pkgname{pst-plot}\cite{pst-plot} package. The plain \hol its converted to \hologo{LaTeX} syntax \lstinline|\begin{psgraph} ... \end{psgraph}| if not within the \env{PSTexample} or \env{postscript} environments. -\newpage +\vspace{0.75\baselineskip} \DescribeTE{tikzpicture} Environment provide by \pkgname{TikZ}\cite{tikz} package. The plain \hologo{TeX} syntax \lstinline|\tikzpicture ... \tikzpicture| @@ -1344,8 +1396,6 @@ unless the option \cmdopt[n]{noprew}{} is used. This environment is reserved for the internal process of extraction and conversion, it cannot be passed as an argument to the option \cmdopt{extrenv}. -\vspace{\baselineskip} - \DescribeTE*{noltximg} All content betwen \lstinline|%<*noltximg> ... %</noltximg>| are ignored and no extract. The tags can \emph{not} be nested and should be at the beginning of the line and in separate lines. @@ -1395,6 +1445,8 @@ The image format generated using \prgname{pdftoeps}. The line executed by the sy [user@machine ~:]§ pdftops -q -eps \end{examplecmd} +\newpage + \DescribeIF{png} The image format generated using \prgname{ghostscript}. The line executed by the system is: @@ -1467,7 +1519,6 @@ Options that accept a \meta{value} require either a blank space \verb*| | or \te between the option and the \meta{value}. Multiple short options can be bundling and if the last option takes a \meta{comma separated list} you need \textcolor{optcolor}{\bfseries\texttt{-\/-}} at the end. -\vspace{\baselineskip} \DescribeCmd[h]{help}{boolean}{off} Display a command line help and exit. @@ -1587,7 +1638,7 @@ and \meta[cf=optcolor]{output file}, is mutually exclusive with \emph{\enquote{a Using \prgname*{xelatex} compiler \meta[cf=optcolor]{input file} and \meta[cf=optcolor]{output file}. In the execution \prgname*{xelatex} is called with the \prgopt*{no-pdf} option generating a \fext{xvd} file and then it is processed using \prgname*{xdvipdfmx}, -this is only to execute \emph{faster} the conversion of environments to images +this is only to execute \emph{faster} conversion of environments to images and it is only done on the \meta[cf=optcolor]{input file}. \DescribeCmd{latex}{boolean}{off} @@ -1653,6 +1704,8 @@ at the end. The environments \env{PSTexample} and \env{preview} are not supporte Add \meta{verbatim standard} environment support, if it's the last option passed need \textcolor{optcolor}{\textbf{\texttt{-\/-}}} at the end.\par +\newpage + \DescribeCmd{writenv}{comma separated list}{empty} Add \meta{verbatim write} environment support, if it's the last option passed need \textcolor{optcolor}{\textbf{\texttt{-\/-}}} at the end.\par @@ -1670,6 +1723,7 @@ An example of usage from command line: \begin{examplecmd} [user@machine ~:]§ ltximg --latex -s -o test-out test-in.ltx \end{examplecmd} + Create a \sysdir{./images} directory (if it does not exist) with all extracted environments converted to image formats (\iext{pdf}, \iext{svg}) in individual files, an output file \meta[ac=LightSlateGrey,cf=OrangeRed]{test-out.ltx} with all extracted environments converted to \ics{includegraphics} and a single file @@ -1717,7 +1771,7 @@ This line is to indicate to the script which environments are deleted. \DescribeOptFile{options}{option one = value, option two = value, option three = value, \ldots} This line is to indicate to the script which options(other than those listed above) need to process. -The options passed from the \meta[cf=optcolor]{input file} are validated by the script after they are read. If you are going to +All options passed from the \meta[cf=optcolor]{input file} are validated by the \ltximg{} after they are read. If you are going to create an \meta[cf=optcolor]{output file} and you do not want these lines to remain, it is better to place them inside the \lstinline|%<*remove> ... %</remove>|. Like this: @@ -1752,7 +1806,8 @@ and \meta[ac=LightSlateGrey,cf=OrangeRed]{file-out.tex}. \section{The way of \texttt{arara}} \label{sec:arara} -By design, the script only runs \emph{\enquote{one or more compilation}} on top + +By design, \ltximg{} only runs \emph{\enquote{one or more compilation}} on top of the \meta[cf=optcolor]{input file}, but, sometimes you need to process in a specific mode the \meta[cf=optcolor]{input file} or needs to be processed with something other than \hologo{LaTeX}, \hologo{XeLaTeX}, \hologo{pdfLaTeX} or \hologo{LuaLaTeX} engine. This is where \arara\cite{arara} comes in, this \emph{\enquote{great little tool}}, @@ -1880,7 +1935,6 @@ to generate an image in \iext{svg}, \iext{png} and \iext{pdf} format from enviro \begin{document} \section{How to get Tikzmark to work} By taking logarithms of both sides: - \[ t = \frac{30\cdot\ln(3/22)}{\ln(15/22)} \tikzmark{calculator}\approx\tikzmark{otherside} @@ -1890,7 +1944,6 @@ By taking logarithms of both sides: \coordinate (target) at ($(pic cs:calculator)!1/2!(pic cs:otherside) - (0,.5ex)$); \draw[arrows=->] (target) ++(0,-2ex) node [anchor=north] {use calculator} -- (target); \end{tikzpicture} - \section{Draw an aircraft with Tikz} The best airplane ever drawn by David Carlise. No TikZ used, just the classic and perhaps forgotten \verb|\begin{picture} ... \end{picture}|. @@ -1957,6 +2010,11 @@ versions, both development (devp) and public (ctan). \begin{description}[font=\small\sffamily,style=nextline,nosep,noitemsep] \item [v\fileversion\ (ctan), \filedate] \leavevmode\vspace{-\baselineskip} \begin{itemize} + \item Maintenance update. + \item Fix internal \texttt{hash} for regex. + \end{itemize} +\item [v2.0 (ctan), 2021-01-24] \leavevmode\vspace{-\baselineskip} + \begin{itemize} \item Add \texttt{-dALLOWPSTRANSPARENCY} to \texttt{ps2pdf}. \item The \texttt{--xetex} option now uses \texttt{xelatex} and then \texttt{xdvipdfmx}. \item Fix module detection under \hologo{TeX} Live on Windows. diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg.1 b/Master/texmf-dist/doc/support/ltximg/ltximg.1 index 81545b5470d..918b2626ddc 100644 --- a/Master/texmf-dist/doc/support/ltximg/ltximg.1 +++ b/Master/texmf-dist/doc/support/ltximg/ltximg.1 @@ -1,4 +1,4 @@ -.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) +.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== @@ -71,7 +71,7 @@ .\" ======================================================================== .\" .IX Title "ltximg 1" -.TH ltximg 1 "2021-01-24" "2.0" "General Commands Manual" +.TH ltximg 1 "2021-05-21" "2.1" "General Commands Manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/Master/texmf-dist/doc/support/ltximg/ltximg.man1.pdf b/Master/texmf-dist/doc/support/ltximg/ltximg.man1.pdf Binary files differindex 0cb98fe28c8..57f87af07b2 100644 --- a/Master/texmf-dist/doc/support/ltximg/ltximg.man1.pdf +++ b/Master/texmf-dist/doc/support/ltximg/ltximg.man1.pdf diff --git a/Master/texmf-dist/scripts/ltximg/ltximg.pl b/Master/texmf-dist/scripts/ltximg/ltximg.pl index 791c9316856..2582d2d61da 100755 --- a/Master/texmf-dist/scripts/ltximg/ltximg.pl +++ b/Master/texmf-dist/scripts/ltximg/ltximg.pl @@ -31,7 +31,7 @@ use Config; use Cwd; use if $^O eq 'MSWin32', 'Win32'; use if $^O eq 'MSWin32', 'Module::Load::Conditional' => qw(can_load check_install requires); -# Need on Windows cmd for colors, TeX Live not provide 'Win32::Console::ANSI' +# Need for colors in Windows cmd, TeX Live not provide 'Win32::Console::ANSI' if($^O eq 'MSWin32' && check_install( module => 'Win32::Console::ANSI')) { require Win32::Console::ANSI; } @@ -44,8 +44,8 @@ my $workdir = cwd; ### Script identification my $scriptname = 'ltximg'; my $program = 'LTXimg'; -my $nv = 'v2.0'; -my $date = '2021-01-24'; +my $nv = 'v2.1'; +my $date = '2021-05-21'; my $copyright = <<"END_COPYRIGHT" ; [$date] - LaTeX environments to image and standalone files END_COPYRIGHT @@ -601,7 +601,7 @@ sub SearchRegistry { return $found; } # end GS search registry -### This part is only necessary if you're using Git on windows and don't +### This part is only necessary if you're using Git-bash on windows and don't ### have gs configured in PATH. Git for windows don't have a Win32::TieRegistry ### module for perl (is not supported in the current versions of msys). sub Searchbyregquery { @@ -2544,17 +2544,13 @@ if (@pst_exa and $outfile) { $PALABRAS = qr/\b (?: pst-\w+ | pstricks (?: -add | -pdf )? | psfrag |psgo |vaucanson-g| auto-pst-pdf(?: -lua )? )/x; $FAMILIA = qr/\{ \s* $PALABRAS (?: \s* [,] \s* $PALABRAS )* \s* \}(\%*)?/x; -### Clean PST content in preamble +### Clean PSTricks content in preamble if ($clean{pst} and $outfile) { Log("Remove pstricks packages in preamble for $opts_cmd{string}{output}$outext"); $preamble =~ s/\%<\*$dtxverb> .+?\%<\/$dtxverb>(*SKIP)(*F)| ^ $USEPACK (?: $CORCHETES )? $FAMILIA \s*//msxg; $preamble =~ s/\%<\*$dtxverb> .+?\%<\/$dtxverb>(*SKIP)(*F)| (?: ^ $USEPACK \{ | \G) [^}]*? \K (,?) \s* $PALABRAS (\s*) (,?) /$1 and $3 ? ',' : $1 ? $2 : ''/gemsx; - if (@pst_exa) { - Log("Uncomment pst-exa package in preamble for $opts_cmd{string}{output}$outext"); - $preamble =~ s/(?:\%)(\\usepackage\[\s*)(swpl|tcb)(,pdf\s*\]\{pst-exa\})/$1$2$3/msxg; - } Log("Remove \\psset\{...\} in preamble for $opts_cmd{string}{output}$outext"); $preamble =~ s/\%<\*$dtxverb> .+?\%<\/$dtxverb>(*SKIP)(*F)| \\psset\{(?:\{.*?\}|[^\{])*\}(?:[\t ]*(?:\r?\n|\r))+//gmsx; @@ -2566,6 +2562,12 @@ if ($clean{pst} and $outfile) { ^\\usepackage\{\}(?:[\t ]*(?:\r?\n|\r))+/\n/gmsx; } +### Uncomment pst-exa package +if (@pst_exa and $outfile) { + Log("Uncomment pst-exa package in preamble for $opts_cmd{string}{output}$outext"); + $preamble =~ s/(?:\%)(\\usepackage\[\s*)(swpl|tcb)(,pdf\s*\]\{pst-exa\})/$1$2$3/msxg; +} + ### To be sure that the package graphicx and \graphicspath is in the main ### document and not in a verbatim write environment we make the changes my %tmpreplace = ( @@ -2807,9 +2809,10 @@ if ($outfile) { } # Remove internal mark for verbatim and verbatim write environments $out_file =~ s/\%<\*$dtxverb>\s*(.+?)\s*\%<\/$dtxverb>/$1/gmsx; - %replace = (%changes_out); + %replace = (%changes_out,%tmpoutreplace); $find = join q{|}, map {quotemeta} sort { length $a <=> length $b } keys %replace; $out_file =~ s/($find)/$replace{$1}/g; + # Write <output file> if (-e "$opts_cmd{string}{output}$outext") { Log("Rewriting the file $opts_cmd{string}{output}$outext in $workdir"); Infocolor('Warning', "The file [$opts_cmd{string}{output}$outext] already exists and will be rewritten"); @@ -2818,7 +2821,6 @@ if ($outfile) { Infoline("Creating the file $opts_cmd{string}{output}$outext"); Log("Write the file $opts_cmd{string}{output}$outext in $workdir"); } - # Write <output file> open my $OUTfile, '>', "$opts_cmd{string}{output}$outext"; print {$OUTfile} $out_file; close $OUTfile; @@ -3281,4 +3283,3 @@ General Public License for more details. gs(1), dvips(1), ps2pdf(1), pdfcrop(1), pdftops(1), pdftocairo(1), pdftoppm(1) =cut - |