summaryrefslogtreecommitdiff
path: root/graphics/svg
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/svg')
-rw-r--r--graphics/svg/README.md8
-rw-r--r--graphics/svg/doc/svg.pdfbin1040831 -> 1042481 bytes
-rw-r--r--graphics/svg/source/svg.dtx2952
3 files changed, 1544 insertions, 1416 deletions
diff --git a/graphics/svg/README.md b/graphics/svg/README.md
index 77441af55c..e0e785fc6b 100644
--- a/graphics/svg/README.md
+++ b/graphics/svg/README.md
@@ -3,9 +3,9 @@
----------------------------------------------------------------------------
Copyright (C) Philip Ilten <philten@cern.ch>, 2012-2016<br>
- Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017-
+ Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017-2020
- **svg 2020/05/07 v2.02f**
+ **svg 2020/06/12 v2.02g**
----------------------------------------------------------------------------
@@ -39,6 +39,10 @@ can be invoked.
Versions
--------
+**v2.02g** (2020/06/12)
++ hot fix for including files with mutliple dots in it's names,
+ see https://github.com/mrpiggi/svg/issues/27
+
**v2.02f** (2020/05/07)
+ support for ***Inkscape*** 1.0
diff --git a/graphics/svg/doc/svg.pdf b/graphics/svg/doc/svg.pdf
index 0cf75be787..98e6a99382 100644
--- a/graphics/svg/doc/svg.pdf
+++ b/graphics/svg/doc/svg.pdf
Binary files differ
diff --git a/graphics/svg/source/svg.dtx b/graphics/svg/source/svg.dtx
index 84a4041594..51a34dc5f7 100644
--- a/graphics/svg/source/svg.dtx
+++ b/graphics/svg/source/svg.dtx
@@ -1,110 +1,134 @@
% \iffalse meta-comment
+%<*identify>
%
% svg and svg-extract -- Handling SVG pictures in LaTeX documents
-% ----------------------------------------------------------------------------
%
-% Copyright (C) Philip Ilten <philten@cern.ch>, 2012-2016
-% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017-2020
-%
-% ----------------------------------------------------------------------------
-%
-% This work may be distributed and/or modified under the conditions of the
-% LaTeX Project Public License, version 1.3c of the license. The latest
-% version of this license is in http://www.latex-project.org/lppl.txt and
-% version 1.3c or later is part of all distributions of LaTeX 2005/12/01
-% or later and of this work. This work has the LPPL maintenance status
-% "author-maintained". The current maintainer and author of this work
-% is Falk Hanisch.
-%
-% ----------------------------------------------------------------------------
+%% ----------------------------------------------------------------------------
+%%
+%% Copyright (C) Philip Ilten <philten@cern.ch>, 2012-2016
+%% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017-2020
+%%
+%% ----------------------------------------------------------------------------
+%%
+%% This work may be distributed and/or modified under the conditions
+%% of the LaTeX Project Public License, version 1.3c of the license.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3c or later is part of all distributions of
+%% LaTeX 2005/12/01 or later and of this work.
+%%
+%% This work has the LPPL maintenance status "author-maintained".
+%%
+%% The current maintainer and author of this work is Falk Hanisch.
+%%
+%% This work consists of the main source file README.md, LICENSE.md, svg.dtx
+%% and the derived documentation svg.pdf as well as the example files
+%% svg-example.svg, svg-preamble.tex and root.C (with derived file root.svg).
+%%
+%% ----------------------------------------------------------------------------
+%%
+%</identify>
+% \fi
%
-%<*batchfile>
-\ifx\documentclass\@undefined
+% \iffalse
+%<*dtx>
+\ifx\documentclass\undefined
\input docstrip.tex
\keepsilent
-\begingroup
-\catcode`\^^M=13 \catcode`\ =12 %
-\gdef\svgpreamble{%
-Copyright (C) Philip Ilten <philten@cern.ch>, 2012-2016
-Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017-
-
-This file was generated from file svg.dtx.
-----------------------------------------------------------------------------
-
-This work may be distributed and/or modified under the conditions
-of the LaTeX Project Public License, version 1.3c of the license.
-The latest version of this license is in
- http://www.latex-project.org/lppl.txt
-and version 1.3c or later is part of all distributions of
-LaTeX 2005/12/01 or later and of this work.
-
-This work has the LPPL maintenance status "author-maintained".
-
-The current maintainer and author of this work is Falk Hanisch.
-
-This work consists of the main source file README.md, LICENSE.md, svg.dtx
-and the derived documentation svg.pdf as well as the example files
-svg-example.svg, svg-preamble.tex and root.C (with derived file root.svg).
-}
-\endgroup
-
-\declarepreamble\svgbasepreamble
+\declarepreamble\svgmainpreamble
svg -- Include SVG pictures in LaTeX documents using Inkscape
-\svgpreamble
-
\endpreamble
\declarepreamble\svgextractpreamble
svg-extract -- Extract independent graphic files from SVG pictures
-\svgpreamble
-
\endpreamble
\askforoverwritefalse
\usedir{tex/latex/svg}
\generate{%
- \usepreamble\svgbasepreamble
- \file{svg.sty}{%
- \from{svg.dtx}{package,option,base}%
- \from{svg.dtx}{package,body,base}%
+ \usepreamble\svgmainpreamble
+ \file{svg.sty}{
+ \from{svg.dtx}{package,identify,main}
+ \from{svg.dtx}{package,base,main}
+ \from{svg.dtx}{package,option,main}
+ \from{svg.dtx}{package,body,main}
}
\usepreamble\svgextractpreamble
- \file{svg-extract.sty}{%
- \from{svg.dtx}{package,option,extract}%
- \from{svg.dtx}{package,body,extract}%
+ \file{svg-extract.sty}{
+ \from{svg.dtx}{package,identify,extract}
+ \from{svg.dtx}{package,base,extract}
+ \from{svg.dtx}{package,option,extract}
+ \from{svg.dtx}{package,standalone,extract}
+ \from{svg.dtx}{package,body,extract}
}
% \usepreamble\defaultpreamble
-% \file{svg-old.sty}{%
-% \from{svg.dtx}{package,old}%
+% \file{svg-old.sty}{
+% \from{svg.dtx}{package,old}
% }
}
\else
\let\endbatchfile\relax
\fi
\endbatchfile
-%</batchfile>
+%</dtx>
% \fi
%
% \iffalse
-%<package&option>\NeedsTeXFormat{LaTeX2e}[2020-02-02]
-%<*driver>
-\ifx\ProvidesFile\@undefined\def\ProvidesFile#1[#2]{}\fi
-\ProvidesFile{svg.dtx}[%
-%</driver>
-%<package&option&base>\ProvidesPackage{svg}[%
-%<package&option&extract>\ProvidesPackage{svg-extract}[%
-%<*driver|package&option>
- 2020/05/07 v2.02f\space%
-%<package&option&base> (include SVG pictures)%
-%<package&option&extract> (extract independent graphics from SVG pictures)%
-]
-%</driver|package&option>
-%<*driver>
+%<*dtx|package&identify>
+\NeedsTeXFormat{LaTeX2e}[2020-02-02]
+%<*dtx>
+\ifx\ProvidesFile\undefined\def\ProvidesFile#1[#2]{}\fi
+%</dtx>
+\begingroup
+ \catcode`\@11\relax%
+ \def\svg@Provides#1#2[#3]{%
+ \def\@tempa{\def\svg@version{#3}}%
+ \ifx\svg@version\@undefined\else%
+ \def\@tempb{#3}%
+ \ifx\svg@version\@tempb\else%
+ \def\@tempa{%
+ \@latex@warning@no@line{%
+ The version of package `#1' is `#3',\MessageBreak%
+ but `\svg@version' was expected!\MessageBreak%
+ You should update the svg bundle%
+ }%
+ }%
+ \fi%
+ \fi%
+ \edef\@tempb{%
+ \endgroup%
+%<*dtx>
+ \noexpand\ProvidesFile%
+%</dtx>
+%<package&identify> \noexpand\ProvidesPackage%
+ {#1}[#3\space(#2)]%
+%<package&identify&extract> \noexpand\RequirePackage{svg}[#3]%
+ \unexpanded\expandafter{\@tempa}%
+ }%
+ }%
+ \svg@Provides%
+%<*dtx>
+ {svg.dtx}{source}%
+%</dtx>
+%<package&identify&main> {svg}{include SVG pictures}%
+%<package&identify&extract> {svg-extract}{extract graphics from SVG pictures}%
+ [2020/06/12 v2.02g]%
+\@tempb
+%</dtx|package&identify>
+% \fi
+%
+% \iffalse
+%<*dtx>
\documentclass[english,xindy]{tudscrdoc}[2017/03/27]
-\usepackage[T1]{fontenc}
+\usepackage{iftex}[2020/03/06]
+\iftutex
+ \usepackage{fontspec}
+\else
+ \usepackage[T1]{fontenc}
+\fi
\usepackage{babel}
\KOMAoptions{parskip=half-}
\usepackage{marginnote}
@@ -129,18 +153,18 @@ svg-extract -- Extract independent graphic files from SVG pictures
\usepackage{listings}
\lstset{%
- inputencoding=utf8,extendedchars=true,
+ inputencoding=utf8,extendedchars=true,%
literate=%
{ä}{{\"a}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
{Ä}{{\"A}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
- {~}{{\textasciitilde}}1 {ß}{{\ss}}1
+ {ß}{{\ss}}1 {~}{{\textasciitilde}}1
+ {»}{{\guillemetright}}1 {«}{{\guillemetleft}}1
}
\newcommand*\svglstbelowskip{\medskipamount}
\AtBeginDocument{%
- \edef\svglstbelowskip{\the\glueexpr\medskipamount-\parskip\relax}
+ \renewcommand*\svglstbelowskip{\glueexpr\medskipamount-\parskip\relax}%
}
\lstdefinestyle{svg}{%
-% language=[LaTeX]TeX,%
basicstyle=\small\ttfamily,%
columns=flexible,%
frame=single,%
@@ -148,7 +172,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
xleftmargin=\fboxsep,%
xrightmargin=\fboxsep,%
gobble=2,%
- escapechar=§,
+ escapechar=§,%
belowskip=\svglstbelowskip,%
}
\lstnewenvironment{svgexample}[1][]{%
@@ -168,35 +192,36 @@ svg-extract -- Extract independent graphic files from SVG pictures
\CodelineIndex
\RecordChanges
\GetFileInfo{svg.dtx}
-\title{The packages \pkg{svg} and \pkg{svg-extract}}
-\author{%
- Philip Ilten (2012--2016) \\
- Falk Hanisch (2017--) \\
- \url{https://github.com/mrpiggi/svg} \\
- \mailto{hanisch.latex@outlook.com}
-}
-\date{\fileversion\nobreakspace(\filedate)}
\begin{document}
- \maketitle
+ \title{The packages \pkg{svg} and \pkg{svg-extract}}
+ \author{%
+ Philip Ilten (2012--2016)\\%
+ Falk Hanisch (2017--)\\%
+ \url{https://github.com/mrpiggi/svg}\\%
+ \mailto{hanisch.latex@outlook.com}%
+ }
+ \date{\fileversion\nobreakspace(\filedate)}
+ \providerobustcmd*\default[1]{\val{\textit{#1}}}
+ \maketitle%
\begin{abstract}
\noindent
The \pkg{svg} package is intended for the automated integration of
SVG~graphics into \LaTeX~documents. Therefor the capabilities provided
by \app{Inkscape}---or more precisely its command~line~interface---are used
to export the text within a SVG~graphic to a separate file, which is
- then rendered by \LaTeX. The two commands \cs{includesvg} and
+ then rendered by \LaTeX{}. The two commands \cs{includesvg} and
\cs{includeinkscape} are provided as central user\hbox{-}interface,
which are very similar to the \cs{includegraphics} command of the
\pkg{graphicx} package.
In addition, the package \pkg{svg-extract} allows the extraction of these
graphics into independent files in different graphic formats, exactly as it
- is rendered within the document. For the creation of these graphics in the
- well\hbox{-}known formats PDF, EPS and~PS, \LaTeX{} and possibly conversion
- tools shipped with the distribution are used. If the graphics are required
- in other file formats, either \app{ImageMagick} or \app{Ghostscript} can be
- invoked.
+ is rendered within the \LaTeX~document. For the creation of these graphics
+ in the well\hbox{-}known formats PDF, EPS and~PS, \LaTeX{} and possibly
+ conversion tools shipped with the distribution are used. If the graphics
+ are required in other file formats, either \app{ImageMagick} or
+ \app{Ghostscript} can be invoked.
\bigskip\noindent%
\fbox{\parbox{\dimexpr\linewidth-(\fboxsep+\fboxrule)*2\relax}{%
@@ -212,30 +237,24 @@ svg-extract -- Extract independent graphic files from SVG pictures
\tableofcontents
\DocInput{\filename}
\end{document}
-%</driver>
+%</dtx>
% \fi
%
% \changes{v1.0}{2004/11/05}{initial version by Philip Ilten}^^A
% \changes{v2.00}{2016/09/23}{new maintainer: Falk Hanisch}^^A
% \changes{v2.00}{2017/03/27}{re-implementation from scratch}^^A
% \changes{v2.00}{2017/03/27}{package \pkg{subfig} not required anymore}^^A
-% \changes{v2.00}{2017/03/27}{support of subfigures stopped due to the huge
+% \changes{v2.00}{2017/03/27}{support of subfigures stopped due to the huge
% number of packages which deal with this topic and the large variety of
% implementing this functionality; naming exported graphics after their
% consecutive numbering can't be ensured for all variants of subfigures, so
% it's neglected}^^A
-% \changes{v2.01}{2017/11/27}{new option \opt{svgextension} to change format of
-% files exported by \app{Inkscape} from \file{svg} to a custom one}^^A
-% \changes{v2.01}{2017/11/28}{usage of \cs{input}\marg{tex filename} within
-% \app{Inkscape}~graphics possible; locates files in all declared searched
-% folders}^^A
+% \changes{v2.01}{2017/11/28}{usage of \cs{input}\marg{tex~filename} within
+% \app{Inkscape}~graphics locates files in all declared searched folders}^^A
% \changes{v2.02}{2018/09/07}{package \pkg{trimspaces} required}^^A
% \changes{v2.02}{2018/09/07}{multiple dots within file names possible}^^A
-% \changes{v2.02}{2018/09/07}{fixed errors with active double qoutes from
+% \changes{v2.02}{2018/09/07}{fixed errors with active double quotes from
% \pkg{babel} in path arguments}^^A
-% \changes{v2.02}{2018/09/07}{distortion of included and extracted graphics
-% supported with options \opt{distort} (or \opt{keepaspectratio}) as well as
-% \opt{extractdistort} and rotation for extractions (\opt{extractangle})}^^A
% \changes{v2.02a}{2018/10/17}{fix bug for package \pkg{polyglossia} which
% fakes \pkg{babel} poorly}^^A
% \changes{v2.02b}{2018/11/12}{fix bug for package \pkg{tikzscale} which
@@ -244,9 +263,11 @@ svg-extract -- Extract independent graphic files from SVG pictures
% name parsing}^^A
% \changes{v2.02d}{2019/10/22}{fix bugs with kernel (2019/10/01) regarding file
% name parsing, see \url{https://github.com/mrpiggi/svg/issues/16}}^^A
-% \changes{v2.02f}{2020/05/06}{new option {inkscapeversion} for explicitly
-% setting \app{Inkscape}-CLI version; automatic detection implemented}^^A
-% \ToDo{Workaround for missing \cs{transparent} (Lua\TeX lacks support)}[v2.03]
+% \changes{v2.02d}{2019/10/22}{conditional invocation of \app{Inkscape} export
+% based on file modification date implemented for Xe\TeX{}}^^A
+% \changes{v2.02f}{2020/05/06}{command~line~interface of \app{Inkscape~1.0}
+% is supported}^^A
+% \changes{v2.02g}{2020/06/12}{fix for mutliple dots in file names (\#27)}^^A
%
%
%
@@ -257,13 +278,13 @@ svg-extract -- Extract independent graphic files from SVG pictures
% the simple and easy creation of images and diagrams using a graphical
% user\hbox{-}interface. The work by Johan\,B.\,C.~Engelen has further enhanced
% the ability of \app{Inkscape} to split a SVG~file into a text component that
-% can be compiled with \LaTeX, and an image component that can be imported as a
-% PDF~file. For further information see the documentation of
+% can be compiled with \LaTeX{}, and an image component that can be imported
+% as a PDF~file. For further information see the documentation of
% \hrfn{http://www.ctan.org/pkg/svg-inkscape}{\pkg{svg-inkscape} on CTAN}.
% The procedure described therein is taken up and consistently expanded. Thus,
% it is now possible to include a SVG~file into a \LaTeX~document where the
-% text within the SVG~graphic will be rendered natively by \LaTeX.
-%
+% text within the SVG~graphic will be rendered natively by \LaTeX{}.
+%
% Both packages \pkg{svg} and \pkg{svg-extract} rely heavily upon executing
% commands on shell using the \cs{ShellEscape} command---or respectively the
% old known \cs{write18}---for executing the CLIs of the applications mentioned
@@ -282,7 +303,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \file{inkscape -V}. Moreover, there are some required packages which are
% loaded by packages \pkg{svg} and \pkg{svg-extract} to provide the
% functionallity. These are:
-% \begin{description}[parsep=.5\smallskipamount]
+% \begin{description}[parsep=\glueexpr\smallskipamount/2\relax]
% \item[\pkg{iftex}]
% for flow control depending on the used \LaTeX~engine
% \item[\pkg{scrbase}]
@@ -323,17 +344,17 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
%
%
-% \section{Usage of package \pkg{svg}}\label{sec:inkscape}
+% \section{Usage of package \pkg{svg}\label{sec:inkscape}}
%
-% The purpose of this package is to include SVG~graphics into a \LaTeX~document.
-% The command \cs{includesvg} is defined which does all necessary steps for
-% this task. It first launches the export of a SVG~file to a supported
-% file~format with Inkscape, if necessary, and includes the exported
-% graphic~file afterwards. The usage and the syntax is quite similiar to the
-% command \cs{includegraphics} from the \pkg{graphicx} package. In fact, the
-% inclusion of the exported graphic~file is done with \cs{includegraphics}.
+% The purpose of this package is to include standalone SVG~graphics into a
+% \LaTeX~document. The command \cs{includesvg} is defined which does all
+% necessary steps for this task. It first launches the export of a SVG~file
+% to a supported file~format with Inkscape, if necessary, and includes the
+% exported graphic~file afterwards. The usage and the syntax is quite similiar
+% to the command \cs{includegraphics} from the \pkg{graphicx} package. In fact,
+% the inclusion of the exported graphic~file is done with \cs{includegraphics}.
%
-% \DescribeOptions{usexcolor,usetransparent,noxcolor,notransparent}
+% \DescribeOptions{usexcolor,usetransparent,noxcolor,notransparent}^^A
% The packages \pkg{xcolor} and \pkg{transparent} are loaded by default at the
% end of package \pkg{svg}. The listed options are intended to prevent these
% packages from loading. They are the only options which have to be given while
@@ -349,27 +370,28 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \subsection{General settings}
%
-% \DescribeMacro{\svgsetup}
+% \DescribeMacro{\svgsetup}^^A
% All other options described in detail below can also be changed after loading
% the package either in the preamble or within the document. They don't have to
% be given as optional argument to \cs{usepackage}\oarg{options}|{svg}| but can
-% be set by using macro \cs{svgsetup}\marg{options} where \marg{options} is a
+% be set by using macro \cs{svgsetup}\marg{options} where \meta{options} is a
% comma separated list of options. Settings with \cs{svgsetup} are done in the
% current scope which means globally or within the current group.
% \begin{svgexample}
% \svgsetup§\marg{options}§
% \end{svgexample}
-% Further, it's possible to reset any setting locally with the optional
-% argument of the commands \cs{includesvg}\oarg{options}\marg{svg filename} or
-% \cs{includesvg}\oarg{options}\marg{graphic filename}.
+% Further, with the optional argument of commands
+% \cs{includesvg}\oarg{options}\marg{svg~filename} or
+% \cs{includeinkscape}\oarg{options}\marg{graphic~filename}, it's possible to
+% reset any setting locally for a certain file.
%
-% \DescribeMacro{\svgpath}
+% \DescribeMacro{\svgpath}^^A
% Most likely you want to organize your SVG~files in a separate folder either
% as a subfolder in the working directory or elsewhere in your local folder
% structure. For this purpose, a list of root paths to SVG~files can be
% specified using the \cs{svgpath} command in the same way as \cs{graphicspath}
% is used. Every path has to be given in a group of braces |{}|---even if there
-% is only one---and terminate with |/| last. For example:
+% is only one---and should terminate with a slash. For example:
% \begin{svgexample}
% \svgpath{{svg/}{/usr/local/svg/}}
% \end{svgexample}
@@ -377,21 +399,23 @@ svg-extract -- Extract independent graphic files from SVG pictures
% afterwards in the absolute path \file{/usr/local/svg/}. Further, if no path
% was specified with \cs{svgpath} or the desired file wasn't found, all
% directories given with \cs{graphicspath} are searched too. Please keep in
-% mind that the current working directory is browsed first in any case. It's
-% recommended to avoid any spaces and/or quotes respectively \cs{dq} both in
-% paths and file~names, especially when DVI~output is active.
+% mind that the current working directory is browsed first in any case.
+% It is recommended to avoid umlauts or any other Non\hbox{-}ASCII characters
+% as well as any spaces and/or quotes respectively \cs{dq} both in paths and
+% file~names. Especially when DVI~output is active using quotes will certainly
+% cause an error.
%
%
%
% \subsection{Options for the invocation of \app{Inkscape}}
%
-% \DescribeOption{inkscape}
+% \DescribeOption{inkscape}^^A
% This option controls, when the export with \app{Inkscape} is invoked and is
-% \val{true} by default.
-% \begin{DescribeValues}
+% \default{true} by default.
+% \begin{DescribeValues}^^A
% \item[false/off/no]
% \app{Inkscape} won't be invoked in any case, no export is done.
-% \item[\textbf{true}/on/yes/newer/onlynewer]
+% \item[\default{true}/on/yes/newer/onlynewer]
% The export with \app{Inkscape} will only be done, if the exported
% graphic~file either does not exist or the file~modification date of the
% SVG~file is newer than that of the exported graphic~file. Thus the
@@ -401,12 +425,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
% The \app{Inkscape}~export will definitely be done, any already existing
% exported file will overwritten regardlessly.
% \end{DescribeValues}
-%
+%
% In addition to controlling the export behavior, the option \opt{inkscape} can
% also be used to make additional settings, which then acts as a wrapper for
% the options described below.
%
-% \begin{DescribeValues}
+% \begin{DescribeValues}^^A
% \item[pdf/eps/ps/png]
% see \opt{inkscapeformat}|=|\val{pdf/eps/ps/png}
% \item[latex/nolatex]
@@ -417,12 +441,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
% see \opt{inkscapedpi}|=|\val{\meta{integer}}
% \end{DescribeValues}
%
-% \DescribeOption{inkscapepath}
+% \DescribeOption{inkscapepath}^^A
% The option \opt{inkscapepath} specifies, where the resulting files of the
-% \app{Inkscape}~export should be located. The subfolder \file{./svg-inkscape/}
-% within the current working directory is used by default
-% (\opt{inkscapepath}|=|\val{basesubdir}).
-% \begin{DescribeValues}
+% \app{Inkscape}~export should be located. The default setting is
+% \default{basesubdir}, which uses the subfolder \file{./svg-inkscape/}
+% within the current working directory.
+% \begin{DescribeValues}^^A
% \item[svgdir/svgpath]
% The PDF/EPS/PS/PNG~graphic~files as well as the \LaTeX~files generated by
% \app{Inkscape} will be located in the same directory as the corresponding
@@ -432,7 +456,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% located in a subfolder named \file{svg-inkscape/}.
% \item[basedir/basepath/jobdir/jobpath]
% All exported files will be located in the current working directory.
-% \item[\textbf{basesubdir}/basesubpath/jobsubdir/jobsubpath]
+% \item[\default{basesubdir}/basesubpath/jobsubdir/jobsubpath]
% A subfolder named \file{svg-inkscape/} within the current working directory
% will be used for files generated by \app{Inkscape}.
% \item[/path/to/somewhere/]
@@ -442,29 +466,32 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \DescribeOption{inkscapeexe}^^A
% For including a SVG~file, \app{Inkscape} is used to separate the text and
-% image from the SVG~file itself. In order to run the command~line~interface
+% image from the SVG~file itself. In order to use the command~line~interface
% on shell, the path where the executable is located has to be known to the
-% operating system. You can check this by typing \file{inkscape -V} into the
-% terminal. If this fails and nothing is returned, you should add the binaray
-% directory of \app{Inkscape} to the environment variable \file{PATH} on your
-% operating system.
+% operating system and its name is assumed to be \val{inkscape} by default.
%
-% If this is not possible or you aren't willing to do so, you can use option
-% \opt{inkscapeexe} \emph{within the document preamble} to set the absolute
-% path where the executable of \app{Inkscape} is located. The option is set to
-% \opt{inkscapeexe}|=|\val{inkscape} by default.
+% You can check if the default setting is valid for your system by typing
+% \file{inkscape -V} into the terminal. If this fails and nothing is returned,
+% you should add the binary directory of \app{Inkscape} to the environment
+% variable \file{PATH} on your operating system. If this is not possible or you
+% aren't willing to do so, you can alternatively use option \opt{inkscapeexe}
+% \emph{within the document preamble} to set the absolute path where the
+% executable of \app{Inkscape} is located.
%
% \DescribeOption{inkscapeversion}^^A
+% \changes{v2.02f}{2020/05/06}{option {inkscapeversion} for explicitly setting
+% \app{Inkscape}-CLI version; automatic detection implemented}^^A
% The command~line~interface of \app{Inkscape} changed slightly from version
% \val{0.9x} to \val{1.x} and makes it necessary to distinguish between the two
% versions. By default, \opt{inkscapeversion}|=|\val{auto} is set and the used
-% version is detected by calling the given \opt{inkscapeexe} described above
-% with parameter~\prm{-V} on shell and evaluating the result by either piping
-%\val{stdout} or eventually writing it to a temporary file and read this back
+% version is automatically detected. This is done by calling \app{Inkscape}-CLI
+% with parameter~\prm{-V} on shell---see option \opt{inkscapeexe} described
+% above. The returned result is evaluated by either piping \val{stdout} or
+% eventually---if this fails---writing to a temporary file and read this back
% in (pipes with a potentially quoted path can not be used with MiK\TeX).^^A
% \footnote{^^A
-% If this fails, the used inkscape version is guessed when \cs{svg@ink@run}
-% is used the very first time.^^A
+% If this fails too, the \app{Inkscape} version is guessed when macro
+% \cs{svg@ink@run} is used the very first time.^^A
% }
% It is also possible to switch off the automatic detection routine by setting
% the desired version manually with either \opt{inkscapeversion}|=|\val{0} to
@@ -472,12 +499,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \DescribeOption{inkscapename}^^A
% The file names of the \app{Inkscape}~export are derived from the name of the
-% base SVG~file by default but can be modified with
-% \opt{inkscapename}|=|\file{\meta{filename}}. It's possible to use counters
-% for specifying the name of the exported file. Repeatedly specifying the same
-% file name will overwrite previously created files.
+% base SVG~file by default. Nevertheless, the name of the exported file can be
+% customized with \opt{inkscapename}|=|\file{\meta{filename}}. It is possible
+% to use counters for specifying the name of the exported file. Repeatedly
+% specifying the same file name will overwrite previously created files.
%
-% \DescribeOption{inkscapeformat}
+% \DescribeOption{inkscapeformat}^^A
% With this option, the \app{Inkscape}~export~format can be controlled. Valid
% values are \val{pdf}, \val{eps}, \val{ps} and \val{png}, where a \LaTeX~export
% is not possible for \val{png} and option \opt{inkscapelatex} won't have any
@@ -485,18 +512,18 @@ svg-extract -- Extract independent graphic files from SVG pictures
% was detected. In this case \opt{inkscapeformat}|=|\val{eps} is the default
% setting.
%
-% \DescribeOption{inkscapelatex}
+% \DescribeOption{inkscapelatex}^^A
% If option \opt{inkscapelatex}|=|\val{true} is set, the output is split into
% a seperate PDF/EPS/PS~file (see option \opt{inkscapeformat}) and a
% corresponding \LaTeX~file. This is the default setting. Setting
% \opt{inkscapelatex}|=|\val{false} will result in a single PDF/EPS/PS~file,
-% where any contained text won't be rendered by \LaTeX.
+% where any contained text won't be rendered by \LaTeX{}.
%
-% \DescribeOption{inkscapearea}
+% \DescribeOption{inkscapearea}^^A
% This option controls which area of the SVG~file should be exported,
-% \val{drawing} is set by default.
-% \begin{DescribeValues}
-% \item[\textbf{drawing}/crop]
+% \default{drawing} is set by default.
+% \begin{DescribeValues}^^A
+% \item[\default{drawing}/crop]
% The area exported corresponds to the bounding box of all objects in a
% drawing, including any that are not on the page.
% \item[page/nocrop]
@@ -504,61 +531,65 @@ svg-extract -- Extract independent graphic files from SVG pictures
% SVG~file.
% \end{DescribeValues}
%
-% \DescribeOption{inkscapedpi}
+% \DescribeOption{inkscapedpi}^^A
% The resolution used either for PNG~export or for fallback rasterization of
% filtered objects when exporting to PDF/EPS/PS~file. For PNG~export it is set
% to 300\,dpi by default, if no value was given. The given value should be a
% positive integer. The default behaviour can be reversed after a given value
% with \opt{inkscapedpi}|=|\val{\cs{relax}}.
%
-% \DescribeOption{inkscapeopt}
+% \DescribeOption{inkscapeopt}^^A
% You can use this option to pass additional switches to the \app{Inkscape}
% command~line~interface. For further information see the documentation of
% \hrfn{https://inkscape.org/de/doc/inkscape-man.html}{\app{Inkscape}}.
%
-% \DescribeOption{svgextension}
+% \DescribeOption{svgextension}^^A
+% \changes{v2.01}{2017/11/27}{option \opt{svgextension} added in order to
+% change the format of files exported by \app{Inkscape} from \file{svg} to
+% a custom one}^^A
% The package assumes SVG~files with \file{.svg} extension as source for the
% \app{Inkscape} export. This option can be used to change this behaviour.
% For example, in order to process \file{.dia} files instead of \file{.svg} you
% could use
% \begin{svgexample}
-% \includesvg[svgextension=dia,§\meta{additional options}§]§\marg{filename}§
+% \includesvg[svgextension=dia,§\meta{additional~options}§]§\marg{filename}§
% \end{svgexample}
%
%
%
% \subsection{Options for the graphic inclusion}
%
-% \DescribeOptions{width,height,distort,scale}
+% \DescribeOptions{width,height,distort,scale}^^A
+% \changes{v2.02}{2018/09/07}{option \opt{distort} (or \opt{keepaspectratio})
+% added for distortion of included graphics}^^A
% The width of the included graphic~file can be specified via the \opt{width}
% option and the height by the \opt{height} option. If both the width and
% height are specified, the figure will be scaled such that neither of the
% specified dimensions is exceeded, unless option \opt{distort}|=|\val{true} is
-% given.\footnote{\ignorespaces%
-% to provide compatibility for package \pkg{graphicx}, it's possible to use
-% \prm{keepaspectratio}|=|\val{true} as alias for \opt{distort}|=|\val{false}
-% and the other way round
-% } If \opt{width} and/or \opt{height} once have been set, this can be undone
+% given.\footnote{to provide compatibility for package \pkg{graphicx}, it's
+% possible to use \prm{keepaspectratio}|=|\val{true} as alias for
+% \opt{distort}|=|\val{false} and the other way round}
+% If \opt{width} and/or \opt{height} once have been set, this can be undone
% by setting them to \val{0pt} or \cs{relax}. If neither \opt{width} nor
% \opt{height} are set, the included graphic~file can also be scaled by setting
% \opt{scale} to a positive real number.
%
-% \DescribeOptions{pretex,apptex}
+% \DescribeOptions{pretex,apptex}^^A
% Commands prior and post to the inclusion of the graphic~file may be desired,
% such as font or color commands. The options \opt{pretex} and \opt{apptex} are
% provided where the \LaTeX~code given to \opt{pretex} is included before the
% graphic~file and \opt{apptex} right afterwards. For example, to change the
% size of the included text one could use:
% \begin{svgexample}
-% \includesvg[pretex=\tiny,§\meta{additional options}§]§\marg{svg filename}§
+% \includesvg[pretex=\tiny,§\meta{additional~options}§]§\marg{svg~filename}§
% \end{svgexample}
%
-% \DescribeOption{draft}
+% \DescribeOption{draft}^^A
% This option can be used with booelan values and is equal to the identically
% named option of the \pkg{graphicx} package. If the \opt{draft} option is
% given to \pkg{graphicx}, it's activated for \pkg{svg} as well.
%
-% \DescribeOption{lastpage}
+% \DescribeOption{lastpage}^^A
% A \hrfn{https://bugs.launchpad.net/ubuntu/+source/inkscape/+bug/1417470}{bug}
% concerning the \LaTeX~export has been reported for \app{Inkscape}\,0.91. It
% may happen that within the exported \LaTeX~file, it's attempted to include
@@ -567,38 +598,41 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% Consequently, the total number of pages is read and only existing PDF~pages
% are included, if both options \opt{inkscapeformat}|=|\val{pdf} and
-% \opt{lastpage}|=|\val{true} are set. This is the default setting and can be
-% switched off with \opt{lastpage}|=|\val{false}. It's also possible to set the
-% number of the last page included of a PDF~graphic manually as optional
-% parameter for \cs{includesvg} or \cs{includeinkscape}. For details, see the
-% description of the respective commands.
+% \opt{lastpage}|=|\val{true} are set. This is the default setting
+% (unless DVI~output is active) and can be switched off with
+% \opt{lastpage}|=|\val{false}. It's also possible to set the number of the
+% last page included of a PDF~graphic manually as optional parameter for
+% \cs{includesvg} or \cs{includeinkscape}. For details, see the description of
+% the respective commands.
%
%
%
% \subsection{Including SVG~files}
%
-% \DescribeMacro{\includesvg}
+% \DescribeMacro{\includesvg}^^A
% The command \cs{includesvg} to include a SVG~file is quite similar to the
% \cs{includegraphics} command provided by the \pkg{graphicx} package.
% \begin{svgexample}
-% \includesvg§\oarg{parameters}\marg{svg filename}§
+% \includesvg§\oarg{parameters}\marg{svg~filename}§
% \end{svgexample}
%
-% \begin{DescribeParameterParent}{Macro}{\includesvg}
-% \DescribeParameters{%
-% inkscape,inkscapeformat,inkscapelatex,inkscapearea,inkscapedpi,inkscapeopt,%
-% svgextension,width,height,distort,scale,pretex,apptex,draft,%
-% }
-% It is used right in the same way but where \marg{svg filename} is the
+% \begin{DescribeParameterParent}{Macro}{\includesvg}^^A
+% \DescribeParameters{inkscape,inkscapeformat,inkscapelatex,inkscapearea,^^A
+% inkscapedpi,inkscapeopt,svgextension,width,height,distort,scale,^^A
+% pretex,apptex,draft}^^A
+% It is used right in the same way but where \meta{svg~filename} is the
% file~name of the SVG~file, where any given file~extension will be replaced
% with \file{.svg} ruthlessly. In order to change the source file format for
% the \app{Inkscape} export, you have to use parameter \prm{svgextension}.
%
% If the given file is not located in the current working directory but
% elsewhere on your file~system, the command \cs{svgpath} could be used to
-% specify this path. It is recommended to avoid any spaces and/or quotes
-% respectively \cs{dq} both in paths an file~names. Espacially when DVI~output
-% is active using quotes will certainly cause an error.
+% specify this path.
+% \ToDo{reference to general note at the very beginning instead}[v2.03]^^A
+% It is recommended to avoid umlauts or any other Non\hbox{-}ASCII characters
+% as well as any spaces and/or quotes respectively \cs{dq} both in paths and
+% file~names. Especially when DVI~output is active using quotes will certainly
+% cause an error.
%
% The command \cs{includesvg} is intended to do an automated export with
% \app{Inkscape} at first, where the given SVG~file is exported to a
@@ -607,19 +641,19 @@ svg-extract -- Extract independent graphic files from SVG pictures
% invoked, if the SVG~file is newer than the exported graphic~file or latter
% doesn't exist at all. Once the export has been done, the graphic~file and
% maybe the \LaTeX~file are included.
-%
+%
% All previously described options can also be used as optional parameters to
% \cs{includesvg} and do have the same effect as described before. However, the
% optional parameters specified have an effect only once when \cs{includesvg}
% is executed and remain unchanged afterwards.
%
-% \DescribeParameter{lastpage}
+% \DescribeParameter{lastpage}^^A
% In addition to the use of boolean values, the parameter \prm{lastpage} can
% also be assigned a specific (integer) page number, which defines the last
% used page of a PDF~graphic. This, just like the identically named option, has
% an effect only when \prm{inkscapeformat}|=|\val{pdf} is set.
%
-% \DescribeParameters{angle,origin}
+% \DescribeParameters{angle,origin}^^A
% Both parameters correlate to the identically named parameters of the
% \cs{includegraphics} command provided by the \pkg{graphicx} package. However,
% unlike to \cs{includegraphics}, they \prm{angle} and \prm{origin} are
@@ -633,20 +667,18 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \subsection{Including already exported SVG~files}
%
-% \DescribeMacro{\includeinkscape}
+% \DescribeMacro{\includeinkscape}^^A
% If you don't want to make use of the automated export with \app{Inkscape} but
% the user\hbox{-}interface provided by the \pkg{svg} package, you can use
% \cs{includeinkscape} instead of \cs{includesvg}.
% \begin{svgexample}
-% \includeinkscape§\oarg{parameters}\marg{graphic filename}§
+% \includeinkscape§\oarg{parameters}\marg{graphic~filename}§
% \end{svgexample}
%
-% \begin{DescribeParameterParent}{Macro}{\includeinkscape}
-% \DescribeParameters{%
-% inkscapeformat,inkscapelatex,%
-% width,height,distort,scale,pretex,apptex,draft,lastpage,angle,origin,%
-% }
-% You can use it similar to \cs{includesvg} but \marg{graphic filename} has to
+% \begin{DescribeParameterParent}{Macro}{\includeinkscape}^^A
+% \DescribeParameters{inkscapeformat,inkscapelatex,width,height,distort,^^A
+% scale,pretex,apptex,draft,lastpage,angle,origin}^^A
+% You can use it similar to \cs{includesvg} but \meta{graphic~filename} has to
% be the filename of the already exported graphic file. If a valid
% file~extension (\file{.pdf/.eps/.ps/.png}) is given, the current setting for
% \opt{inkscapeformat} is overwritten. It's even possible to specify a
@@ -668,13 +700,13 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% In order to extract to PDF, EPS, or PS~files the programs \file{pstoeps},
% \file{pstopdf} and \file{pdftops} are used which are usually provided by most
-% of the \LaTeXe~distributions. In additon, the command~line~interfaces of
+% of the \LaTeX~distributions. In additon, the command~line~interfaces of
% \app{ImageMagick} and \app{Ghostscript} can be invoked for converting images
% in formats like PNG, JPG, TIF or something else. It's also possible to create
% PDF, EPS or PS~files with one of the two programs. Therefor the desired
% program---\file{magick} and/or \file{gswin32c}/\file{gswin64c} on Windows
% respectively \file{convert} and/or \file{gs} on unix-like operating
-% systems---must be installed. By typing \file{\meta{program} -{}-version} on
+% systems---must be installed. By typing \file{\meta{program}~-{}-version} on
% shell, this can be checked.
%
% If you want to extract independent graphic~files from included SVG~files, you
@@ -688,7 +720,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% In contrast to package \pkg{svg}, the console commands for graphic extraction
% are executed with each LaTeX run by package \pkg{svg-extract} when
-% \file{-{}-shell-escape} mode is activated. This behaviour can be switched of
+% \file{-{}-shell-escape} mode is activated. This behaviour can be switched off
% with option \opt{extract}|=|\val{false}.
%
% \minisec{Important changes}
@@ -699,13 +731,13 @@ svg-extract -- Extract independent graphic files from SVG pictures
% different \LaTeX~packages which all provide the possibility to include
% subfigures with very different implemetations, this feature can't be provided
% reliably by \pkg{svg-extract}. See option \opt{extractname} for further
-% information.
+% information.
%
%
%
% \subsection{General settings}
%
-% \DescribeOptions{on,off}
+% \DescribeOptions{on,off}^^A
% This options have to be given while loading the \pkg{svg-extract} package and
% are intended to toggle the functionality of this package. As both extracting
% and converting independent graphic~files is invoked with every \LaTeX~run
@@ -715,80 +747,76 @@ svg-extract -- Extract independent graphic files from SVG pictures
% used to reactivate functionality of this package. This can also be done by
% using \opt{extract}|=|\val{true}/\val{false}.
%
-% \DescribeMacros{\svgsetup,\includesvg,\includeinkscape}
+% \DescribeMacros{\svgsetup,\includesvg,\includeinkscape}^^A
% With package \pkg{svg-extract} the applicable options for
% \cs{svgsetup}\marg{options} as well as parameters for the already described
-% macros \cs{includesvg}\oarg{parameters}\marg{filename} and
-% \cs{includeinkscape}\oarg{parameters}\marg{filename} are extended. They can
-% be used to control the process of graphic extraction and converting.
-%
-% \begin{DescribeParameterParent}{Macro}{\includesvg}
-% \DescribeParameters{extractangle}
-% With this parameter the graphic is rotated during the extraction process. The
-% value is not inherited from \prm{angle} if it was given by default. this can
-% be achieved by setting:
-% \begin{svgexample}
-% \includesvg[angle=§\meta{angle}§,extractangle=inherit]§\marg{filename}§
-% \end{svgexample}
-% \end{DescribeParameterParent}
+% macros \cs{includesvg}\oarg{parameters}\marg{svg~filename} and
+% \cs{includeinkscape}\oarg{parameters}\marg{graphic~filename} are extended.
+% They can be used to control the process of graphic extraction and converting.
%
% All option described below can be used togehter with \cs{svgsetup} and are
% then valid in the current scope. There also exist identically named
% parameters for the optional arguments of
% \begin{svgexample}
-% \includesvg§\oarg{parameters}\marg{svg filename}§
-% \includeinkscape§\oarg{parameters}\marg{graphic filename}§
+% \includesvg§\oarg{parameters}\marg{svg~filename}§
+% \includeinkscape§\oarg{parameters}\marg{graphic~filename}§
% \end{svgexample}
-% These parameters have an effect only once when the specific command is
-% executed and remain unchanged afterwards.
-% \begingroup\ignorespaces%
-% \newcommand*\parameterlist{}\ignorespaces%
-% \listadd\parameterlist{extract}\ignorespaces%
-% \listadd\parameterlist{extractpreamble}\ignorespaces%
-% \listadd\parameterlist{extractformat}\ignorespaces%
-% \listadd\parameterlist{extractruns}\ignorespaces%
-% \listadd\parameterlist{latexopt}\ignorespaces%
-% \listadd\parameterlist{extractwidth}\ignorespaces%
-% \listadd\parameterlist{extractheight}\ignorespaces%
-% \listadd\parameterlist{extractdistort}\ignorespaces%
-% \listadd\parameterlist{extractscale}\ignorespaces%
-% \listadd\parameterlist{extractangle}\ignorespaces%
-% \listadd\parameterlist{extractpretex}\ignorespaces%
-% \listadd\parameterlist{extractapptex}\ignorespaces%
-% \listadd\parameterlist{convert}\ignorespaces%
-% \listadd\parameterlist{convertformat}\ignorespaces%
-% \listadd\parameterlist{convertdpi}\ignorespaces%
-% \listadd\parameterlist{magicksetting}\ignorespaces%
-% \listadd\parameterlist{magickoperator}\ignorespaces%
-% \listadd\parameterlist{gsopt}\ignorespaces%
-% \listadd\parameterlist{gsdevice}\ignorespaces%
-% \listadd\parameterlist{clean}\ignorespaces%
-% \listadd\parameterlist{exclude}\ignorespaces%
-% \def\buffer{}\def\do#1{\buffer\prm{#1}\def\buffer{, }}\ignorespaces%
-% These parameters are: \dolistloop{\parameterlist}.
-% \renewcommand*\marginpar[2][]{}\ignorespaces%
-% \def\do#1{\DescribeParameter{#1}}\ignorespaces%
-% \begin{DescribeParameterParent}{Macro}{\includesvg}%
-% \dolistloop{\parameterlist}%
-% \end{DescribeParameterParent}%
-% \begin{DescribeParameterParent}{Macro}{\includeinkscape}%
-% \dolistloop{\parameterlist}%
-% \end{DescribeParameterParent}%
-% \endgroup%
-%
-%
-%
-% \subsection{Extract independent grahic files}\label{sec:extract}
-% \DescribeOption{extract}
+% These have an effect only once, when the specific command is executed.
+%^^A \begingroup^^A
+%^^A \newcommand*\parameterlist{}^^A
+%^^A \listadd\parameterlist{extract}^^A
+%^^A \listadd\parameterlist{extractpreamble}^^A
+%^^A \listadd\parameterlist{extractformat}^^A
+%^^A \listadd\parameterlist{extractwidth}^^A
+%^^A \listadd\parameterlist{extractheight}^^A
+%^^A \listadd\parameterlist{extractdistort}^^A
+%^^A \listadd\parameterlist{extractscale}^^A
+%^^A \listadd\parameterlist{extractangle}^^A
+%^^A \listadd\parameterlist{extractpretex}^^A
+%^^A \listadd\parameterlist{extractapptex}^^A
+%^^A \listadd\parameterlist{extractruns}^^A
+%^^A \listadd\parameterlist{latexexe}^^A
+%^^A \listadd\parameterlist{latexopt}^^A
+%^^A \listadd\parameterlist{latexext}^^A
+%^^A \listadd\parameterlist{dvipsopt}^^A
+%^^A \listadd\parameterlist{pstoepsopt}^^A
+%^^A \listadd\parameterlist{pstopdfopt}^^A
+%^^A \listadd\parameterlist{pdftoepsopt}^^A
+%^^A \listadd\parameterlist{pdftopsopt}^^A
+%^^A \listadd\parameterlist{convert}^^A
+%^^A \listadd\parameterlist{convertformat}^^A
+%^^A \listadd\parameterlist{convertdpi}^^A
+%^^A \listadd\parameterlist{magicksetting}^^A
+%^^A \listadd\parameterlist{magickoperator}^^A
+%^^A \listadd\parameterlist{gsopt}^^A
+%^^A \listadd\parameterlist{gsdevice}^^A
+%^^A \listadd\parameterlist{clean}^^A
+%^^A \listadd\parameterlist{exclude}^^A
+%^^A \def\buffer{}\def\do#1{\buffer\prm{#1}\def\buffer{, }}^^A
+%^^A These parameters are: \dolistloop{\parameterlist}.
+%^^A \renewcommand*\marginpar[2][]{}^^A
+%^^A \def\do#1{\DescribeParameter{#1}}^^A
+%^^A \begin{DescribeParameterParent}{Macro}{\includesvg}^^A
+%^^A \dolistloop{\parameterlist}^^A
+%^^A \end{DescribeParameterParent}^^A
+%^^A \begin{DescribeParameterParent}{Macro}{\includeinkscape}^^A
+%^^A \dolistloop{\parameterlist}^^A
+%^^A \end{DescribeParameterParent}^^A
+%^^A \endgroup^^A
+%
+%
+%
+% \subsection{Extract independent grahic files\label{sec:extract}}
+%
+% \DescribeOption{extract}^^A
% This option can be used with boolean values. Using \opt{extract}|=|\val{true}
% activates the functionality for both extracting and converting which is the
% default setting, whereas \opt{extract}|=|\val{false} turns it off completely.
%
-% \DescribeOption{extractpath}
+% \DescribeOption{extractpath}^^A
% The path where the extracted and converted files are located can be specified
-% with option \opt{extractpath}, whereas \opt{extractpath}|=|\val{basesubdir}
-% is set by default.
-% \begin{DescribeValues}
+% with option \opt{extractpath}, whereas \default{basesubdir} is set by default.
+% \begin{DescribeValues}^^A
% \item[svgdir/svgpath]
% The extracted and converted independent graphic~files are located in the
% same directory as the corresponding SVG~file.
@@ -798,7 +826,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \item[basedir/basepath/jobdir/jobpath]
% All extracted and converted files will be located in the current working
% directory.
-% \item[\textbf{basesubdir}/basesubpath/jobsubdir/jobsubpath]
+% \item[\default{basesubdir}/basesubpath/jobsubdir/jobsubpath]
% A subfolder named \file{svg-extract/} within the current working directory
% will be used for all extracted and converted files.
% \item[/path/to/somewhere/]
@@ -806,58 +834,57 @@ svg-extract -- Extract independent graphic files from SVG pictures
% working directory (\file{./relative/path/}) or as an absolute path.
% \end{DescribeValues}
%
-% \DescribeOption{extractname}
+% \DescribeOption{extractname}^^A
% It's also possible to change the name for extracted and converted files. The
-% default setting is \opt{extractname}|=|\val{filenamenumbered}.
-% \begin{DescribeValues}
+% default setting is \opt{extractname}|=|\val{filenamenumbered}. The appended
+% file extension is derived from option \opt{extractformat}.
+% \begin{DescribeValues}^^A
% \item[filename/name]
% The name of the exported \app{Inkscape}~file is used and the suffix
% \file{-extract} is attached.
-% \item[\textbf{filenamenumbered}/namenumbered/numberedfilename/numberedname]
-% Same as above, but a prefix with the count of extracted files is used
-% instead of the suffix.
+% \item[\default{filenamenumbered}/namenumbered/numberedfilename/numberedname]
+% Same as above, but a prefix with the current enumerated count of SVG~files
+% is used instead of the suffix.
% \item[numbered/section/numberedsection/sectionnumbered]
-% The file name is composed by the number of extracted files and the current
-% outline numbering.
-% \item[\meta{filename}]
-% You can use any file name, the file extension is derived from option
-% \opt{extractformat}. It's possible to use counters for specifying the
+% The file name is composed by the current enumerated count of SVG~files and
+% the present outline numbering.
+% \item[\file{\meta{filename}}]
+% You can use any file name. It's possible to use counters for specifying the
% name of the extracted file. Repeatedly specifying the same file name will
% overwrite previously created files.
% \end{DescribeValues}
%
-% \DescribeOption{extractformat}
-% The included SVG~file can be extracted from the document into a independent
+% \DescribeOption{extractformat}^^A
+% The included SVG~file can be extracted from the document into an independent
% graphic~file of type PDF, EPS or PS. The option can be used with either a
% single value (\opt{extractformat}|=|\val{pdf}) or a comma separated list.
% For example,
% \begin{svgexample}
-% \includesvg[extractformat={pdf,eps,ps}]§\marg{svg filename}§
+% \includesvg[extractformat={pdf,eps,ps}]§\marg{svg~filename}§
% \end{svgexample}
% will extract the SVG~file to both PDF and EPS~formats and generates two
% independent graphic~files. By default, \opt{extractformat}|=|\val{pdf} is set
% unless DVI~output was detected. In this case \opt{extractformat}|=|\val{eps}
% is the default setting.
%
-% \DescribeOptions{%
-% extractwidth,extractheight,extractdistort,extractscale,
-% extractpretex,extractapptex,%
-% }
+% \DescribeOptions{extractwidth,extractheight,extractdistort,extractscale,^^A
+% extractpretex,extractapptex}^^A
+% \changes{v2.02}{2018/09/07}{option \opt{extractdistort} added for distortion
+% of extracted graphics}^^A
% These options can be used to overwrite the settings given for the appearance
% of a SVG~file within the document. For example, a SVG~file should cover the
-% entire text width within the document but be extracted to a fixed width, this
+% entire text width within the document but be extracted to a fixed width. This
% can be done with:
% \begin{svgexample}
-% \includesvg[width=\textwidth,extractwidth=500pt]§\marg{svg filename}§
+% \includesvg[width=\textwidth,extractwidth=500pt]§\marg{svg~filename}§
% \end{svgexample}
% Assigning the value \val{inherit} to one of these options---which is set by
% default---leads to the usage of the corresponding option of package \pkg{svg}
% (\opt{width}/\opt{height}/\opt{scale}/\opt{pretex}/\opt{apptex}), whereas
% \opt{extract\dots}|=|\val{\cs{relax}} can be used to ignore a parent option
-% utterly. Only option \opt{extractdistort} is initialized to \val{false} and
-% does not inherit from \opt{distort} by default.
+% utterly.
%
-% \DescribeOptions{extractpreamble,extractpreambleend}
+% \DescribeOptions{extractpreamble,extractpreambleend}^^A
% Within the included and extracted SVG~files any \LaTeX~macro can be used
% either defined by the user---this should be done in the preamble of the
% \LaTeX~document in which the SVG~file is to be included---or provided by a
@@ -865,7 +892,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% auxiliary \LaTeX~file all used packages and commands have to be known within
% this file. Consequently, the preamble of the current \LaTeX~document is used
% for the extraction of the SVG~file by default.
-%
+%
% However, it is possible to specify a different \emph{preamble~file} with the
% option \opt{extractpreamble} where the file to use as the preamble is given
% as the argument---including maybe path, but file~name and file~extension in
@@ -877,7 +904,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% option \opt{extractpreambleend} will be used, which is set to a default with
% \cs{begin}|{document}|.
%
-% \DescribeMacros{\svghidepreamblestart,\svghidepreambleend}
+% \DescribeMacros{\svghidepreamblestart,\svghidepreambleend}^^A
% In case, the preamble of the current \LaTeX~document is used, there are maybe
% packages included or some parts within the preamble, which should not be used
% within the separate auxiliary \LaTeX~file. These parts can be excluded if
@@ -897,33 +924,33 @@ svg-extract -- Extract independent graphic files from SVG pictures
% §\dots§
% \end{svgexample}
%
-% \DescribeOption{extractruns}
+% \DescribeOption{extractruns}^^A
% When extracting independent grahic~files by compiling the generated auxiliary
-% \LaTeX~file, it's maybe necessary to do multiple \LaTeX~runs on this file.
-% The number of runs can be controlled with option \opt{extractruns}. It's set
-% to \opt{extractruns}|=|\val{2} by default.
+% \LaTeX~file, it's maybe necessary to do multiple \LaTeX~iterations on this.
+% The number of iterations is controlled with option \opt{extractruns}. It is
+% set to \opt{extractruns}|=|\val{2} by default.
%
-% \DescribeOptions{latexexe,latexopt,latexext}
+% \DescribeOptions{latexexe,latexopt,latexext}^^A
% For the extraction of an independent grahic~file, the \LaTeX~program is used
% which is set by the \opt{latexexe} option. Depending on the \LaTeX~engine
% used for the current \LaTeX~document, it is set to either \app{pdflatex},
% \app{lualatex}, \app{xelatex} or \app{latex} by default. It's also possible
-% to specify additional flags or switches for the \LaTeX~runs, which are
+% to specify additional flags or switches for the \LaTeX~iterations, which are
% performed during the extraction process by the \opt{latexopt} option. If you
-% are used to utilize a other file~extension for \LaTeX~files than \file{.tex},
+% are used to utilize a different extension for \LaTeX~files than \file{.tex},
% option \opt{latexext} can be used like \opt{latexext}|=|\val{ltx}.
%
-% \DescribeOptions{dvipsopt,pstoepsopt,pstopdfopt,pdftoepsopt,pdftopsopt}
+% \DescribeOptions{dvipsopt,pstoepsopt,pstopdfopt,pdftoepsopt,pdftopsopt}^^A
% Depending on the used \LaTeX~engine, the file~type of the extracted
% graphic differs. In order to create all formats, requested with option
% \opt{extractformat}, several converting tools provided by most of the
-% \LaTeXe~distributions are maybe invoked. These are \file{dvips},
+% \LaTeX~distributions are maybe invoked. These are \file{dvips},
% \file{ps2eps}, \file{ps2pdf} and/or \file{pdftops} and can't be changed. It's
% only possible to specify additional switches for every single tool with
% \opt{dvipsopt}, \opt{pstoepsopt}, \opt{pstopdfopt}, \opt{pdftoepsopt} and
% \opt{pdftopsopt}.
%
-% \DescribeOption{clean}
+% \DescribeOption{clean}^^A
% During the extraction process many files are generated for each SVG~file
% extraction. So it's oftentimes desirable to automatically remove these
% temporary files. Using the option \opt{clean}|=|\val{true} will remove any
@@ -933,28 +960,51 @@ svg-extract -- Extract independent graphic files from SVG pictures
% file~extensions in order to specify auxiliary files generated by package
% \pkg{svg-extract} to be deleted, for example \opt{clean}|=|\val{\{log,aux\}}.
%
-% \DescribeOption{exclude}
+% \DescribeOption{exclude}^^A
% Sometimes it may be necessary to extract and/or convert a SVG~file without
% including it. If the flag \opt{exclude} is specified, the SVG~file will not
% be rendered in the current \LaTeX~document, but will be extracted and/or
% converted to the requested output format(s).
%
+% \DescribeMacros{\includesvg,\includeinkscape}^^A
+% As previously mentioned, for extracting independent graphic files it is
+% sufficient to load package \pkg{svg-extract} and afterwards everything
+% necassary is done by just using \cs{includesvg} or \cs{includeinkscape}.
+%
+% \begin{DescribeParameterParent}{Macro}{\includesvg}^^A
+% \DescribeParameter{extractangle}^^A
+% \begin{DescribeParameterParent}{Macro}{\includeinkscape}^^A
+% \renewcommand*\marginpar[2][]{}^^A
+% \DescribeParameter{extractangle}^^A
+% \changes{v2.02}{2018/09/07}{parameter \prm{extractangle} for \cs{includesvg}
+% and \cs{includeinkscape} implemented in order to rotate graphics during
+% extractions}^^A
+% With this additional parameter the graphic is rotated during the extraction
+% process. The value is not inherited from \prm{angle} if it was given by
+% default. This can be achieved by setting:
+% \begin{svgexample}
+% \includesvg[angle=§\meta{angle}§,extractangle=inherit]§\marg{svg~filename}§
+% \end{svgexample}
+% \end{DescribeParameterParent}
+% \end{DescribeParameterParent}
+%
+%
%
+% \subsection{Convert extracted grahic files\label{sec:convert}}
%
-% \subsection{Convert extracted grahic files}\label{sec:convert}
-%
% Based on the extraction of independent graphic~files, the \pkg{svg-extract}
-% packages also provides the possibility to convert those extracted graphics in
+% packages also provides the possibility to convert these extracted graphics in
% another format than PDF, EPS or PS with either \app{ImageMagick}---which is
% set by default---or \app{Ghostscript}.
%
-% \DescribeOption{convert}
+% \DescribeOption{convert}^^A
% This option can be used to control the invocation of the conversion process.
% By default, \opt{convert}|=|\val{false} is set. For Windows, there exist two
% different versions of \app{Ghostscript}, either 64\,bit or 32\,bit. If
% it is selected as converting tool the 64\,bit~executable is set by default.
-% \begin{DescribeValues}
-% \item[\textbf{false}/off/no]
+% Please note, that option \opt{extract} has to be activated.
+% \begin{DescribeValues}^^A
+% \item[\default{false}/off/no]
% No conversion is done.
% \item[true/on/yes]
% The conversion will be done with the current chosen converting tool.
@@ -970,8 +1020,8 @@ svg-extract -- Extract independent graphic files from SVG pictures
% The same as for the latter case applies, only option
% \opt{gsexe}|=|\val{gswin32c} is set on Windows.
% \end{DescribeValues}
-%
-% \DescribeOption{convertformat}
+%
+% \DescribeOption{convertformat}^^A
% With this option, the desired output format(s) can be given. Multiple graphic
% formats can be specified in a list, for example something like
% \opt{convertformat}|=|\val{\{png,jpg,tif\}}. The value specified in
@@ -993,7 +1043,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% desired output~format is trailed with |+| as inner key.
%
% The first variant is applied to all output formats in general. If one of
-% these mentioned options is evaluated and a output format specific value was
+% these mentioned options is evaluated and an output format specific value was
% given like in the second variant, the general setting is overwritten. If the
% general setting should be used and extended by an additional output format
% specific settings, then the third variant is to be used. In this case, no
@@ -1004,7 +1054,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% or a specific one
% (\opt{\meta{option}}|=|\val{\{\meta{outputformat}[+]=\cs{relax}\}}).
%
-% \DescribeOption{convertdpi}
+% \DescribeOption{convertdpi}^^A
% This option controls the used density for all file~formats or a specific one,
% whether \app{ImageMagick} or \app{Ghostscript} is used for the graphic
% conversion. The desired resolution of the converted file is given in dots per
@@ -1033,9 +1083,10 @@ svg-extract -- Extract independent graphic files from SVG pictures
% the used conversion tool and not to the processing of the option.
%
%
+%
% \subsubsection{Settings for the invocation of \app{ImageMagick}}
%
-% \DescribeOptions{magickexe,magicksetting,magickoperator}
+% \DescribeOptions{magickexe,magicksetting,magickoperator}^^A
% The conversion with \app{ImageMagick} via the \file{magick} or \file{convert}
% command~line~interface can be controlled with these options. The option
% \opt{magickexe} determines the used executable and is set to \file{magick} on
@@ -1046,13 +1097,14 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \opt{magickoperator} can be set for all output formats or a \emph{specific}
% one either resetting or extending the general settings. For further
% information see the documentation of
-% \hrfn{http://www.imagemagick.org/script/command-line-processing.php}%
+% \hrfn{http://www.imagemagick.org/script/command-line-processing.php}^^A
% {\app{ImageMagick} command~line~interface}.
%
%
+%
% \subsubsection{Settings for the invocation of \app{Ghostscript}}
%
-% \DescribeOptions{gsexe,gsdevice,gsopt}
+% \DescribeOptions{gsexe,gsdevice,gsopt}^^A
% The conversion with \app{Ghostscript} is done with command~line~interface
% \file{gswin64c} or \file{gswin32c} on Windows and \file{gs} on unix-like
% operating systems. The executable can be changed with option \opt{gsexe}.
@@ -1073,14 +1125,14 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
%
%
+% \cleardoublepage
% \section{Example}
%
-% As an minimal example\footnote{\ignorespaces%
-% The image used here is a slightly modified version of the image used in the
-% initial documentation on how to include a SVG~file in \LaTeX{} by
-% Johan\,B.\,C.~Engelen available as package
-% \href{http://www.ctan.org/pkg/svg-inkscape}{\pkg{svg-inkscape} on CTAN}.
-% } take the following lines of code:
+% As an minimal example\footnote{The image used here is a slightly modified
+% version of the image used in the initial documentation on how to include a
+% SVG~file in \LaTeX{} by Johan\,B.\,C.~Engelen available as package
+% \href{http://www.ctan.org/pkg/svg-inkscape}{\pkg{svg-inkscape} on CTAN}.}
+% take the following lines of code:
% \begin{svgexample}
% \documentclass{article}
% \usepackage[T1]{fontenc}
@@ -1092,58 +1144,59 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \usepackage{subcaption}
% \begin{document}
% \begin{figure}
-% \begin{minipage}{.5\linewidth}
+% \begin{minipage}{\dimexpr\linewidth/2\relax}
% \includesvg[width=\linewidth]{svg-example}%
-% \subcaption{This text is too large!}
+% \subcaption{This text is too large!}%
% \end{minipage}%
-% \begin{minipage}{.5\linewidth}
+% \begin{minipage}{\dimexpr\linewidth/2\relax}
% \includesvg[width=\linewidth,pretex=\relscale{0.6}]{svg-example}%
-% \subcaption{This text fits better.}
+% \subcaption{This text fits better.}%
% \end{minipage}
-% \caption{An example figure with \LaTeX~support}\label{fig:example}
+% \caption{An example figure with \LaTeX~support\label{fig:example}}%
% \end{figure}
% \begin{figure}\centering
% \includesvg[%
% width=.5\linewidth,inkscapelatex=false,extractformat={pdf,eps}%
% ]{svg-example}%
-% \caption{The same example figure without \LaTeX~support}
+% \caption{The same example figure without \LaTeX~support}%
% \end{figure}
% \end{document}
% \end{svgexample}
% \begin{figure}[tb]
-% \null\hfill\ignorespaces%
-% \begin{minipage}{.45\linewidth}
-% \includesvg[width=\linewidth]{svg-example}%
-% \subcaption{This text is too large!}\label{fig:example-tex-a}
-% \end{minipage}\hfill\ignorespaces%
-% \begin{minipage}{.45\linewidth}
-% \includesvg[width=\linewidth,pretex=\relscale{0.6}]{svg-example}%
-% \subcaption{This text fits better.}\label{fig:example-tex-b}
+% \null\hfill^^A
+% \begin{minipage}{\dimexpr\linewidth*9/20\relax}
+% \includesvg[width=\linewidth]{svg-example}^^A
+% \subcaption{This text is too large!\label{fig:example-tex-a}}^^A
+% \end{minipage}\hfill^^A
+% \begin{minipage}{\dimexpr\linewidth*9/20\relax}
+% \includesvg[width=\linewidth,pretex=\relscale{0.6}]{svg-example}^^A
+% \subcaption{This text fits better.\label{fig:example-tex-b}}^^A
% \end{minipage}
-% \hfill\null\ignorespaces%
-% \caption{An example figure with \LaTeX~support}\label{fig:example-tex}
+% \hfill\null^^A
+% \caption{An example figure with \LaTeX~support\label{fig:example-tex}}^^A
% \end{figure}
% \begin{figure}[tb]\centering
-% \includesvg[%
-% width=.5\linewidth,inkscapelatex=false,extractformat={pdf,eps}%
-% ]{svg-example}%
-% \caption{The same example figure without \LaTeX~support}\label{fig:example}
+% \includesvg[^^A
+% width=.5\linewidth,inkscapelatex=false,extractformat={pdf,eps}^^A
+% ]{svg-example}^^A
+% \caption{^^A
+% The same example figure without \LaTeX~support\label{fig:example}^^A
+% }^^A
% \end{figure}
%
-% If you are willing to compile the example, there are two aspects to consider.
-% First, the included SVG~file \file{svg-example.svg} has to be located in the
-% current folder and is located in \file{\meta{texmf}/doc/latex/svg/examples/}.
-% Second, you have to run the desired \LaTeX~engine with
-% \file{-{}-shell-escape} option enabled.
-%
% The output is shown in \autoref{fig:example-tex} and \autoref{fig:example}.
% Within this example the file \file{svg-example.svg} was included three times
% using the \cs{includesvg} command.
-%
+%
+% If you are willing to compile the example, there are two aspects to consider.
+% First, the included SVG~file \file{svg-example.svg} has to be located in the
+% current folder and is located in \file{\meta{texmf}/doc/latex/svg/}. Second,
+% you have to run the desired \LaTeX~engine with flag \file{-{}-shell-escape}.
+%
% As you can see, \autoref{fig:example-tex-a} is created with default settings,
-% except for the width specification. So the \app{Inkscape}~export with
-% \LaTeX~support is done as well as the extraction of a independent graphic~file
-% in PDF~format as the \pkg{svg-extract} package was loaded.
+% except the width specification. The \app{Inkscape}~export with \LaTeX~support
+% is done and the extraction of an independent graphic~file in PDF~format as
+% the \pkg{svg-extract} package was loaded.
%
% However, the text is slightly overrunning the margins of the image, and so
% \autoref{fig:example-tex-b}---which again uses the same \app{Inkscape}~export
@@ -1177,7 +1230,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% |Package svg Info:| or |Package svg-extract Info:|
% \end{quote}
% Right afterwards, there should appear |runsystem(<command>)...excuted.| which
-% you should try to execute manually from terminal in the right directory. In
+% you should try to execute manually at the terminal in the right directory. In
% most cases, the problem will be an invalid command call. If something goes
% wrong during the extraction/converting process of package \pkg{svg-extract},
% it would make sense to set option \opt{clean}|=|\val{false} to not delete any
@@ -1190,9 +1243,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \minisec{When using pdf\LaTeX{} there are a lot of warnings}
%
% It may happen that several warnings like
-% \begin{quote}\ttfamily\raggedright%
+% \begin{quote}\ttfamily\raggedright^^A
% pdfTeX warning:\,pdflatex.exe(file \meta{filename}.pdf):\,PDF inclusion:
-% multiple pdfs with page group included in a single page
+% multiple pdfs with page group included in a single page^^A
% \end{quote}
% occur when including the PDF~graphics exported with \app{Inkscape}. This is
% related to the handling of transparency effects within PDF~files. Since
@@ -1206,7 +1259,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \section{Include SVG files created with \app{ROOT}}
%
% This section was originally written by Philip Ilten. In the hope that since
-% then nothing has changed fundamentally in the described procedure, this
+% then nothing has changed fundamentally in the described procedure. This
% passage remains in the documentation, even if it will almost certainly be
% relevant to experimental particle physicists only, who frequently use the
% analysis package \app{ROOT}.
@@ -1257,7 +1310,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% Consider the following example image produced by \app{ROOT} in
% \autoref{fig:root}. This figure was generated by the \app{ROOT} macro
-% \file{root.C}, provided within \file{\meta{texmf}/doc/latex/svg/examples/},
+% \file{root.C}, provided within \file{\meta{texmf}/doc/latex/svg/},
% which produces the file~\file{root.svg} when run. The code used to produce
% this SVG~file from within \app{ROOT} is
% \lstinputlisting[style=svg,backgroundcolor=\color{red!10}]{examples/root.C}
@@ -1272,27 +1325,35 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \includesvg[%
% inkscapearea=page,height=6cm,pretex=\tiny,convertformat=png%
% ]{root}%
-% \caption{Rendering of a \app{ROOT} plot---no more \emph{Comic CERNs}}%
-% \label{fig:root}%
+% \caption{%
+% Rendering of a \app{ROOT} plot---no more \emph{Comic CERNs}%
+% \label{fig:root}%
+% }%
% \end{figure}
% \end{svgexample}
% \begin{figure}
-% \centering%
-% \includesvg[%
-% inkscapearea=page,height=6cm,pretex=\tiny,convertformat=png%
-% ]{root}%
-% \caption{Rendering of a \app{ROOT} plot---no more \emph{Comic CERNs}}%
-% \label{fig:root}%
+% \centering^^A
+% \includesvg[^^A
+% inkscapearea=page,height=6cm,pretex=\tiny,convertformat=png^^A
+% ]{root}^^A
+% \caption{^^A
+% Rendering of a \app{ROOT} plot---no more \emph{Comic CERNs}
+% \label{fig:root}^^A
+% }^^A
% \end{figure}
% which includes the graphic as well as the \LaTeX~file exported by
% \app{Inkscape}, produces the extracted PDF~image~(\file{root.pdf}) and
% converts this to a PNG~image~(\file{root.png}) by using \app{ImageMagick}.
-% Enjoy plots from \app{ROOT} with natively rendered \LaTeX!
+% Enjoy plots from \app{ROOT} with natively rendered \LaTeX{}!
%
-% \StopEventually{\clearpage\PrintIndex\PrintChanges\PrintToDos}
+% \StopEventually{^^A
+% \cleardoublepage\PrintIndex^^A
+% \cleardoublepage\PrintChanges^^A
+% \cleardoublepage\PrintToDos^^A
+% }
%
% \iffalse
-%<*package&option>
+%<*package&base>
% \fi
%
%
@@ -1303,66 +1364,553 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \section{Initialization}
% \subsection{Packages}
%
-% The package \pkg{svg} requires package \pkg{iftex} for detecting the used
-% \LaTeX~engine, \pkg{scrbase} for options processing, \pkg{pdftexcmds} for
-% pdf\TeX{} primitives when using Lua\TeX, \pkg{shellesc} and \pkg{ifplatform}
-% for engine independent access to systems commands and files as well as
-% \pkg{graphicx} for the inclusion of PDF~files. The usage of packages
-% \pkg{xcolor} and \pkg{transparent} can be switched of with the corresponding
-% options. Package \pkg{svg-extract} only needs package \pkg{svg} itself.
+% The package \pkg{svg} mainly requires \pkg{scrbase} for options processing
+% and \pkg{graphicx} for the inclusion of the exported graphic~files.
+%
+% The packages \pkg{iftex} and \pkg{pdftexcmds} are needed to detect the used
+% \LaTeX~engine on the one hand and enabling pdf\TeX{} primitives independent
+% of the used \LaTeX~engine on the other hand. Additionally, \pkg{trimspaces}
+% is responsible for string manipulation. Both packages \pkg{shellesc} and
+% \pkg{ifplatform} are used for engine independent access to systems commands
+% and files. The package \pkg{svg-extract} only needs package \pkg{svg} itself,
+% which is loaded during initialization.
% \begin{macrocode}
-%<*base>
+%<*main>
\RequirePackage{iftex}[2020/03/06]
\RequirePackage{scrbase}[2020/04/19]
\RequirePackage{pdftexcmds}[2019/11/24]
-\RequirePackage{shellesc}[2019/11/08]
\RequirePackage{trimspaces}[2009/09/17]
\RequirePackage{graphicx}[2019/11/30]
-%</base>
-%<*extract>
-\RequirePackage{svg}[2020/05/07]
-%</extract>
+\RequirePackage{shellesc}[2019/11/08]
+% \end{macrocode}
+% In order to do not raise a warning, package \pkg{ifplatform} is only used if
+% \file{-{}-shell-escape} flag is enabled.
+% \begin{macrocode}
+\ifnum\pdf@shellescape=\@ne\relax
+ \RequirePackage{ifplatform}[2017/10/13]
+\fi
+%</main>
+% \end{macrocode}
+%
+%
+%
+% \subsection{Dealing with catcodes}
+%
+% The catcode for double quotes are temporarily changed and restored at the
+% very end of both packages.
+% \begin{macrocode}
+\edef\svg@catcodecodes@restore{%
+ \catcode`\noexpand\"\the\catcode`\"\relax%
+}
+\@makeother\"%
+\AtEndOfPackage{\svg@catcodecodes@restore}
% \end{macrocode}
%
% \iffalse
-%<*base>
+%<*main>
% \fi
%
-% \subsection{Helper macros}
+%
+%
+% \subsection{General macros}
%
% \begin{macro}{\svg@tempa}
% \begin{macro}{\svg@tempb}
-% \begin{macro}{\svg@box}
% \begin{macro}{\if@svg@tempswa}
-% Internal temporary macros. The catcode for double quotes are also temporarily
-% changed.
+% Internal temporary macros.
% \begin{macrocode}
\newcommand*\svg@tempa{}
\newcommand*\svg@tempb{}
-\newbox\svg@box
\newif\if@svg@tempswa
-\edef\svg@catcodecodes@restore{%
- \catcode`\noexpand\"\the\catcode`\"\relax%
-}
-\@makeother\"%
% \end{macrocode}
% \end{macro}^^A \if@svg@tempswa
-% \end{macro}^^A \svg@box
% \end{macro}^^A \svg@tempb
% \end{macro}^^A \svg@tempa
%
+%
+%
+% \subsubsection{Macros for process control}
+%
+% \begin{macro}{\svg@ifwindowsdetected}
+% Do some Windows specific stuff if it was detected.
+% \begin{macrocode}
+\newcommand*\svg@ifwindowsdetected{\@secondoftwo}
+\AfterPackage*{ifplatform}{%
+ \renewcommand*\svg@ifwindowsdetected{%
+ \ifwindows%
+ \expandafter\@firstoftwo%
+ \else%
+ \expandafter\@secondoftwo%
+ \fi%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@ifwindowsdetected
+% \begin{macro}{\svg@ifvalueisrelax}
+% For some keys the usage of \val{\cs{relax}} as a value should lead to a
+% special reaction, such as restoring to default behavior or reseting the key.
+% Therefore, \cs{svg@ifvalueisrelax} checks, whether \val{\cs{relax}} was used
+% as value or not.
+% \begin{macrocode}
+\newcommand*\svg@ifvalueisrelax[1]{%
+ \begingroup%
+ \def\svg@tempa{#1}%
+ \def\svg@tempb{\relax}%
+ \ifx\svg@tempa\svg@tempb%
+ \aftergroup\@firstoftwo%
+ \else%
+ \aftergroup\@secondoftwo%
+ \fi%
+ \endgroup%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@ifvalueisrelax
+%
+% \iffalse
+%</main>
+%<*extract>
+% \fi
+%
+% \begin{macro}{\svgx@ifkeyandval}
+% \begin{macro}{\svgx@@ifkeyandval}
+% It is checked whether a key was given as \val{\meta{key}=\meta{value}} or
+% like \val{\meta{key}=\{\meta{format}=\meta{value}\}}.
+% \begin{macrocode}
+\newcommand*\svgx@@ifkeyandval{}
+\newcommand*\svgx@ifkeyandval[3]{%
+ \def\svgx@@ifkeyandval##1=##2=##3\@nil{\IfArgIsEmpty{##3}{#3}{#2}}%
+ \svgx@@ifkeyandval#1==\@nil%
+}
+% \end{macrocode}
+% \end{macro}^^A \svgx@@ifkeyandval
+% \end{macro}^^A \svgx@ifkeyandval
+%
% \iffalse
-%</base>
+%</extract>
+%<*main>
% \fi
%
%
+%
+% \subsubsection{String manipulation}
+%
+% Both packages \pkg{svg} and \pkg{svg-extract} should be able to handle
+% user-defined input and output paths. As there is the possibility for users to
+% provide paths with or without quotes to \LaTeX{}, this is taken into account.
+%
+% \begin{macro}{\svg@deactivate@dq}
+% \changes{v2.02}{2018/09/07}{new}^^A
+% \changes{v2.02a}{2018/10/17}{bug fix for \pkg{polyglossia}}^^A
+% In order to avoid errors concerning file names with package \pkg{babel} and
+% it's active double quotes, this command is defined.
+% \begin{macrocode}
+\newcommand*\svg@deactivate@dq{}
+\AfterPackage+{babel}{%
+ \renewcommand*\svg@deactivate@dq{\bbl@deactivate{"}}%
+ \providecommand*\bbl@deactivate[1]{}%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@deactivate@dq
+% \begin{macro}{\svg@sanitize@dq}
+% \changes{v2.02}{2018/09/07}{new}^^A
+% Save expansion of the second argument in the macro from the first argument
+% with deactivated double quotes.
+% \begin{macrocode}
+\newcommand*\svg@sanitize@dq[2]{%
+ \begingroup%
+ \svg@deactivate@dq%
+ \edef\svg@tempa{\endgroup\def\noexpand#1{#2}}%
+ \svg@tempa%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@sanitize@dq
+% \begin{macro}{\svg@quotes@check}
+% \begin{macro}{\svg@quotes@@check}
+% \begin{macro}{\if@svg@quotes@found}
+% During the treatment of paths, it may be necessary to temporarily remove
+% quotes and, if required, add them again later. For this purpose, the switch
+% \cs{if@svg@quotes@found} as well as the commands \cs{svg@quotes@check} and
+% \cs{svg@quotes@@check}, which controls the switch, are defined. As before,
+% the string is passed in a macro to \cs{svg@quotes@check}.
+% \begin{macrocode}
+\newif\if@svg@quotes@found
+\newcommand*\svg@quotes@check[1]{%
+ \expandafter\svg@quotes@@check#1"\@nil%
+}
+\newcommand*\svg@quotes@@check{}
+\def\svg@quotes@@check#1"#2\@nil{%
+ \IfArgIsEmpty{#2}{\@svg@quotes@foundfalse}{\@svg@quotes@foundtrue}%
+}
+% \end{macrocode}
+% \end{macro}^^A \if@svg@quotes@found
+% \end{macro}^^A \svg@quotes@@check
+% \end{macro}^^A \svg@quotes@check
+% \begin{macro}{\svg@quotes@remove}
+% \changes{v2.02}{2018/09/07}{usage of \cs{svg@sanitize@dq}}^^A
+% \changes{v2.02}{2018/09/07}{calling \cs{svg@quotes@check}}^^A
+% \begin{macro}{\svg@quotes@@remove}
+% These two commands are used to remove all occurring quotes within a string.
+% The only argument passed to \cs{svg@quotes@remove} is not the string itself
+% but a macro in which a string is stored.
+% \begin{macrocode}
+\newcommand*\svg@quotes@remove[2][]{%
+ \begingroup%
+ \IfArgIsEmpty{#1}{\def\svg@tempb{#2}}{\def\svg@tempb{#1}}%
+ \svg@sanitize@dq\svg@tempa{\svg@tempb}%
+ \expandafter\svg@quotes@check\expandafter{\svg@tempa}%
+ \expandafter\svg@quotes@@remove\svg@tempa""\@nil%
+ \edef\svg@tempb{%
+ \endgroup%
+ \def\noexpand#2{\svg@tempa}%
+ \if@svg@quotes@found%
+ \noexpand\@svg@quotes@foundtrue%
+ \else%
+ \noexpand\@svg@quotes@foundfalse%
+ \fi%
+ }%
+ \svg@tempb%
+}
+\newcommand*\svg@quotes@@remove{}
+\def\svg@quotes@@remove#1"#2"#3\@nil{%
+ \IfArgIsEmpty{#2}{%
+ \edef\svg@tempa{#1}%
+ }{%
+ \svg@quotes@@remove#1#2#3""\@nil%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@quotes@@remove
+% \end{macro}^^A \svg@quotes@remove
+% \begin{macro}{\svg@remove@leadingchar}
+% \changes{v2.02}{2018/09/07}{new}^^A
+% This command removes the single character in given with the first argument
+% from the expanded macro in the second argument.
+% \begin{macrocode}
+\newcommand*\svg@remove@leadingchar[2]{%
+ \begingroup%
+ \svg@sanitize@dq\svg@tempa{#2}%
+ \def\svg@tempb{%
+ \def\svg@tempa####1\@nil{\def\svg@tempa{####1}}%
+ \kernel@ifnextchar#1%
+ {\expandafter\svg@tempa\@gobble}%
+ {\svg@tempa}%
+ }%
+ \expandafter\svg@tempb\svg@tempa\@nil%
+ \edef\svg@tempb{%
+ \endgroup%
+ \def\noexpand#2{\svg@tempa}%
+ }%
+ \svg@tempb%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@remove@leadingchar
+%
+%
+%
+% \subsubsection{File handling}
+%
+% \begin{macro}{\svg@filename@parse}
+% \changes{v2.02}{2018/09/07}{usage of \cs{svg@sanitize@dq}}^^A
+% \changes{v2.02}{2018/09/07}{usage of \cs{svg@remove@leadingchar}}^^A
+% \changes{v2.02}{2018/09/07}{usage of \cs{svg@extension@parse}}^^A
+% As the internal \LaTeX{} command \cs{filename@parse} is not able to split a
+% given file name containing quotes, \cs{svg@filename@parse} is defined to
+% resolve this problem. The optional argument can be used to give a specific
+% file extension, which should be searched within \cs{filename@ext}. If found
+% at the very end, the previous part is appended to \cs{filename@base}.
+% \begin{macrocode}
+\newcommand*\svg@filename@parse[2][]{%
+ \begingroup%
+% \end{macrocode}
+% The given path and file is parsed with \cs{filename@parse}.
+% \begin{macrocode}
+ \svg@sanitize@dq\svg@tempa{#2}%
+ \expandafter\filename@parse\expandafter{\svg@tempa}%
+% If there are quotes in the file path, the closing one will be found as first
+% character in \cs{filename@base} as \cs{filename@area} is splitted at the last
+% slash. This leading quote is removed from \cs{filename@base} with
+% \cs{svg@remove@leadingchar}.
+% \begin{macrocode}
+ \svg@quotes@remove{\filename@area}%
+ \if@svg@quotes@found%
+ \edef\filename@area{"\filename@area"}%
+ \svg@remove@leadingchar"\filename@base%
+ \fi%
+% \end{macrocode}
+% The found extension is parsed against the optional argument. If a double quote
+% was found within the extension, it actually belongs to \cs{filename@base}.
+% \begin{macrocode}
+ \ifx\filename@ext\relax\else%
+ \svg@quotes@remove{\filename@ext}%
+ \svg@extension@parse{#1}%
+ \if@svg@quotes@found%
+ \edef\filename@base{\filename@base"}%
+ \fi%
+ \fi%
+% \end{macrocode}
+% Quotes within \cs{filename@base} are normalized.
+% \begin{macrocode}
+ \svg@quotes@remove{\filename@base}%
+ \if@svg@quotes@found%
+ \edef\filename@base{"\filename@base"}%
+ \fi%
+% \end{macrocode}
+% With \cs{svg@tempa} the group is closed and the results are saved in the
+% macros \cs{filename@\dots}.
+% \begin{macrocode}
+ \edef\svg@tempa{%
+ \endgroup%
+ \def\noexpand\filename@area{\filename@area}%
+ \def\noexpand\filename@base{\filename@base}%
+ \ifx\filename@ext\relax%
+ \let\noexpand\filename@ext\noexpand\relax%
+ \else%
+ \def\noexpand\filename@ext{\filename@ext}%
+ \fi%
+ }%
+ \svg@tempa%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@filename@parse
+% \begin{macro}{\svg@extension@parse}
+% \changes{v2.02}{2018/09/07}{new}^^A
+% \begin{macro}{\svg@extension@@parse}
+% \changes{v2.02}{2018/09/07}{new}^^A
+% These macros are used to permit multiple dots in file names. The content of
+% \cs{filename@ext} is split at each occurence of \val{.} and the trailing part
+% is compared against the content of the argument of \cs{svg@extension@parse},
+% which is probably \cs{svg@file@ext}. If they are equal, the previous part is
+% appended to \cs{filename@base} and \cs{filename@ext} is set to the content of
+% the first argument.
+% \begin{macrocode}
+\newcommand*\svg@extension@parse[1]{%
+ \IfArgIsEmpty{#1}{}{%
+ \@expandtwoargs\Ifstr%
+ {\detokenize\expandafter{\filename@ext}}{\detokenize\expandafter{#1}}{}{%
+ \begingroup%
+% \end{macrocode}
+% Macro \cs{svg@tempa} is used to temporarily store anything before the
+% searched extension at the end of \cs{filename@ext} and \cs{svg@tempb} is set
+% to the actual searched extension if found.
+% \begin{macrocode}
+ \edef\svg@tempa{%
+ \def\noexpand\svg@tempa{}%
+ \let\noexpand\svg@tempb\relax%
+ \noexpand\svg@extension@@parse%
+ \filename@ext.\noexpand\@nil#1\noexpand\@nil%
+ }%
+ \svg@tempa%
+ \edef\svg@tempa{%
+ \endgroup%
+% \end{macrocode}
+% If the trailing extension was found, \cs{filename@base} and \cs{filename@ext}
+% are adopted.
+% \begin{macrocode}
+ \def\noexpand\filename@base{\filename@base\svg@tempa}%
+ \ifx\svg@tempb\relax%
+ \let\noexpand\filename@ext\relax%
+ \else%
+ \def\noexpand\filename@ext{\svg@tempb}%
+ \fi%
+ }%
+ \svg@tempa%
+ }%
+ }%
+}
+% \end{macrocode}
+% Macro \cs{svg@extension@@parse} is recursively called as long as there are
+% any dots or the searched extension is found.
+% \begin{macrocode}
+\newcommand*\svg@extension@@parse{}
+\def\svg@extension@@parse#1.#2\@nil#3\@nil{%
+ \edef\svg@tempa{\svg@tempa.#1}%
+ \IfArgIsEmpty{#2}{}{%
+ \Ifstr{\detokenize{#2}}{\detokenize{#3.}}{%
+% \end{macrocode}
+% If the trailing extension is found, \cs{svg@tempb} is definied.
+% \begin{macrocode}
+ \edef\svg@tempb{#3}%
+ }{%
+ \svg@extension@@parse#2\@nil#3\@nil%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@extension@@parse
+% \end{macro}^^A \svg@extension@parse
+% \begin{macro}{\svg@iffilenewer}
+% \changes{v2.02d}{2019/10/22}{use \cs{filemoddate} with Xe\LaTeX, see
+% \url{https://github.com/mrpiggi/svg/issues/12}}^^A
+% The macro \cs{svg@iffilenewer} is used to decide, whether the export with
+% \app{Inkscape} is necessary due to an updated SVG~file. This can only be
+% done, if \cs{pdf@filemoddate} or \cs{filemoddate} is definied.
+% \ToDo{\cs{svg@iffilenewer} instead \cs{IfFileExists} to check results}[v2.03]
+% \begin{macrocode}
+\newcommand*\svg@iffilenewer[2]{\@gobbletwo}
+\ifx\pdf@filemoddate\@undefined
+ \ifx\filemoddate\@undefined\else
+ \ifx\strcmp\@undefined\else
+ \renewcommand*\svg@iffilenewer[2]{%
+ \begingroup%
+ \edef\svg@tempa{\filemoddate{#1}}%
+ \edef\svg@tempb{\filemoddate{#2}}%
+ \ifnum\strcmp{\svg@tempa}{\svg@tempb}>\z@\relax%
+ \aftergroup\@firstoftwo%
+ \else%
+ \aftergroup\@secondoftwo%
+ \fi%
+ \endgroup%
+ }%
+ \fi
+ \fi
+\else
+ \ifx\pdf@strcmp\@undefined\else
+ \renewcommand*\svg@iffilenewer[2]{%
+ \begingroup%
+ \edef\svg@tempa{\pdf@filemoddate{#1}}%
+ \edef\svg@tempb{\pdf@filemoddate{#2}}%
+ \ifnum\pdf@strcmp{\svg@tempa}{\svg@tempb}>\z@\relax%
+ \aftergroup\@firstoftwo%
+ \else%
+ \aftergroup\@secondoftwo%
+ \fi%
+ \endgroup%
+ }%
+ \fi
+\fi
+% \end{macrocode}
+% \end{macro}^^A \svg@iffilenewer
+% \begin{macro}{\svg@shell@mkdir}
+% \begin{macro}{\svg@shell@@mkdir}
+% \begin{macro}{\svg@shell@mv}
+% \begin{macro}{\svg@shell@@mv}
+% \begin{macro}{\svg@shell@rm}
+% \begin{macro}{\svg@shell@@rm}
+% Finally, platform dependend macros for creating directories as well as
+% moving and deleting files are provided.
+% \begin{macrocode}
+\newcommand*\svg@shell@mkdir[1]{%
+ \begingroup%
+% \end{macrocode}
+% A directory should only be created, if it isn't the current working directory.
+% \begin{macrocode}
+ \svg@quotes@remove[{#1}]{\svg@tempa}%
+ \@svg@tempswatrue%
+ \Ifstr{\svg@tempa}{}{\@svg@tempswafalse}{%
+ \Ifstr{\svg@tempa}{./}{\@svg@tempswafalse}{%
+ }}%
+ \if@svg@tempswa%
+ \ShellEscape{\svg@shell@@mkdir{\svg@tempa}}%
+ \fi%
+ \endgroup%
+}
+\newcommand*\svg@shell@mv[2]{%
+ \ShellEscape{\svg@shell@@mv\space"#1"\space"#2"}%
+}
+\newcommand*\svg@shell@rm[1]{%
+ \ShellEscape{\svg@shell@@rm\space"#1"}%
+}
+% \end{macrocode}
+% The platform dependent commands for file access.
+% \begin{macrocode}
+\svg@ifwindowsdetected{%
+ \newcommand*\svg@shell@@mkdir[1]{if not exist "#1" mkdir "#1"}%
+ \newcommand*\svg@shell@@mv{move}%
+ \newcommand*\svg@shell@@rm{del}%
+}{%
+ \newcommand*\svg@shell@@mkdir[1]{mkdir -p "#1"}%
+ \newcommand*\svg@shell@@mv{mv}%
+ \newcommand*\svg@shell@@rm{rm}%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@shell@@rm
+% \end{macro}^^A \svg@shell@rm
+% \end{macro}^^A \svg@shell@@mv
+% \end{macro}^^A \svg@shell@mv
+% \end{macro}^^A \svg@shell@@mkdir
+% \end{macro}^^A \svg@shell@mkdir
+% \begin{macro}{\svg@normalize@path}
+% \changes{v2.02}{2018/09/07}{usage of \cs{svg@deactivate@dq}}^^A
+% \begin{macro}{\svg@normalize@@path}
+% If any path is given, a trailing slash is needed. These two macros ensure
+% that this condition is fulfilled in any case, even if this is not considered
+% by the user. As before, a macro containing the path string is passed to
+% \cs{svg@normalize@path}.
+% \begin{macrocode}
+\newcommand*\svg@normalize@path[1]{%
+ \begingroup%
+ \svg@quotes@remove[{#1}]{\svg@tempa}%
+ \ifx\svg@tempa\@empty\relax%
+ \def\svg@tempa{./}%
+ \fi%
+ \expandafter\svg@normalize@@path\svg@tempa//\@nil%
+ \edef\svg@tempb{%
+ \endgroup%
+ \if@svg@quotes@found%
+ \def\noexpand#1{"\svg@tempa"}%
+ \else%
+ \def\noexpand#1{\svg@tempa}%
+ \fi%
+ }%
+ \svg@tempb%
+}
+\newcommand*\svg@normalize@@path{}
+\def\svg@normalize@@path#1/#2/\@nil{%
+ \IfArgIsEmpty{#2}{%
+ \IfArgIsEmpty{#1}{\def\svg@tempa{}}{\def\svg@tempa{#1/}}%
+ }{%
+ \svg@normalize@@path#2/\@nil%
+ \edef\svg@tempa{#1/\svg@tempa}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@normalize@@path
+% \end{macro}^^A \svg@normalize@path
+%
+% \iffalse
+%</main>
+%<*extract>
+% \fi
+%
+%
+%
+% \subsubsection{List handling}
+%
+% \begin{macro}{\svgx@ifinlist}
+% Check, if the first argument is included in a comma-separated list in the
+% second argument. Keep in mind that the first argument is not expanded at all,
+% the second one exactly once.
+% \begin{macrocode}
+\newcommand*\svgx@ifinlist[2]{%
+ \begingroup%
+ \def\svg@tempa##1,#1,##2\@nil{%
+ \IfArgIsEmpty{##2}{%
+ \aftergroup\@secondoftwo%
+ }{%
+ \aftergroup\@firstoftwo%
+ }%
+ }%
+ \expandafter\svg@tempa\expandafter,#2,#1,\@nil%
+ \endgroup%
+}
+% \end{macrocode}
+% \end{macro}^^A \svgx@ifinlist
+%
+% \iffalse
+%</extract>
+%</package&base>
+%<*package&option>
+% \fi
+%
+%
+%
% \section{Including SVG files with package \pkg{svg}}
% \subsection{Options}
%
% All options, which can be set either as package options or with
% \cs{svgsetup}, as well as the optional parameters for both user commands
-% \cs{includesvg}\oarg{parameters}\marg{svg filename} and
-% \cs{includeinkscape}\oarg{parameters}\marg{graphic filename} are defined with
+% \cs{includesvg}\oarg{parameters}\marg{svg~filename} and
+% \cs{includeinkscape}\oarg{parameters}\marg{graphic~filename} are defined with
% the interface provided by package \pkg{scrbase}.
% \begin{macrocode}
\DefineFamily{SVG}
@@ -1371,8 +1919,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \iffalse
%</package&option>
-%<*package&base>
-%<*option>
+%<*package&option&main>
% \fi
%
% \begin{macro}{\svg@deprecated@key}
@@ -1383,7 +1930,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{macrocode}
\newcommand*\svg@deprecated@key[3][svg]{%
\PackageWarning{#1}{%
- The option key `#2' is deprecated.\MessageBreak%
+ The option key `#2' is deprecated. \MessageBreak%
It's recommended to use `#3'\MessageBreak%
instead%
}%
@@ -1394,7 +1941,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% Within the exported \LaTeX~files of \app{Inkscape}, some commands are used
% out of additional packages. But maybe the user doesn't want to load this
-% packages anyways.
+% packages anyhow.
%
% \begin{option}{usexcolor}
% \changes{v2.00}{2017/02/17}{new}^^A
@@ -1435,6 +1982,15 @@ svg-extract -- Extract independent graphic files from SVG pictures
\PackageWarning{svg}{Package `transparent' was loaded anyway}%
}%
\fi%
+% \end{macrocode}
+% There is an issue\footnote{\url{https://github.com/ho-tex/oberdiek/issues/62}}
+% with package \pkg{transparent}, which currently implements an \emph{invalid}
+% check relying on internal commands of package \pkg{pgfsys}, whereas these
+% have changed in the latest version.
+% \begin{macrocode}
+ \AfterPackage*{transparent}{%
+ \@ifpackagelater{transparent}{2018/11/19}{}{\RequirePackage{pgfsys}}%
+ }%
}
% \end{macrocode}
% \end{macro}^^A \if@svg@use@transparent
@@ -1467,12 +2023,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{macrocode}
\newcommand*\svg@ink@mode{}
\DefineFamilyKey{SVG}{inkscape}[true]{%
- \lowercase{\svg@sanitize@dq\svg@tempb{#1}}%
+ \svg@sanitize@dq\svg@tempb{#1}%
\FamilySetNumerical{SVG}{inkscape}{svg@tempa}{%
{false}{0},{off}{0},{no}{0},%
- {true}{1},{on}{1},{yes}{1},{onlynewer}{1},{newer}{1},%
- {force}{2},{forced}{2},{overwrite}{2},%
- {pdf}{3},{eps}{4},{ps}{5},{png}{6},%
+ {true}{1},{on}{1},{yes}{1},{auto}{1},{onlynewer}{1},{newer}{1},%
+ {forced}{2},{force}{2},{overwrite}{2},%
+ {pdf}{3},{PDF}{3},{eps}{4},{EPS}{4},{ps}{5},{PS}{5},{png}{6},{PNG}{6},%
{drawing}{7},{crop}{7},%
{page}{8},{nocrop}{8},%
{tex}{9},{latex}{9},{exportlatex}{9},{latexexport}{9},%
@@ -1520,7 +2076,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% In version~v1.0 the option \opt{inkscape} was used to set both the executable
% and options for \app{Inkscape}. This is taken into account here.
% \begin{macrocode}
- \ifx\FamilyKeyState\FamilyKeyStateProcessed\else%
+ \ifx\FamilyKeyState\FamilyKeyStateProcessed\else% legacy option
% \end{macrocode}
% Splitting executable from options with delimitted macros. After calling
% \cs{svg@tempa} with the given value, the part for the executable is stored in
@@ -1529,7 +2085,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{macrocode}
\svg@quotes@remove[{#1}]{\svg@tempb}%
\def\svg@tempa##1-##2\@nil{%
- \IfArgIsEmpty{##2}{\def\svg@tempb{}}{%
+ \IfArgIsEmpty{##2}{\let\svg@tempb\@empty}{%
\def\svg@tempa####1-\@nil{\def\svg@tempb{-####1}}%
\svg@tempa##2\@nil%
}%
@@ -1591,7 +2147,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{option}{inkscapeopt}
% \changes{v2.00}{2017/02/17}{new}^^A
% \begin{macro}{\svg@ink@opt}
-% With these options, the terminal command for invoking \app{Inkscape} as well
+% With these options, the executed command for invoking \app{Inkscape} as well
% as additional options can be defined.
% \ToDo{rename \cs{svg@ink@ver} > \cs{svg@ink@ver@val} (keep former cs)?}[v2.03]
% \begin{macrocode}
@@ -1660,10 +2216,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
\renewcommand*\svg@ink@format{eps}
\fi\fi
\DefineFamilyKey{SVG}{inkscapeformat}{%
- \lowercase{\def\svg@tempa{#1}}%
\FamilySetNumerical{SVG}{inkscapeformat}{svg@tempa}{%
- {pdf}{0},{eps}{1},{ps}{2},{png}{3}%
- }{\svg@tempa}%
+ {pdf}{0},{PDF}{0},{eps}{1},{EPS}{1},{ps}{2},{PS}{2},{png}{3},{PNG}{3}%
+ }{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed%
\ifcase\svg@tempa\relax% latex
\renewcommand*\svg@ink@format{pdf}%
@@ -1750,7 +2305,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{option}^^A inkscapedpi
% \begin{macro}{\svg@ink@cmd}
% \changes{v2.02f}{2020/05/06}{distinguish \app{Inkscape}~CLI versions}^^A
-% The actual call of the \app{Inkscape} command~line~interface.
+% The actual usage of the \app{Inkscape} command~line~interface.
% \begin{macrocode}
\newcommand*\svg@ink@cmd[2]{%
\svg@ink@exe\space"#1.\svg@file@ext"\space\svg@ink@area\space%
@@ -1821,23 +2376,16 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
%
%
-% \subsubsection{Setting output folder}
+% \subsubsection{Setting output folder and file}
%
% \begin{option}{inkscapepath}
% \changes{v2.00}{2017/02/17}{new}^^A
% \changes{v2.02}{2018/09/07}{usage of \cs{svg@sanitize@dq}}^^A
-% \begin{option}{inkscapename}
-% \changes{v2.00}{2017/02/17}{new}^^A
% \begin{macro}{\svg@out@path}
-% \begin{macro}{\svg@out@name}
-% \begin{macro}{\svg@out@base}
% The option \opt{inkscapepath} controls, in which folder the results of the
-% \app{Inkscape} export will be located. With option \opt{inkscapename} the
-% name of the exported file itself can be changed.
+% \app{Inkscape} export will be located.
% \begin{macrocode}
\newcommand*\svg@out@path{}
-\newcommand*\svg@out@name{\svg@file@name\svg@file@suffix}
-\newcommand*\svg@out@base{\svg@out@path\svg@out@name.\svg@ink@format}
\DefineFamilyKey{SVG}{inkscapepath}{%
\svg@sanitize@dq\svg@tempb{#1}%
\FamilySetNumerical{SVG}{inkscapepath}{svg@tempa}{%
@@ -1862,6 +2410,17 @@ svg-extract -- Extract independent graphic files from SVG pictures
\FamilyKeyStateProcessed%
\fi%
}
+% \end{macrocode}
+% \end{macro}^^A \svg@out@path
+% \end{option}^^A inkscapepath
+% \begin{option}{inkscapename}
+% \changes{v2.00}{2017/02/17}{new}^^A
+% \begin{macro}{\svg@out@name}
+% \begin{macro}{\svg@out@base}
+% With option \opt{inkscapename} the name of the exported file can be changed.
+% \begin{macrocode}
+\newcommand*\svg@out@name{\svg@file@name\svg@file@suffix}
+\newcommand*\svg@out@base{\svg@out@path\svg@out@name.\svg@ink@format}
\DefineFamilyKey{SVG}{inkscapename}{%
\renewcommand*\svg@out@name{#1\svg@file@suffix}%
\FamilyKeyStateProcessed%
@@ -1869,9 +2428,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{macrocode}
% \end{macro}^^A \svg@out@base
% \end{macro}^^A \svg@out@name
-% \end{macro}^^A \svg@out@path
% \end{option}^^A inkscapename
-% \end{option}^^A inkscapepath
%
%
%
@@ -1933,9 +2490,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
\FamilySetBool{SVG}{keepaspectratio}{@svg@tempswa}{#1}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed%
\if@svg@tempswa%
- \FamilyOptions{SVG}{distort=false}%
- \else
- \FamilyOptions{SVG}{distort=true}%
+ \FamilyExecuteOptions[.svg.sty]{SVG}{distort=false}%
+ \else%
+ \FamilyExecuteOptions[.svg.sty]{SVG}{distort=true}%
\fi%
\fi%
}
@@ -2013,7 +2570,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% from the PDF~file.
% \begin{macrocode}
\newcounter{svg@param@lastpage}
-\DefineFamilyKey{SVG}{lastpage}{%
+\DefineFamilyKey{SVG}{lastpage}[true]{%
\FamilySetNumerical{SVG}{lastpage}{svg@tempa}{%
{false}{0},{off}{0},{no}{0},{ignore}{0},%
{true}{1},{on}{1},{yes}{1},{auto}{1}%
@@ -2037,518 +2594,36 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{macrocode}
\newif\if@svg@draft
\FamilyBoolKey{SVG}{draft}{@svg@draft}
-\AtBeginDocument{\if@svg@draft\else\ifGin@draft\@svg@drafttrue\fi\fi}
+\AfterPackage*{graphicx}{\ifGin@draft\@svg@drafttrue\fi}
% \end{macrocode}
% \end{macro}^^A \if@svg@draft
% \end{option}^^A draft
%
+% \iffalse
+%</package&option&main>
+% \fi
%
%
-% \subsection{Handling path information}
%
-% Both packages \pkg{svg} and \pkg{svg-extract} should be able to handle
-% user-defined input and output paths. As there is the possibility for users to
-% provide paths with or without quotes to \LaTeX, this is taken into account.
+% \subsection{User commands}
+% \subsubsection{Optional parameters for user commands}
%
-% \begin{macro}{\svg@deactivate@dq}
-% \changes{v2.02}{2018/09/07}{new}^^A
-% \changes{v2.02a}{2018/10/17}{bug fix for \pkg{polyglossia}}^^A
-% In order to avoid errors concerning file names with package \pkg{babel} and
-% it's active double quotes, this command is defined.
-% \begin{macrocode}
-\newcommand*\svg@deactivate@dq{}
-\AfterPackage+{babel}{%
- \renewcommand*\svg@deactivate@dq{\bbl@deactivate{"}}%
- \providecommand*\bbl@deactivate[1]{}%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@deactivate@dq
-% \begin{macro}{\svg@sanitize@dq}
-% \changes{v2.02}{2018/09/07}{new}^^A
-% Save expansion of the second argument in the macro from teh first argument
-% with deactivated double quotes.
-% \begin{macrocode}
-\newcommand*\svg@sanitize@dq[2]{%
- \begingroup%
- \svg@deactivate@dq%
- \edef\svg@tempa{\endgroup\def\noexpand#1{#2}}%
- \svg@tempa%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@sanitize@dq
-% \begin{macro}{\svg@quotes@remove}
-% \changes{v2.02}{2018/09/07}{usage of \cs{svg@sanitize@dq}}^^A
-% \changes{v2.02}{2018/09/07}{calling \cs{svg@quotes@check}}^^A
-% \begin{macro}{\svg@quotes@@remove}
-% These two commands are used to remove all occurring quotes within a string.
-% The only argument passed to \cs{svg@quotes@remove} is not the string itself
-% but a macro in which a string is stored.
-% \begin{macrocode}
-\newcommand*\svg@quotes@remove[2][]{%
- \begingroup%
- \IfArgIsEmpty{#1}{\def\svg@tempb{#2}}{\def\svg@tempb{#1}}%
- \svg@sanitize@dq\svg@tempa{\svg@tempb}%
- \expandafter\svg@quotes@check\expandafter{\svg@tempa}%
- \expandafter\svg@quotes@@remove\svg@tempa""\@nil%
- \edef\svg@tempb{%
- \endgroup%
- \def\noexpand#2{\svg@tempa}%
- \if@svg@quotes@found%
- \noexpand\@svg@quotes@foundtrue%
- \else%
- \noexpand\@svg@quotes@foundfalse%
- \fi%
- }%
- \svg@tempb%
-}
-\newcommand*\svg@quotes@@remove{}
-\def\svg@quotes@@remove#1"#2"#3\@nil{%
- \IfArgIsEmpty{#2}{%
- \edef\svg@tempa{#1}%
- }{%
- \svg@quotes@@remove#1#2#3""\@nil%
- }%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@quotes@@remove
-% \end{macro}^^A \svg@quotes@remove
-% \begin{macro}{\svg@quotes@check}
-% \begin{macro}{\svg@quotes@@check}
-% \begin{macro}{\if@svg@quotes@found}
-% During the treatment of paths, it may be necessary to temporarily remove
-% quotes and, if required, add them again later. For this purpose, the switch
-% \cs{if@svg@quotes@found} as well as the commands \cs{svg@quotes@check} and
-% \cs{svg@quotes@@check}, which controls the switch, are defined. As before,
-% the string is passed in a macro to \cs{svg@quotes@check}.
-% \begin{macrocode}
-\newif\if@svg@quotes@found
-\newcommand*\svg@quotes@check[1]{%
- \expandafter\svg@quotes@@check#1"\@nil%
-}
-\newcommand*\svg@quotes@@check{}
-\def\svg@quotes@@check#1"#2\@nil{%
- \IfArgIsEmpty{#2}{\@svg@quotes@foundfalse}{\@svg@quotes@foundtrue}%
-}
-% \end{macrocode}
-% \end{macro}^^A \if@svg@quotes@found
-% \end{macro}^^A \svg@quotes@@check
-% \end{macro}^^A \svg@quotes@check
-% \begin{macro}{\svg@remove@leadingchar}
-% \changes{v2.02}{2018/09/07}{new}^^A
-% This command removes the single character in given with the first argument
-% from the expanded macro in the second argument.
-% \begin{macrocode}
-\newcommand*\svg@remove@leadingchar[2]{%
- \begingroup%
- \svg@sanitize@dq\svg@tempa{#2}%
- \def\svg@tempb{%
- \def\svg@tempa####1\@nil{\def\svg@tempa{####1}}%
- \kernel@ifnextchar#1%
- {\expandafter\svg@tempa\@gobble}%
- {\svg@tempa}%
- }%
- \expandafter\svg@tempb\svg@tempa\@nil%
- \edef\svg@tempb{%
- \endgroup%
- \def\noexpand#2{\svg@tempa}%
- }%
- \svg@tempb%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@remove@leadingchar%
-% \begin{macro}{\svg@set@input@path}
-% \changes{v2.01}{2017/11/28}{new}^^A
-% \changes{v2.02}{2018/09/07}{usage of \cs{svg@deactivate@dq}}^^A
-% \begin{macro}{\svg@append@input@path}
-% \changes{v2.01}{2017/11/28}{new}^^A
-% \changes{v2.02}{2018/09/07}{avoid duplicates in \cs{input@path}}^^A
-% In order to import SVG~files from different folders, \cs{svg@set@input@path}
-% evaluates several macros, which are supposed to be used for holding different
-% search folders. Any given path will be handled by \cs{svg@normalize@path}.
-% The optional argument can be used to append an additional search path.
-% \begin{macrocode}
-\newcommand*\svg@set@input@path[1][]{%
- \begingroup%
- \svg@deactivate@dq%
-% \end{macrocode}
-% If a path was already found and stored within \cs{svg@file@path}, it is
-% searched first and wrapped in curly braces. This is necessary for using
-% commands like \cs{input}\marg{tex filename} within SVG~files.
-% \begin{macrocode}
- \ifx\svg@file@path\@empty\else%
- \svg@normalize@path{\svg@file@path}%
- \edef\svg@file@path{{\svg@file@path}}%
- \fi%
-% \end{macrocode}
-% Afterwards, several search paths are appended. If \cs{svgpath} was used, it
-% is searched next. If nothing was found, \cs{graphicspath} is considered if
-% defined followed by a path given in the third argument. If nothing was found
-% yet, the standard \cs{input@path} is searched last.
-% \begin{macrocode}
- \svg@append@input@path{\svg@file@path}{\svg@input@path}%
- \svg@append@input@path{\svg@file@path}{\Ginput@path}%
- \IfArgIsEmpty{#1}{}{\svg@append@input@path{\svg@file@path}{{#1}}}%
- \svg@append@input@path{\svg@file@path}{\input@path}%
-% \end{macrocode}
-% Finally, \cs{input@path} is set.
-% \begin{macrocode}
- \edef\svg@tempa{%
- \endgroup%
- \ifx\svg@file@path\@empty\else%
- \def\noexpand\input@path{\svg@file@path}%
- \fi%
- }%
- \svg@tempa%
-}
-% \end{macrocode}
-% Only, if a certain search path is defined, it is added. The paths given in
-% the first argument are compared to each path in the second argument and only
-% new ones are added.
-% \begin{macrocode}
-\newcommand*\svg@append@input@path[2]{%
- \ifx#2\@undefined\else%
- \edef\svg@tempb{#2}%
- \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=%
- \svg@tempb\do{%
-% \end{macrocode}
-% Passing each new path to \cs{svg@normalize@path}. If a path already exists,
-% switch \cs{if@svg@tempswa} is set to \val{false}.
-% \begin{macrocode}
- \ifx\svg@tempa\@empty\else%
- \@svg@tempswatrue%
- \svg@normalize@path{\svg@tempa}%
- \expandafter\@tfor\expandafter\svg@tempb\expandafter:\expandafter=%
- #1\do{%
- \ifx\svg@tempa\svg@tempb%
- \@svg@tempswafalse%
- \@break@tfor%
- \fi%
- }%
- \if@svg@tempswa%
- \edef#1{#1{\svg@tempa}}%
- \fi%
- \fi%
- }%
- \fi%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@append@input@path
-% \end{macro}^^A \svg@set@input@path
-% \begin{macro}{\svg@normalize@path}
-% \changes{v2.02}{2018/09/07}{usage of \cs{svg@deactivate@dq}}^^A
-% \begin{macro}{\svg@normalize@@path}
-% If any path is given, a trailing slash is needed. These two macros ensure
-% that this condition is fulfilled in any case, even if this is not considered
-% by the user. As before, a macro containing the path string is passed to
-% \cs{svg@normalize@path}.
-% \begin{macrocode}
-\newcommand*\svg@normalize@path[1]{%
- \begingroup%
- \svg@quotes@remove[{#1}]{\svg@tempa}%
- \ifx\svg@tempa\@empty\relax%
- \def\svg@tempa{./}%
- \fi%
- \expandafter\svg@normalize@@path\svg@tempa//\@nil%
- \edef\svg@tempb{%
- \endgroup%
- \if@svg@quotes@found%
- \def\noexpand#1{"\svg@tempa"}%
- \else%
- \def\noexpand#1{\svg@tempa}%
- \fi%
- }%
- \svg@tempb%
-}
-\newcommand*\svg@normalize@@path{}
-\def\svg@normalize@@path#1/#2/\@nil{%
- \IfArgIsEmpty{#2}{%
- \IfArgIsEmpty{#1}{\def\svg@tempa{}}{\def\svg@tempa{#1/}}%
- }{%
- \svg@normalize@@path#2/\@nil%
- \edef\svg@tempa{#1/\svg@tempa}%
- }%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@normalize@@path
-% \end{macro}^^A \svg@normalize@path
-% \begin{macro}{\svg@ifvalueisrelax}
-% For some keys the usage of \val{\cs{relax}} as a value should lead to a
-% special reaction, such as restoring to default behavior or reseting the key.
-% Therefore, \cs{svg@ifvalueisrelax} checks, whether \val{\cs{relax}} was used
-% as value or not.
+% The family member is defined for both \pkg{svg} and \pkg{svg-extract}.
% \begin{macrocode}
-\newcommand*\svg@ifvalueisrelax[1]{%
- \begingroup%
- \def\svg@tempa{#1}%
- \def\svg@tempb{\relax}%
- \ifx\svg@tempa\svg@tempb\relax%
- \aftergroup\@firstoftwo%
- \else%
- \aftergroup\@secondoftwo%
- \fi%
- \endgroup%
-}
+%<*package&body>
+\DefineFamilyMember[.param]{SVG}
+%</package&body>
% \end{macrocode}
-% \end{macro}^^A \svg@ifvalueisrelax
%
% \iffalse
-%</option>
+%<*package&main>
%<*body>
% \fi
%
-% \begin{macro}{\svg@get@path}
-% \changes{v2.01}{2017/11/28}{using \cs{svg@set@input@path}}^^A
-% \changes{v2.01}{2017/11/28}{using \cs{trim@spaces}}^^A
-% \begin{macro}{\if@svg@file@found}
-% \begin{macro}{\svg@file@path}
-% \begin{macro}{\svg@file@name}
-% \begin{macro}{\svg@file@base}
-% \begin{macro}{\svg@file@suffix}
-% The command \cs{svg@get@path} tries to find a given SVG~file. If the
-% searched file wasn't found in the current path, all paths given with
-% \cs{svgpath} are evaluated. If there was no appropriate file again, all paths
-% given by \cs{graphicspath} are examined. In the last step, a given path
-% within the second mandatory argument is browsed. The results for file path
-% and name are stored in \cs{svg@file@path} and \cs{svg@file@name} as well as
-% the compound of both is saved in \cs{svg@file@base}.
-% \begin{macrocode}
-\newif\if@svg@file@found
-\newcommand*\svg@file@path{}
-\newcommand*\svg@file@name{}
-\newcommand*\svg@file@base{}
-\newcommand*\svg@file@suffix{}
-\newcommand*\svg@get@path[3][\svg@file@ext]{%
- \begingroup%
-% \end{macrocode}
-% A maybe given, unneeded file extension is removed.
-% \begin{macrocode}
- \svg@filename@parse[{#1}]{#2}%
- \IfArgIsEmpty{#1}{%
- \edef\svg@tempa{\filename@area\filename@base.\filename@ext}%
- }{%
- \edef\svg@tempa{\filename@area\filename@base.#1}%
- }%
-% \end{macrocode}
-% After calling \cs{svg@set@input@path}, all search paths are stored in
-% \cs{input@path}, a single path given in the third argument will also be
-% considered.
-% \begin{macrocode}
- \svg@set@input@path[{#3}]%
-% \end{macrocode}
-% The specified file is searched with \cs{IfFileExists}. If the file search was
-% succesful, the macro \cs{svg@filename@parse} is called with the result.
-% \begin{macrocode}
- \@svg@tempswafalse%
- \expandafter\IfFileExists\expandafter{\svg@tempa}{%
- \expandafter\svg@quotes@check\expandafter{\svg@tempa}%
- \if@svg@quotes@found\else%
- \svg@quotes@remove{\@filef@und}%
- \fi%
- \@svg@tempswatrue%
- \edef\@filef@und{\expandafter\trim@spaces\expandafter{\@filef@und}}%
- \svg@filename@parse[{#1}]{\@filef@und}%
- }{}%
- \edef\svg@tempa{%
- \endgroup%
- \if@svg@tempswa%
- \noexpand\@svg@file@foundtrue%
- \def\noexpand\svg@file@path{\filename@area}%
- \def\noexpand\svg@file@name{\filename@base}%
- \def\noexpand\svg@file@base{\filename@area\filename@base}%
- \else%
- \noexpand\@svg@file@foundfalse%
- \def\noexpand\svg@file@path{}%
- \def\noexpand\svg@file@name{#2}%
- \def\noexpand\svg@file@base{#2}%
- \fi%
- }%
- \svg@tempa%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@file@suffix
-% \end{macro}^^A \svg@file@base
-% \end{macro}^^A \svg@file@name
-% \end{macro}^^A \svg@file@path
-% \end{macro}^^A \if@svg@file@found
-% \end{macro}^^A \svg@get@path
-% \begin{macro}{\svg@filename@parse}
-% \changes{v2.02}{2018/09/07}{usage of \cs{svg@sanitize@dq}}^^A
-% \changes{v2.02}{2018/09/07}{usage of \cs{svg@remove@leadingchar}}^^A
-% \changes{v2.02}{2018/09/07}{usage of \cs{svg@extension@parse}}^^A
-% As the internal \LaTeXe{} command \cs{filename@parse} is not able to split a
-% given file name containing quotes, \cs{svg@filename@parse} is defined to
-% resolve this problem. The optional argument can be used to give a specific
-% file extension, which should be searched within \cs{filename@ext}. If found
-% at the very end, the previous part is appended to \cs{filename@base}.
-% \begin{macrocode}
-\newcommand*\svg@filename@parse[2][]{%
- \begingroup%
-% \end{macrocode}
-% The given path and file is parsed with \cs{filename@parse}.
-% \begin{macrocode}
- \svg@sanitize@dq\svg@tempa{#2}%
- \expandafter\filename@parse\expandafter{\svg@tempa}%
-% If there are quotes in the file path, the closing one will be found as first
-% character in \cs{filename@base} as \cs{filename@area} is splitted at the last
-% slash. This leading quote is removed from \cs{filename@base} with
-% \cs{svg@remove@leadingchar}.
-% \begin{macrocode}
- \svg@quotes@remove{\filename@area}%
- \if@svg@quotes@found%
- \edef\filename@area{"\filename@area"}%
- \svg@remove@leadingchar"\filename@base%
- \fi%
-% \end{macrocode}
-% The found extension is parsed against the optional argument. If a double quote
-% was found within the extension, it actually belongs to \cs{filename@base}.
-% \begin{macrocode}
- \ifx\filename@ext\relax\else%
- \svg@quotes@remove{\filename@ext}%
- \svg@extension@parse{#1}%
- \if@svg@quotes@found%
- \edef\filename@base{\filename@base"}%
- \fi%
- \fi%
-% \end{macrocode}
-% Quotes within \cs{filename@base} are normalized.
-% \begin{macrocode}
- \svg@quotes@remove{\filename@base}%
- \if@svg@quotes@found%
- \edef\filename@base{"\filename@base"}%
- \fi%
-% \end{macrocode}
-% With \cs{svg@tempa} the group is closed and the results are saved in the
-% macros \cs{filename@\dots}.
-% \begin{macrocode}
- \edef\svg@tempa{%
- \endgroup%
- \def\noexpand\filename@area{\filename@area}%
- \def\noexpand\filename@base{\filename@base}%
- \ifx\filename@ext\relax%
- \let\noexpand\filename@ext\noexpand\relax%
- \else%
- \def\noexpand\filename@ext{\filename@ext}%
- \fi%
- }%
- \svg@tempa%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@filename@parse
-% \begin{macro}{\svg@extension@parse}
-% \changes{v2.02}{2018/09/07}{new}^^A
-% \begin{macro}{\svg@extension@@parse}
-% \changes{v2.02}{2018/09/07}{new}^^A
-% These macros are used to permit multiple dots in file names. The content of
-% \cs{filename@ext} is split at each occurence of \val{.} and the trailing part
-% is compared against the content of the argument of \cs{svg@extension@parse},
-% which is probably \cs{svg@file@ext}. If they are equal, the previous part is
-% appended to \cs{filename@base} and \cs{filename@ext} is set to the content of
-% the first argument.
-% \begin{macrocode}
-\newcommand*\svg@extension@parse[1]{%
- \IfArgIsEmpty{#1}{}{%
- \@expandtwoargs\Ifstr%
- {\detokenize\expandafter{\filename@ext}}{\detokenize\expandafter{#1}}{}{%
- \begingroup%
-% \end{macrocode}
-% Macro \cs{svg@tempa} is used to temporarily store anything before the
-% searched extension at the end of \cs{filename@ext} and \cs{svg@tempb} is set
-% to the actual searched extension if found.
-% \begin{macrocode}
- \edef\svg@tempa{%
- \def\noexpand\svg@tempa{}%
- \let\noexpand\svg@tempb\relax%
- \noexpand\svg@extension@@parse%
- \filename@ext.\noexpand\@nil#1\noexpand\@nil%
- }%
- \svg@tempa%
- \edef\svg@tempa{%
- \endgroup%
-% \end{macrocode}
-% If the trailing extension was found, \cs{filename@base} and \cs{filename@ext}
-% are adopted.
-% \begin{macrocode}
- \def\noexpand\filename@base{\filename@base\svg@tempa}%
- \ifx\svg@tempb\relax%
- \let\noexpand\filename@ext\relax%
- \else%
- \def\noexpand\filename@ext{\svg@tempb}%
- \fi%
- }%
- \svg@tempa%
- }%
- }%
-}
-% \end{macrocode}
-% Macro \cs{svg@extension@@parse} is recursively called as long as there are
-% any dots or the searched extension is found.
-% \begin{macrocode}
-\newcommand*\svg@extension@@parse{}
-\def\svg@extension@@parse#1.#2\@nil#3\@nil{%
- \edef\svg@tempa{\svg@tempa.#1}%
- \IfArgIsEmpty{#2}{}{%
- \Ifstr{\detokenize{#2}}{\detokenize{#3.}}{%
-% \end{macrocode}
-% If the trailing extension is found, \cs{svg@tempb} is definied.
-% \begin{macrocode}
- \edef\svg@tempb{#3}%
- }{%
- \svg@extension@@parse#2\@nil#3\@nil%
- }%
- }%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@extension@@parse
-% \end{macro}^^A \svg@extension@parse
-% \begin{macro}{\svg@iffilenewer}
-% \changes{v2.02d}{2019/10/22}{use \cs{filemoddate} with Xe\LaTeX, see
-% \url{https://github.com/mrpiggi/svg/issues/12}}^^A
-% The macro \cs{svg@iffilenewer} is used to decide, whether the export with
-% \app{Inkscape} is necessary due to an updated SVG~file. This can only be
-% done, if \cs{pdf@filemoddate} or \cs{filemoddate} is definied.
-% \ToDo{\cs{svg@iffilenewer} instead \cs{IfFileExists} to check results}[v2.03]
-% \begin{macrocode}
-\newcommand*\svg@iffilenewer[2]{\@gobbletwo}
-\ifx\pdf@filemoddate\@undefined
- \ifx\filemoddate\@undefined\else
- \ifx\strcmp\@undefined\else
- \renewcommand*\svg@iffilenewer[2]{%
- \begingroup%
- \edef\svg@tempa{\filemoddate{#1}}%
- \edef\svg@tempb{\filemoddate{#2}}%
- \ifnum\strcmp{\svg@tempa}{\svg@tempb}>\z@\relax%
- \aftergroup\@firstoftwo%
- \else%
- \aftergroup\@secondoftwo%
- \fi%
- \endgroup%
- }%
- \fi
- \fi
-\else
- \ifx\pdf@strcmp\@undefined\else
- \renewcommand*\svg@iffilenewer[2]{%
- \begingroup%
- \edef\svg@tempa{\pdf@filemoddate{#1}}%
- \edef\svg@tempb{\pdf@filemoddate{#2}}%
- \ifnum\pdf@strcmp{\svg@tempa}{\svg@tempb}>\z@\relax%
- \aftergroup\@firstoftwo%
- \else%
- \aftergroup\@secondoftwo%
- \fi%
- \endgroup%
- }%
- \fi
-\fi
-% \end{macrocode}
-% \end{macro}^^A \svg@iffilenewer
-%
-% \subsection{Optional Parameters for user commands}
-%
+% \begin{macro}{\svg@local@param@def}
+% \begin{macro}{\svg@local@param@use}
% \begin{macro}{\svg@local@param@set}
% \changes{v2.02}{2018/09/07}{reasonable value for key \opt{distort}}^^A
-% \begin{macro}{\svg@local@param@use}
-% \begin{macro}{\svg@local@param@def}
% Most of the package options can also be used as optional parameters for
% \cs{includesvg} or \cs{includeinkscape}. Some of them are overloaded for the
% usage as optional argument and there are some keys, which \emph{only} can be
@@ -2556,6 +2631,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \cs{svg@local@param@use} is extended with \cs{svg@local@param@def} by the
% definition of local keys during the loading of package \pkg{svg}.
% \begin{macrocode}
+\newcommand*\svg@local@param@use{}
+\newcommand*\svg@local@param@def[1]{%
+ \edef\svg@local@param@use{%
+ \unexpanded\expandafter{\svg@local@param@use}\unexpanded{#1}%
+ }%
+}
\newcommand*\svg@local@param@set[1]{%
\svg@local@param@use%
\FamilyOptions{SVG}{#1}%
@@ -2569,44 +2650,51 @@ svg-extract -- Extract independent graphic files from SVG pictures
% Using \opt{distort=true} is only reasonable, if \opt{height} and \opt{width}
% are given.
% \begin{macrocode}
- \@svg@tempswafalse%
+ \@svg@tempswatrue%
\ifdim\svg@param@width>\z@\relax\ifdim\svg@param@height>\z@\relax%
- \@svg@tempswatrue%
+ \@svg@tempswafalse%
\fi\fi%
- \if@svg@tempswa\else%
- \FamilyOptions{SVG}{distort=false}%
+ \if@svg@tempswa%
+ \FamilyExecuteOptions[.svg.sty]{SVG}{distort=false}%
\fi%
}
-\newcommand*\svg@local@param@use{}
-\newcommand*\svg@local@param@def[1]{%
- \edef\svg@local@param@use{%
- \unexpanded\expandafter{\svg@local@param@use}\unexpanded{#1}%
- }%
-}
% \end{macrocode}
-% \end{macro}^^A \svg@local@param@def
-% \end{macro}^^A \svg@local@param@use
% \end{macro}^^A \svg@local@param@set
-%
-% \iffalse
-%</body>
-%</package&base>
-% \fi
-%
-% The family member is defined for both \pkg{svg} and \pkg{svg-extract}.
+% \end{macro}^^A \svg@local@param@use
+% \end{macro}^^A \svg@local@param@def
+% \begin{macro}{\svg@deprecated@param}
+% This macro checks, if \cs{svgwidth} or \cs{svgscale} are defined. In this
+% case, the given values are passed to the correlating parameters and a warning
+% is raised.
% \begin{macrocode}
-%<*body>
-\DefineFamilyMember[.param]{SVG}
-%</body>
+\newcommand*\svg@deprecated@param{%
+ \@svg@tempswafalse%
+ \ifx\svgwidth\@undefined\else%
+ \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{width=\svgwidth}}%
+ \svg@tempa%
+ \@svg@tempswatrue%
+ \fi%
+ \ifx\svgscale\@undefined\else%
+ \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{scale=\svgscale}}%
+ \svg@tempa%
+ \@svg@tempswatrue%
+ \fi%
+ \if@svg@tempswa%
+ \PackageWarning{svg}{%
+ You should specify the image size with parameters\MessageBreak%
+ `width' and `height' or `scale' instead of using\MessageBreak%
+ `\string\svgscale' or `\string\svgwidth'%
+ }%
+ \let\svgwidth\@undefined%
+ \let\svgscale\@undefined%
+ \fi%
+}
% \end{macrocode}
+% \end{macro}^^A \svg@deprecated@param
%
%
-% \iffalse
-%<*package&base>
-%<*body>
-% \fi
%
-% \subsection{User commands}
+% \subsubsection{Definition of user commands}
%
% \begin{macro}{\svgsetup}
% \changes{v2.00}{2017/02/17}{new}^^A
@@ -2769,6 +2857,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
\newcommand*\svg@param@angle{0}
\svg@local@param@def{%
\DefineFamilyKey[.param]{SVG}{angle}{%
+ \FamilyKeyStateUnknownValue%
\Ifisdimension{#1\p@}{%
\renewcommand*\svg@param@angle{#1}%
\FamilyKeyStateProcessed%
@@ -2917,35 +3006,6 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \subsection{Auxiliary macros}
%
-% \begin{macro}{\svg@deprecated@param}
-% This macro checks, if \cs{svgwidth} or \cs{svgscale} are defined. In this
-% case, the given values are passed to the correlating parameters and a warning
-% is raised.
-% \begin{macrocode}
-\newcommand*\svg@deprecated@param{%
- \@svg@tempswafalse%
- \ifx\svgwidth\@undefined\else%
- \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{width=\svgwidth}}%
- \svg@tempa%
- \@svg@tempswatrue%
- \fi%
- \ifx\svgscale\@undefined\else%
- \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{scale=\svgscale}}%
- \svg@tempa%
- \@svg@tempswatrue%
- \fi%
- \if@svg@tempswa%
- \PackageWarning{svg}{%
- You should specify the image size with parameters\MessageBreak%
- `width' and `height' or `scale' instead of using\MessageBreak%
- `\string\svgscale' or `\string\svgwidth'%
- }%
- \let\svgwidth\@undefined%
- \let\svgscale\@undefined%
- \fi%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@deprecated@param
% \begin{macro}{\svg@ink@run}
% \begin{macro}{\if@svg@ink@run}
% The command, which performs the call of \app{Inkscape} via \cs{ShellEscape}.
@@ -2996,7 +3056,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
\fi%
% \end{macrocode}
% If all checks were positive, the export with \app{Inkscape} can be done in
-% case \file{-{}-shell-escape} is enabled.
+% case flag \file{-{}-shell-escape} is used.
% \begin{macrocode}
\if@svg@ink@run%
\ifnum\pdf@shellescape=\@ne\relax%
@@ -3016,8 +3076,8 @@ svg-extract -- Extract independent graphic files from SVG pictures
\fi%
}%
% \end{macrocode}
-% Executing \app{Inkscape} through the command~line~interface. Afterwards, the
-% export results are moved into the given output path.
+% Executing \app{Inkscape} on shell. Afterwards, the export results are moved
+% into the given output path.
% \begin{macrocode}
\svg@quotes@remove[\svg@file@base]{\svg@tempa}%
\svg@quotes@remove[\svg@out@name]{\svg@tempb}%
@@ -3064,9 +3124,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
\edef\svg@tempb{\svg@tempb.\svg@ink@format}%
\svg@quotes@remove{\svg@out@base}%
\svg@shell@mkdir{\svg@out@path}%
- \svg@shell@move{\svg@tempb}{\svg@out@base}%
+ \svg@shell@mv{\svg@tempb}{\svg@out@base}%
\if@svg@ink@latex%
- \svg@shell@move{\svg@tempb_tex}{\svg@out@base_tex}%
+ \svg@shell@mv{\svg@tempb_tex}{\svg@out@base_tex}%
\fi%
}{%
\gdef\svg@ink@ver{\m@ne}%
@@ -3098,71 +3158,43 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{macro}^^A \svg@ink@run
% \begin{macro}{\svg@input}
% \begin{macro}{\svg@@input}
+% \changes{v2.02g}{2020/06/12}{parsing of file extension discarded; meanwhile
+% taken over by the kernel}^^A
+% \begin{macro}{\svg@box}
% With \cs{svg@@input} the export results of \app{Inkscape} are included. The
% macro \cs{svg@input} is defined in order to realize the option \opt{exclude}
% for package \pkg{svg-extract}. The macro \cs{svg@set@input@path} is called to
% support commands like \cs{input}\marg{tex filename} within SVG~files.
% \begin{macrocode}
+\newsavebox\svg@box
\newcommand*\svg@input{\svg@@input}
\newcommand*\svg@@input[2][]{%
\IfArgIsEmpty{#1}{}{\svg@local@param@set{#1}}%
\svg@set@input@path%
+ \@svg@tempswatrue%
\if@svg@draft%
- \@svg@ink@latexfalse%
+ \@svg@tempswafalse%
\fi%
-% \end{macrocode}
-% In order to support file names with multiple dots, the second argument is
-% parsed and only the part after the last dot is stroed in \cs{svg@tempb} as
-% extension. Everything before is stored in \cs{svg@tempa}.
-% \begin{macrocode}
- \def\svg@tempb##1.##2\@nil{%
- \IfArgIsEmpty{##2}{%
- \def\svg@tempb{##1}%
- }{%
- \edef\svg@tempa{\svg@tempa.##1}%
- \svg@tempb##2\@nil%
- }%
- }%
- \edef\svg@tempa{%
- \def\noexpand\svg@tempa{}%
- \noexpand\svg@tempb#2.\noexpand\@nil%
- }%
- \svg@tempa%
-% \end{macrocode}
-% Afterwards \cs{svg@tempa} is defined with the file name within enclosing
-% braces followed by the extension---only if the file name itself contains any
-% dots--- and \cs{svg@tempb} holds the original file name plus extension
-% without enclosing braces.
-% \begin{macrocode}
- \svg@remove@leadingchar.\svg@tempa%
- \begingroup%
- \expandafter\filename@parse\expandafter{\svg@tempa}%
- \edef\svg@tempa{%
- \endgroup%
- \ifx\filename@ext\relax%
- \edef\noexpand\svg@tempa{\svg@tempa.\svg@tempb}%
- \else%
- \edef\noexpand\svg@tempa{{\svg@tempa}.\svg@tempb}%
- \fi%
- }%
- \svg@tempa%
- \edef\svg@tempb{#2}%
+ \if@svg@ink@latex\else%
+ \@svg@tempswafalse%
+ \fi%
+ \edef\svg@tempa{#2}%
% \end{macrocode}
% If the export with \app{Inkscape} was done with \LaTeX~support enabled, the
% corresponding file will be used together with \cs{input}. The necessary
% patches to environment \env{picture} as well as command \cs{includegraphics}
% are made beforehand with \cs{svg@patches}.
% \begin{macrocode}
- \if@svg@ink@latex%
+ \if@svg@tempswa%
\svg@patches{\svg@tempa}%
\ifnum\value{svg@param@lastpage}=\z@\relax%
- \expandafter\svg@get@lastpage\expandafter{\svg@tempb}%
+ \expandafter\svg@get@lastpage\expandafter{\svg@tempa}%
\fi%
\edef\svg@tempa{%
\ifx\svg@param@pretex\relax\else%
\noexpand\svg@param@pretex%
\fi%
- \noexpand\input{\svg@tempb_tex}%
+ \noexpand\input{\svg@tempa_tex}%
\ifx\svg@param@apptex\relax\else%
\noexpand\svg@param@apptex%
\fi%
@@ -3213,6 +3245,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
\fi%
}
% \end{macrocode}
+% \end{macro}^^A \svg@box
% \end{macro}^^A \svg@@input
% \end{macro}^^A \svg@input
% \begin{macro}{\svg@wrn@scale}
@@ -3448,7 +3481,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \ToDo{Markup for link to issue}[v2.03]
% \begin{macrocode}
\ifx\svg@tempa\@empty%
- \ifwindows%
+ \svg@ifwindowsdetected{%
\def\svg@tempb{\jobname.svg.ink.ver.aux}%
\IfFileExists{\svg@tempb}{}{%
\ShellEscape{call "\svg@ink@exe" -V > \svg@tempb}%
@@ -3457,7 +3490,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
\closein\@inputcheck%
\ShellEscape{del \svg@tempb}%
}%
- \fi%
+ }{}%
\fi%
% \end{macrocode}
% The found version is stored in \cs{svg@tempa} and parsed afterwards.
@@ -3490,6 +3523,161 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
%
%
+% \subsection{Handling path and file names}
+%
+% \begin{macro}{\svg@set@input@path}
+% \changes{v2.01}{2017/11/28}{new}^^A
+% \changes{v2.02}{2018/09/07}{usage of \cs{svg@deactivate@dq}}^^A
+% \begin{macro}{\svg@append@input@path}
+% \changes{v2.01}{2017/11/28}{new}^^A
+% \changes{v2.02}{2018/09/07}{avoid duplicates in \cs{input@path}}^^A
+% In order to import SVG~files from different folders, \cs{svg@set@input@path}
+% evaluates several macros, which are supposed to be used for holding different
+% search folders. Any given path will be handled by \cs{svg@normalize@path}.
+% The optional argument can be used to append an additional search path.
+% \begin{macrocode}
+\newcommand*\svg@set@input@path[1][]{%
+ \begingroup%
+ \svg@deactivate@dq%
+% \end{macrocode}
+% If a path was already found and stored within \cs{svg@file@path}, it is
+% searched first and wrapped in curly braces. This is necessary for using
+% commands like \cs{input}\marg{tex~filename} within SVG~files.
+% \begin{macrocode}
+ \ifx\svg@file@path\@empty\else%
+ \svg@normalize@path{\svg@file@path}%
+ \edef\svg@file@path{{\svg@file@path}}%
+ \fi%
+% \end{macrocode}
+% Afterwards, several search paths are appended. If \cs{svgpath} was used, it
+% is searched next. If nothing was found, \cs{graphicspath} is considered if
+% defined followed by a path given in the third argument. If nothing was found
+% yet, the standard \cs{input@path} is searched last.
+% \begin{macrocode}
+ \svg@append@input@path{\svg@file@path}{\svg@input@path}%
+ \svg@append@input@path{\svg@file@path}{\Ginput@path}%
+ \IfArgIsEmpty{#1}{}{\svg@append@input@path{\svg@file@path}{{#1}}}%
+ \svg@append@input@path{\svg@file@path}{\input@path}%
+% \end{macrocode}
+% Finally, \cs{input@path} is set.
+% \begin{macrocode}
+ \edef\svg@tempa{%
+ \endgroup%
+ \ifx\svg@file@path\@empty\else%
+ \def\noexpand\input@path{\svg@file@path}%
+ \fi%
+ }%
+ \svg@tempa%
+}
+% \end{macrocode}
+% Only, if a certain search path is defined, it is added. The paths given in
+% the first argument are compared to each path in the second argument and only
+% new ones are added.
+% \begin{macrocode}
+\newcommand*\svg@append@input@path[2]{%
+ \ifx#2\@undefined\else%
+ \edef\svg@tempb{#2}%
+ \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=%
+ \svg@tempb\do{%
+% \end{macrocode}
+% Passing each new path to \cs{svg@normalize@path}. If a path already exists,
+% switch \cs{if@svg@tempswa} is set to \val{false}.
+% \begin{macrocode}
+ \ifx\svg@tempa\@empty\else%
+ \@svg@tempswatrue%
+ \svg@normalize@path{\svg@tempa}%
+ \expandafter\@tfor\expandafter\svg@tempb\expandafter:\expandafter=%
+ #1\do{%
+ \ifx\svg@tempa\svg@tempb%
+ \@svg@tempswafalse%
+ \@break@tfor%
+ \fi%
+ }%
+ \if@svg@tempswa%
+ \edef#1{#1{\svg@tempa}}%
+ \fi%
+ \fi%
+ }%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@append@input@path
+% \end{macro}^^A \svg@set@input@path
+% \begin{macro}{\svg@get@path}
+% \changes{v2.01}{2017/11/28}{using \cs{svg@set@input@path}}^^A
+% \changes{v2.01}{2017/11/28}{using \cs{trim@spaces}}^^A
+% \begin{macro}{\if@svg@file@found}
+% \begin{macro}{\svg@file@path}
+% \begin{macro}{\svg@file@name}
+% \begin{macro}{\svg@file@base}
+% \begin{macro}{\svg@file@suffix}
+% The command \cs{svg@get@path} tries to find a given SVG~file. If the
+% searched file wasn't found in the current path, all paths given with
+% \cs{svgpath} are evaluated. If there was no appropriate file again, all paths
+% given by \cs{graphicspath} are examined. In the last step, a given path
+% within the second mandatory argument is browsed. The results for file path
+% and name are stored in \cs{svg@file@path} and \cs{svg@file@name} as well as
+% the compound of both is saved in \cs{svg@file@base}.
+% \begin{macrocode}
+\newif\if@svg@file@found
+\newcommand*\svg@file@path{}
+\newcommand*\svg@file@name{}
+\newcommand*\svg@file@base{}
+\newcommand*\svg@file@suffix{}
+\newcommand*\svg@get@path[3][\svg@file@ext]{%
+ \begingroup%
+ \svg@filename@parse[{#1}]{#2}%
+ \IfArgIsEmpty{#1}{%
+ \edef\svg@tempa{\filename@area\filename@base.\filename@ext}%
+ }{%
+ \edef\svg@tempa{\filename@area\filename@base.#1}%
+ }%
+% \end{macrocode}
+% After calling \cs{svg@set@input@path}, all search paths are stored in
+% \cs{input@path}, a single path given in the third argument will also be
+% considered.
+% \begin{macrocode}
+ \svg@set@input@path[{#3}]%
+% \end{macrocode}
+% The specified file is searched with \cs{IfFileExists}. If the file search was
+% succesful, the macro \cs{svg@filename@parse} is called with the result.
+% \begin{macrocode}
+ \@svg@tempswafalse%
+ \expandafter\IfFileExists\expandafter{\svg@tempa}{%
+ \expandafter\svg@quotes@check\expandafter{\svg@tempa}%
+ \if@svg@quotes@found\else%
+ \svg@quotes@remove{\@filef@und}%
+ \fi%
+ \@svg@tempswatrue%
+ \edef\@filef@und{\expandafter\trim@spaces\expandafter{\@filef@und}}%
+ \svg@filename@parse[{#1}]{\@filef@und}%
+ }{}%
+ \edef\svg@tempa{%
+ \endgroup%
+ \if@svg@tempswa%
+ \noexpand\@svg@file@foundtrue%
+ \def\noexpand\svg@file@path{\filename@area}%
+ \def\noexpand\svg@file@name{\filename@base}%
+ \def\noexpand\svg@file@base{\filename@area\filename@base}%
+ \else%
+ \noexpand\@svg@file@foundfalse%
+ \def\noexpand\svg@file@path{}%
+ \def\noexpand\svg@file@name{#2}%
+ \def\noexpand\svg@file@base{#2}%
+ \fi%
+ }%
+ \svg@tempa%
+}
+% \end{macrocode}
+% \end{macro}^^A \svg@file@suffix
+% \end{macro}^^A \svg@file@base
+% \end{macro}^^A \svg@file@name
+% \end{macro}^^A \svg@file@path
+% \end{macro}^^A \if@svg@file@found
+% \end{macro}^^A \svg@get@path
+%
+%
+%
% \subsection{Patches}
%
% \begin{macro}{\svg@patches}
@@ -3500,7 +3688,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{macro}{\svg@includegraphics@saved}
% For including the export results from \app{Inkscape} with \LaTeX~support
% enabled, there are some patches necessary for environment \env{picture} and
-% \cs{includegraphics}. Those patches are done with \cs{svg@patches}.
+% \cs{includegraphics}. These patches are done with \cs{svg@patches}.
% \begin{macrocode}
\newcommand*\svg@picture@saved{}
\let\svg@picture@saved\picture
@@ -3515,6 +3703,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{macro}^^A \svg@includegraphics@saved
% \end{macro}^^A \svg@picture@saved
% \end{macro}^^A \svg@patches
+% \begin{macro}{\svg@picture@patched}
% \begin{macro}{\svg@pictur@patched}
% In order to provide the possibility specify the desired width of a graphic,
% the appropriate \cs{unitlength} is calculated at the beginning of the
@@ -3559,6 +3748,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
}
% \end{macrocode}
% \end{macro}^^A \svg@pictur@patched
+% \end{macro}^^A \svg@picture@patched
% \begin{macro}{\svg@includegraphics@patched}
% \begin{macro}{\svg@includegraphics@file}
% The patch to \cs{includegraphics} is meant to dissolve the \app{Inkscape} bug
@@ -3606,7 +3796,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \iffalse
%</body>
-%</package&base>
+%</package&main>
%<*package&option>
% \fi
%
@@ -3624,7 +3814,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% for package \pkg{svg} in order to raise a warning message. Primarily this is
% done for compatibility reasons.
% \begin{macrocode}
-%<*base>
+%<*main>
\DefineFamilyMember[.dummy]{SVG}
\newcommand*\svg@dummy@key[2][]{%
\@ifpackageloaded{svg-extract}{}{%
@@ -3654,7 +3844,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
\AfterPackage{svg-extract}{\RelaxFamilyKey[.dummy]{SVG}{#2}}%
}%
}
-%</base>
+%</main>
% \end{macrocode}
% \end{macro}^^A \svg@dummy@key
%
@@ -3668,9 +3858,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
% With option \opt{extract} it can be controlled, if the extraction of
% independent graphic files should be done.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key[true]{extract}
-%</base>
+%</main>
%<*extract>
\newif\if@svgx@run
\DefineFamilyKey{SVG}{extract}[true]{%
@@ -3724,11 +3914,11 @@ svg-extract -- Extract independent graphic files from SVG pictures
% is set to \val{pdf} or, if dvi output could be detected, to \val{eps} during
% initialization.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{extractformat}
\svg@dummy@key[true]{pdf}
\svg@dummy@key[true]{eps}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@format{pdf}
\ifxetex\else\ifpdf\else
@@ -3784,12 +3974,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \LaTeX~file. By default, the preamble of the main document is used, which end
% is detected at \cs{begin}|{document}|.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{extractpreamble}
\svg@dummy@key{preamble}
\svg@dummy@key{extractpreambleend}
\svg@dummy@key{end}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@preamble{\jobname.\svgx@latex@ext}%
\DefineFamilyKey{SVG}{extractpreamble}{%
@@ -3824,9 +4014,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
% With this option, the number of \LaTeX~runs for the separate auxiliary file
% can be set.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{extractruns}
-%</base>
+%</main>
%<*extract>
\newcounter{svgx@runs}
\DefineFamilyKey{SVG}{extractruns}{%
@@ -3858,12 +4048,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
% The command and facultative options for the \LaTeX~call of the separate
% auxiliary file. The default is set according to the currently used engine.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{latexexe}
\svg@dummy@key{pdflatex}
\svg@dummy@key{latexext}
\svg@dummy@key{latexopt}
-%</base>
+%</main>
%<*extract>
\ifxetex
\newcommand*\svgx@latex@exe{xelatex}
@@ -3927,18 +4117,18 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{option}{pdftops}
% \changes{v2.00}{2017/02/24}{deprecated}^^A
% Options and macros for calling convert commands, which are supplied by most
-% \LaTeXe~distributions. These are used to generate all files, which are
+% \LaTeX~distributions. These are used to generate all files, which are
% supported by option \opt{extractformat}, as they don't need an additional
% application.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{dvipsopt}
\svg@dummy@key{pstoepsopt}
\svg@dummy@key{pstopdfopt}
\svg@dummy@key{pdftoepsopt}
\svg@dummy@key{pdftopsopt}
\svg@dummy@key{pdftops}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@dvips@exe{dvips}
\newcommand*\svgx@dvips@opt{}
@@ -3971,8 +4161,8 @@ svg-extract -- Extract independent graphic files from SVG pictures
\FamilyKeyStateProcessed%
}
\DefineFamilyKey{SVG}{pdftops}{%
- \PackageWarning{#1}{%
- The option key `pdftops' is deprecated.\MessageBreak%
+ \PackageWarning{svg-extract}{%
+ The option key `pdftops' is deprecated. \MessageBreak%
You should use either `pdftoepsopt' or\MessageBreak%
`pdftopsopt' instead. See the manual for\MessageBreak%
more. Nothing was done%
@@ -4002,8 +4192,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \subsubsection{Invoking external application for graphic conversion}
%
-% Besides the use of a conversion tool supplied by \LaTeXe, the applications
-% \app{ImageMagick} and \app{Ghostscript} can be used for converting graphics.
+% Besides the use of a conversion tool supplied by the \LaTeX~distribution,
+% the applications \app{ImageMagick} and \app{Ghostscript} can be used for
+% converting graphics.
%
% \begin{option}{convert}
% \changes{v2.00}{2017/02/24}{changed/extended}^^A
@@ -4012,9 +4203,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
% The option \opt{convert} can be used to define, which of both applications
% should be use. \app{ImageMagick} is set by default.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key[true]{convert}
-%</base>
+%</main>
%<*extract>
\newif\if@svgx@cnv@run
\newcommand*\svgx@cnv@cmd{}
@@ -4042,24 +4233,24 @@ svg-extract -- Extract independent graphic files from SVG pictures
\or% gs64
\@svgx@cnv@runtrue%
\renewcommand*\svgx@cnv@cmd{\svgx@gs@cmd}%
- \svgx@onlywindows{%
+ \svg@ifwindowsdetected{%
\renewcommand*\svgx@gs@exe{gswin64c}%
- }%
+ }{}%
\or% gs32
\@svgx@cnv@runtrue%
\renewcommand*\svgx@cnv@cmd{\svgx@gs@cmd}%
- \svgx@onlywindows{%
+ \svg@ifwindowsdetected{%
\renewcommand*\svgx@gs@exe{gswin32c}%
- }%
+ }{}%
\fi%
% \end{macrocode}
% In version~v1.0 the option \opt{convert} was used to set both the executable
% and options for the conversion application, meant for the usage of
% \app{ImageMagick}. This is taken into account here.
% \begin{macrocode}
- \else%
+ \else% legacy option
% \end{macrocode}
-% Same doing like with option \opt{inkscape}.
+% Same doing like with legacy part of option \opt{inkscape}.
% \begin{macrocode}
\def\svg@tempa##1-##2\@nil{%
\IfArgIsEmpty{##2}{\def\svg@tempb{}}{%
@@ -4108,10 +4299,10 @@ svg-extract -- Extract independent graphic files from SVG pictures
% Option \opt{convertformat} controls the output format for converted files. It
% is set to \val{png} by default.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{convertformat}
\svg@dummy@key[true]{png}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@cnv@format{png}
\DefineFamilyKey{SVG}{convertformat}{%
@@ -4143,6 +4334,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \changes{v2.00}{2017/02/24}{new}^^A
% \begin{option}{convertdensity}
% \begin{macro}{\svgx@cnv@dpi}
+% \begin{macro}{\svgx@cnv@get@dpi}
% The option \opt{convertdpi} is meant to define the used density during the
% conversion process. It can be set either for all designated output formats or
% targeted for a specific format. It's also possible to use something like
@@ -4151,10 +4343,10 @@ svg-extract -- Extract independent graphic files from SVG pictures
% the option is used for a specific or for all output formats is recocnized by
% \cs{svgx@ifkeyandval}.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{convertdpi}
\svg@dummy@key{convertdensity}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@cnv@dpi{}
\let\svgx@cnv@dpi\relax
@@ -4175,11 +4367,151 @@ svg-extract -- Extract independent graphic files from SVG pictures
}%
}
\DefineFamilyKey{SVG}{convertdensity}{\FamilyOptions{SVG}{convertdpi=#1}}
+% \end{macrocode}
+% This macro is used to resolve a given value to set the density for the
+% conversion. The delimited macros \cs{svg@tempa} and \cs{svg@tempb} are
+% defined to first crop any given suffix \val{dpi} and second to split two
+% numbers at |x|, if present. Pay attention how both macros are invoked. In the
+% end, a passed value in any of the forms \val{300}, \val{300dpi}, \val{300x400}
+% or \val{300x400dpi} and even \val{300dpix400dpi} is possible. The result is
+% stored in \cs{svg@tempa}.
+% \begin{macrocode}
+\newcommand*\svgx@cnv@get@dpi[1]{%
+ \begingroup%
+ \def\svg@tempa##1dpi##2x##3dpi##4\@nil{%
+ \edef\svg@tempa{##1}%
+% \end{macrocode}
+% Switch \cs{if@svg@tempswa} as \cs{iftrue} means, a valid value was found.
+% \begin{macrocode}
+ \@svg@tempswafalse%
+% \end{macrocode}
+% If only the first argument is a number and third is empty, a single number
+% was given and there's nothing more to do. If the argument is something like
+% \val{300dpix400dpi}, the third argument is the second number.
+% \begin{macrocode}
+ \Ifnumber{##1}{%
+ \IfArgIsEmpty{##3}{\@svg@tempswatrue}{%
+ \Ifnumber{##3}{\edef\svg@tempa{##1x##3}}{}%
+ }%
+ }{}%
+ \if@svg@tempswa\else%
+ \expandafter\svg@tempb\svg@tempa xx\@nil%
+ \fi%
+ }%
+% \end{macrocode}
+% Macro \cs{svg@tempb} splits at |x| and checks, if something valid like
+% \val{300x400} was given. If true, the value is stored in \cs{svg@tempa}.
+% \begin{macrocode}
+ \def\svg@tempb##1x##2x##3\@nil{%
+ \Ifstr{##3}{x}{%
+ \@svg@tempswatrue%
+ \IfArgIsEmpty{##1}{\@svg@tempswafalse}{%
+ \Ifnumber{##1}{}{\@svg@tempswafalse}%
+ }%
+ \IfArgIsEmpty{##2}{\@svg@tempswafalse}{%
+ \Ifnumber{##2}{}{\@svg@tempswafalse}%
+ }%
+ \if@svg@tempswa%
+ \edef\svg@tempa{##1x##2}%
+ \fi%
+ }{}%
+ }%
+ \IfArgIsEmpty{#1}{%
+ \let\svg@tempa\@empty%
+ }{%
+ \lowercase{\svg@tempa#1dpi#1xdpi\@nil}%
+ \if@svg@tempswa\else%
+ \let\svg@tempa\relax%
+ \fi%
+ }%
+ \edef\svg@tempb{%
+ \endgroup%
+ \ifx\svg@tempa\relax%
+ \let\noexpand\svg@tempa\noexpand\relax%
+ \else%
+ \def\noexpand\svg@tempa{\svg@tempa}%
+ \fi%
+ }%
+ \svg@tempb%
+}
%</extract>
% \end{macrocode}
+% \end{macro}^^A \svgx@cnv@get@dpi
% \end{macro}^^A \svgx@cnv@dpi
% \end{option}^^A convertdensity
% \end{option}^^A convertdpi
+%
+% \iffalse
+%<*extract>
+% \fi
+%
+% \begin{macro}{\svgx@setformatkey}
+% \begin{macro}{\svgx@useformatkey}
+% With \cs{svgx@setformatkey} the---maybe output format depend---keys for the
+% conversion tools are set. First argument contains the value given to a key,
+% second the command sequence name of the macro, to whom the value shall be
+% allocated.
+% \begin{macrocode}
+\newcommand*\svgx@setformatkey[2]{%
+% \end{macrocode}
+% A key of the form \val{\meta{key}=\{\meta{format}=\meta{value}\}} is given.
+% The desired output format can be accessed with |##1|, the value with |##2|
+% within the arguments of \cs{svgx@ifkeyandval}.
+% \begin{macrocode}
+ \svgx@ifkeyandval{#1}{%
+ \svg@ifvalueisrelax{##2}{%
+ \expandafter\let\csname #2@##1\endcsname\relax%
+ }{%
+ \@namedef{#2@##1}{##2}%
+ }%
+% \end{macrocode}
+% A key of the form \val{\meta{key}=\{\meta{format}=\meta{value}\}} is given.
+% The value can be used with |##1|.
+% \begin{macrocode}
+ }{%
+ \svg@ifvalueisrelax{##1}{%
+ \expandafter\let\csname #2\endcsname\relax%
+ }{%
+ \@namedef{#2}{##1}%
+ }%
+ }%
+}
+% \end{macrocode}
+% The command \cs{svgx@useformatkey} checks, if a format specific key was
+% definded with \cs{svgx@setformatkey}, whereas the format is given in the
+% second argument. If this is not the case, the setting for all output formats
+% is used. After that, a specific key appended with a |+| can be used to do
+% some additional stuff.
+% \begin{macrocode}
+\newcommand*\svgx@useformatkey[3]{%
+ \scr@ifundefinedorrelax{#1@#2}{%
+ \scr@ifundefinedorrelax{#1}{}{%
+ \expandafter\ifx\csname #1\endcsname\@empty\else%
+ #3\@nameuse{#1}\space%
+ \fi%
+ }%
+ \scr@ifundefinedorrelax{#1@#2+}{}{%
+ \expandafter\ifx\csname #1@#2+\endcsname\@empty\else%
+ #3\@nameuse{#1@#2+}\space%
+ \fi%
+ }%
+ }{%
+% \end{macrocode}
+% If a format specific key was definded, it is used.
+% \begin{macrocode}
+ \expandafter\ifx\csname #1@#2\endcsname\@empty\else%
+ #3\@nameuse{#1@#2}\space%
+ \fi%
+ }%
+}
+% \end{macrocode}
+% \end{macro}^^A \svgx@useformatkey
+% \end{macro}^^A \svgx@setformatkey
+%
+% \iffalse
+%</extract>
+% \fi
+%
% \begin{option}{magickexe}
% \changes{v2.00}{2017/02/24}{new}^^A
% \begin{macro}{\svgx@magick@exe}
@@ -4189,19 +4521,24 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{option}{magickoperator}
% \changes{v2.00}{2017/02/24}{new}^^A
% \begin{macro}{\svgx@magick@opr}
+% \begin{macro}{\svgx@magick@cmd}
% Setting the command including maybe the path to \app{ImageMagick}. The keys
% \opt{magicksetting} and \opt{magickoperator} should be used to add optional
% arguments before (\emph{Settings}) or after (\emph{Operators}) the input
% file. They can either be set for all or a specific output format as like
% option \opt{convertdpi}. For this \cs{svgx@setformatkey} is used.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{magickexe}
\svg@dummy@key{magicksetting}
\svg@dummy@key{magickoperator}
-%</base>
+%</main>
%<*extract>
-\newcommand*\svgx@magick@exe{}
+\svg@ifwindowsdetected{%
+ \newcommand*\svgx@magick@exe{magick}%
+}{%
+ \newcommand*\svgx@magick@exe{convert}%
+}
\DefineFamilyKey{SVG}{magickexe}{%
\renewcommand*\svgx@magick@exe{#1}%
\FamilyKeyStateProcessed%
@@ -4216,8 +4553,17 @@ svg-extract -- Extract independent graphic files from SVG pictures
\svgx@setformatkey{#1}{svgx@magick@opr}%
\FamilyKeyStateProcessed%
}
+\newcommand*\svgx@magick@cmd[3]{%
+ \svgx@magick@exe\space%
+ \svgx@useformatkey{svgx@cnv@dpi}{#3}{-density }%
+ \svgx@useformatkey{svgx@magick@set}{#3}{}%
+ "#1.#2"\space%
+ \svgx@useformatkey{svgx@magick@opr}{#3}{}%
+ "#1.#3"%
+}
%</extract>
% \end{macrocode}
+% \end{macro}^^A \svgx@magick@cmd
% \end{macro}^^A \svgx@magick@opr
% \end{option}^^A magickoperator
% \end{macro}^^A \svgx@magick@set
@@ -4233,19 +4579,24 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{option}{gsdevice}
% \changes{v2.00}{2017/02/24}{new}^^A
% \begin{macro}{\svgx@gs@device}
+% \begin{macro}{\svgx@gs@cmd}
% Options to set the command including maybe the path to \app{Ghostscript}. As
% \app{Ghostscript} needs a specific device defined for different output
% formats, the option \opt{gsdevice} can be used. It can either be set for all
% or a specific output format just like \opt{gsopt} in the same manner like
% option \opt{convertdpi}.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{gsexe}
\svg@dummy@key{gsopt}
\svg@dummy@key{gsdevice}
-%</base>
+%</main>
%<*extract>
-\newcommand*\svgx@gs@exe{}
+\svg@ifwindowsdetected{%
+ \newcommand*\svgx@gs@exe{gswin64c}%
+}{%
+ \newcommand*\svgx@gs@exe{gs}%
+}
\DefineFamilyKey{SVG}{gsexe}{%
\renewcommand*\svgx@gs@exe{#1}%
\FamilyKeyStateProcessed%
@@ -4260,8 +4611,16 @@ svg-extract -- Extract independent graphic files from SVG pictures
\svgx@setformatkey{#1}{svgx@gs@device}%
\FamilyKeyStateProcessed%
}
+\newcommand*\svgx@gs@cmd[3]{%
+ \svgx@gs@exe\space-dSAFER -dBATCH -dNOPAUSE\space%
+ \svgx@useformatkey{svgx@gs@device}{#3}{-sDEVICE=}%
+ \svgx@useformatkey{svgx@cnv@dpi}{#3}{-r}%
+ \svgx@useformatkey{svgx@gs@opt}{#3}{}%
+ -sOutputFile="#1.#3"\space"#1.#2"%
+}
%</extract>
% \end{macrocode}
+% \end{macro}^^A \svgx@gs@cmd
% \end{macro}^^A \svgx@gs@device
% \end{option}^^A gsdevice
% \end{macro}^^A \svgx@gs@opt
@@ -4278,27 +4637,15 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \changes{v2.02}{2018/09/07}{usage of \cs{svg@sanitize@dq}}^^A
% \begin{option}{path}
% \changes{v2.00}{2017/02/24}{deprecated}^^A
-% \begin{option}{extractname}
-% \changes{v2.00}{2017/02/24}{new}^^A
-% \changes{v2.02}{2018/09/07}{usage of \cs{svg@quotes@remove}}^^A
-% \begin{option}{name}
-% \changes{v2.00}{2017/02/24}{deprecated}^^A
-% \changes{v2.00}{2017/02/24}{support of \pkg{subfig} removed}^^A
% \begin{macro}{\svgx@out@path}
-% \begin{macro}{\svgx@out@name}
-% \begin{macro}{\if@svgx@out@sec}
-% \begin{counter}{svgx@out@count}
% The option \opt{extractpath} controls, in which folder the results both of
% the extraction as well as the conversion of \app{ImageMagick} or
-% \app{Ghostscript} will be located. With option \opt{extractname} the
-% name of the extracted and maybe converted file itself can be changed.
+% \app{Ghostscript} will be located.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{extractpath}
\svg@dummy@key{path}
-\svg@dummy@key{extractname}
-\svg@dummy@key{name}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@out@path{}
\DefineFamilyKey{SVG}{extractpath}{%
@@ -4328,9 +4675,33 @@ svg-extract -- Extract independent graphic files from SVG pictures
\DefineFamilyKey{SVG}{path}{%
\svg@deprecated@key[svg-extract]{path=#1}{extractpath=#1}%
}
-\newcounter{svgx@out@count}
+%</extract>
+% \end{macrocode}
+% \end{macro}^^A \svgx@out@path
+% \end{option}^^A path
+% \end{option}^^A extractpath
+% \begin{option}{extractname}
+% \changes{v2.00}{2017/02/24}{new}^^A
+% \changes{v2.02}{2018/09/07}{usage of \cs{svg@quotes@remove}}^^A
+% \begin{option}{name}
+% \changes{v2.00}{2017/02/24}{deprecated}^^A
+% \changes{v2.00}{2017/02/24}{support of \pkg{subfig} removed}^^A
+% \begin{macro}{\svgx@out@name}
+% \begin{macro}{\if@svgx@out@sec}
+% \begin{counter}{svgx@out@count}
+% \begin{macro}{\svgx@out@sec}
+% With option \opt{extractname} the name of the extracted and maybe converted
+% file itself can be changed.
+% \begin{macrocode}
+%<*main>
+\svg@dummy@key{extractname}
+\svg@dummy@key{name}
+%</main>
+%<*extract>
\newcommand*\svgx@out@name{}
\newif\if@svgx@out@sec
+\newcounter{svgx@out@count}
+\newcommand*\svgx@out@sec{unknown}
\DefineFamilyKey{SVG}{extractname}{%
\svg@quotes@remove[{#1}]{\svg@tempb}%
\FamilySetNumerical{SVG}{extractname}{svg@tempa}{%
@@ -4363,14 +4734,12 @@ svg-extract -- Extract independent graphic files from SVG pictures
}
%</extract>
% \end{macrocode}
+% \end{macro}^^A \svgx@out@sec
% \end{counter}^^A svgx@out@count
% \end{macro}^^A \if@svgx@out@sec
% \end{macro}^^A \svgx@out@name
-% \end{macro}^^A \svgx@out@path
% \end{option}^^A name
% \end{option}^^A extractname
-% \end{option}^^A path
-% \end{option}^^A extractpath
%
%
%
@@ -4395,13 +4764,13 @@ svg-extract -- Extract independent graphic files from SVG pictures
% value \val{inherit} means, that the actual option for including is used for
% extraction as well. This is the default setting.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{extractwidth}
\svg@dummy@key{extractheight}
\svg@dummy@key{extractdistort}
\svg@dummy@key{extractkeepaspectratio}
\svg@dummy@key{extractscale}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@param@width{\svg@param@width}
\DefineFamilyKey{SVG}{extractwidth}{%
@@ -4463,7 +4832,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
\ifx\FamilyKeyState\FamilyKeyStateProcessed%
\if@svg@tempswa%
\FamilyOptions{SVG}{extractdistort=false}%
- \else
+ \else%
\FamilyOptions{SVG}{extractdistort=true}%
\fi%
\else%
@@ -4511,11 +4880,11 @@ svg-extract -- Extract independent graphic files from SVG pictures
% The similar hooks for executing code right before or after the graphic
% extraction.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key{extractpretex}
\svg@dummy@key{extractapptex}
\svg@dummy@key{extractpostex}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@param@pretex{\svg@param@pretex}
\DefineFamilyKey{SVG}{extractpretex}{%
@@ -4566,10 +4935,10 @@ svg-extract -- Extract independent graphic files from SVG pictures
% deleted. Setting \val{true} will remove all files, \val{false} won't clear
% any file. Additionally, a specific file list of suffixes can be given.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key[true]{clean}
\svg@dummy@key[true]{clear}
-%</base>
+%</main>
%<*extract>
\newcommand*\svgx@clean{}
\DefineFamilyKey{SVG}{clean}[true]{%
@@ -4585,7 +4954,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
\FamilyKeyStateProcessed%
\fi%
}
-\DefineFamilyKey{SVG}{clear}{\FamilyOptions{SVG}{clean=#1}}
+\DefineFamilyKey{SVG}{clear}[true]{\FamilyOptions{SVG}{clean=#1}}
%</extract>
% \end{macrocode}
% \end{macro}^^A \svgx@clean
@@ -4595,9 +4964,9 @@ svg-extract -- Extract independent graphic files from SVG pictures
% If it is desired not to include but only extract graphics with package
% \pkg{svg-extract}, option \opt{exclude} can be used.
% \begin{macrocode}
-%<*base>
+%<*main>
\svg@dummy@key[true]{exclude}
-%</base>
+%</main>
%<*extract>
\DefineFamilyKey{SVG}{exclude}[true]{%
\FamilySetBool{SVG}{exclude}{@svg@tempswa}{#1}%
@@ -4643,7 +5012,14 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \begin{parameter}{extractpretex}
% \begin{parameter}{extractapptex}
% \begin{parameter}{extractruns}
+% \begin{parameter}{latexexe}
% \begin{parameter}{latexopt}
+% \begin{parameter}{latexext}
+% \begin{parameter}{dvipsopt}
+% \begin{parameter}{pstoepsopt}
+% \begin{parameter}{pstopdfopt}
+% \begin{parameter}{pdftoepsopt}
+% \begin{parameter}{pdftopsopt}
% \begin{parameter}{convert}
% \begin{parameter}{convertformat}
% \begin{parameter}{convertdpi}
@@ -4663,10 +5039,18 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \changes{v2.02}{2018/09/07}{new}^^A
% \begin{parameter}{extractscale}
% \begin{parameter}{extractangle}
+% \changes{v2.02}{2018/09/07}{new}^^A
% \begin{parameter}{extractpretex}
% \begin{parameter}{extractapptex}
% \begin{parameter}{extractruns}
+% \begin{parameter}{latexexe}
% \begin{parameter}{latexopt}
+% \begin{parameter}{latexext}
+% \begin{parameter}{dvipsopt}
+% \begin{parameter}{pstoepsopt}
+% \begin{parameter}{pstopdfopt}
+% \begin{parameter}{pdftoepsopt}
+% \begin{parameter}{pdftopsopt}
% \begin{parameter}{convert}
% \begin{parameter}{convertformat}
% \begin{parameter}{convertdpi}
@@ -4711,7 +5095,14 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{parameter}^^A convertdpi
% \end{parameter}^^A convertformat
% \end{parameter}^^A convert
+% \end{parameter}^^A pdftopsopt
+% \end{parameter}^^A pdftoepsopt
+% \end{parameter}^^A pstopdfopt
+% \end{parameter}^^A pstoepsopt
+% \end{parameter}^^A dvipsopt
+% \end{parameter}^^A latexext
% \end{parameter}^^A latexopt
+% \end{parameter}^^A latexexe
% \end{parameter}^^A extractruns
% \end{parameter}^^A extractapptex
% \end{parameter}^^A extractpretex
@@ -4733,7 +5124,14 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{parameter}^^A convertdpi
% \end{parameter}^^A convertformat
% \end{parameter}^^A convert
+% \end{parameter}^^A pdftopsopt
+% \end{parameter}^^A pdftoepsopt
+% \end{parameter}^^A pstopdfopt
+% \end{parameter}^^A pstoepsopt
+% \end{parameter}^^A dvipsopt
+% \end{parameter}^^A latexext
% \end{parameter}^^A latexopt
+% \end{parameter}^^A latexexe
% \end{parameter}^^A extractruns
% \end{parameter}^^A extractapptex
% \end{parameter}^^A extractpretex
@@ -4752,22 +5150,22 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \changes{v2.00}{2017/02/24}{new}^^A
% Some dummys for package \pkg{svg}.
% \begin{macrocode}
-%<*base>
+%<*main>
\newcommand*\svghidepreamblestart{%
\PackageWarning{svg}{%
The macro `\string\svghidepreamblestart' is only meant\MessageBreak%
- to be used together with package `svg-extract'.\MessageBreak%
+ to be used together with package `svg-extract'. \MessageBreak%
Nevertheless, nothing will happen%
}%
}
\newcommand*\svghidepreambleend{%
\PackageWarning{svg}{%
The macro `\string\svghidepreambleend' is only meant\MessageBreak%
- to be used together with package `svg-extract'.\MessageBreak%
+ to be used together with package `svg-extract'. \MessageBreak%
Nevertheless, nothing will happen%
}%
}
-%</base>
+%</main>
% \end{macrocode}
% These two macros can be used to hide some parts of the preamble during
% reading the preamble of the main document.
@@ -4785,18 +5183,14 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \subsection{Auxiliary macros}
%
% \begin{macro}{\svg@extract}
-% \begin{macro}{\svgx@stream@in}
-% \begin{macro}{\svgx@read@line}
-% \begin{macro}{\svgx@stream@out}
-% \begin{macro}{\if@svgx@preamble@write}
% The macro \cs{svg@extract} does the actual job of both extracting and
% converting independent graphic files. Since it is necessary to run it with
% \file{-{}-shell-escape} enabled, the command raises a warning if it is not
% activated. Afterwards, the package is finished.
% \begin{macrocode}
-%<*base>
+%<*main>
\newcommand*\svg@extract[1]{}
-%</base>
+%</main>
%<*extract>
\ifnum\pdf@shellescape=\@ne\relax\else%
\renewcommand*\svg@extract[1]{%
@@ -4814,15 +5208,37 @@ svg-extract -- Extract independent graphic files from SVG pictures
}%
\expandafter\endinput%
\fi
+%</extract>
% \end{macrocode}
-% If \file{-{}-shell-escape} is enabled, the command is defined with its
-% intended functionality. Some macros and a input stream as well as a output
-% stream are necessary for this.
+% \end{macro}^^A \svg@extract
+%
+% \iffalse
+%</package&body>
+%<*package&body&extract>
+% \fi
+%
+% \begin{macro}{\svgx@stream@in}
+% \begin{macro}{\svgx@read@line}
+% \begin{macro}{\svgx@stream@out}
+% \begin{macro}{\if@svgx@preamble@write}
+% Both an input stream and an output stream are necessary for this as well as a
+% token register, which is used to store all commands which should be executed
+% on shell.
% \begin{macrocode}
\newread\svgx@stream@in
\newcommand*\svgx@read@line{}
\newwrite\svgx@stream@out
\newif\if@svgx@preamble@write
+% \end{macrocode}
+% \end{macro}^^A \if@svgx@preamble@write
+% \end{macro}^^A \svgx@stream@out
+% \end{macro}^^A \svgx@read@line
+% \end{macro}^^A \svgx@stream@in
+% \begin{macro}{\svg@extract}
+% If flag \file{-{}-shell-escape} is enabled, the command is defined with its
+% intended functionality. It runs all necessary processes to extract and
+% convert grahic files.
+% \begin{macrocode}
\renewcommand*\svg@extract[1]{%
% \end{macrocode}
% If option \opt{extract} is enabled\dots
@@ -5263,26 +5679,13 @@ svg-extract -- Extract independent graphic files from SVG pictures
}%
\fi%
}
-%</extract>
% \end{macrocode}
-% \end{macro}^^A \if@svgx@preamble@write
-% \end{macro}^^A \svgx@stream@out
-% \end{macro}^^A \svgx@read@line
-% \end{macro}^^A \svgx@stream@in
% \end{macro}^^A \svg@extract
-%
-% \iffalse
-%</package&body>
-%<*package&extract&body>
-% \fi
-%
% \begin{macro}{\svgx@get@out@sec}
-% \begin{macro}{\svgx@out@sec}
% The macro \cs{svgx@get@out@sec} reads all sectioning counters in order to
% get the numbering of the current sectioning level. The value is stored in
% \cs{svgx@out@sec}.
% \begin{macrocode}
-\newcommand*\svgx@out@sec{unknown}
\newcommand*\svgx@get@out@sec{%
\begingroup%
\def\svg@tempa{}%
@@ -5306,11 +5709,10 @@ svg-extract -- Extract independent graphic files from SVG pictures
\svg@tempb%
}
% \end{macrocode}
-% \end{macro}^^A \svgx@out@sec
% \end{macro}^^A \svgx@get@out@sec
% \begin{macro}{\svgx@documentclass}
% \begin{macro}{\if@svgx@classfound}
-% This delimited macro is used to find a occurrence of \cs{documentclass}
+% This delimited macro is used to find the occurrence of \cs{documentclass}
% within a read in line. The delinmiter \cs{documentclass} is used twice in
% order to ignore the possible occurrence of white space or anything else right
% before \cs{documentclass}.
@@ -5425,53 +5827,13 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{macrocode}
% \end{macro}^^A \svgx@cnv@get@informat
% \end{macro}^^A \svgx@cnv@informat
-% \begin{macro}{\svgx@magick@cmd}
-% \begin{macro}{\svgx@gs@cmd}
-% Depending on option \opt{convert}, one of these two macros is actually used
-% by \cs{svgx@cnv@cmd}. For invoking the conversion process, the required
-% platform-dependent executable is set, if nothing was set by a package option.
-% \begin{macrocode}
-\ifx\svgx@magick@exe\@empty
- \ifwindows
- \renewcommand*\svgx@magick@exe{magick}
- \else
- \renewcommand*\svgx@magick@exe{convert}
- \fi
-\fi
-\newcommand*\svgx@magick@cmd[3]{%
- \svgx@magick@exe\space%
- \svgx@useformatkey{svgx@cnv@dpi}{#3}{-density }%
- \svgx@useformatkey{svgx@magick@set}{#3}{}%
- "#1.#2"\space%
- \svgx@useformatkey{svgx@magick@opr}{#3}{}%
- "#1.#3"%
-}
-% \end{macrocode}
-% \begin{macrocode}
-\ifx\svgx@gs@exe\@empty
- \ifwindows
- \renewcommand*\svgx@gs@exe{gswin64c}
- \else
- \renewcommand*\svgx@gs@exe{gs}
- \fi
-\fi
-\newcommand*\svgx@gs@cmd[3]{%
- \svgx@gs@exe\space-dSAFER -dBATCH -dNOPAUSE\space%
- \svgx@useformatkey{svgx@gs@device}{#3}{-sDEVICE=}%
- \svgx@useformatkey{svgx@cnv@dpi}{#3}{-r}%
- \svgx@useformatkey{svgx@gs@opt}{#3}{}%
- -sOutputFile="#1.#3"\space"#1.#2"%
-}
-% \end{macrocode}
-% \end{macro}^^A \svgx@gs@cmd
-% \end{macro}^^A \svgx@magick@cmd
% \begin{macro}{\svgx@move}
% If the file doesn't exist
% \begin{macrocode}
\newcommand*\svgx@move[3]{%
\begingroup%
\IfFileExists{"#1".#2}{%
- \svg@shell@move{#1.#2}{#3#1.#2}%
+ \svg@shell@mv{#1.#2}{#3#1.#2}%
}{%
\edef\svg@tempa{#2}%
\@svg@tempswafalse%
@@ -5508,177 +5870,10 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{macro}^^A \svgx@move
%
% \iffalse
-%</package&extract&body>
-%<*package&extract&option>
+%</package&body&extract>
+%<*package&standalone&extract>
% \fi
%
-% \begin{macro}{\svgx@ifinlist}
-% Check, if the first argument is included in a comma-separated list in the
-% second argument. Keep in mind that the first argument is not expanded at all,
-% the second one exactly once.
-% \begin{macrocode}
-\newcommand*\svgx@ifinlist[2]{%
- \begingroup%
- \def\svg@tempa##1,#1,##2\@nil{%
- \IfArgIsEmpty{##2}{%
- \aftergroup\@secondoftwo%
- }{%
- \aftergroup\@firstoftwo%
- }%
- }%
- \expandafter\svg@tempa\expandafter,#2,#1,\@nil%
- \endgroup%
-}
-% \end{macrocode}
-% \end{macro}^^A \svgx@ifinlist
-% \begin{macro}{\svgx@onlywindows}
-% Do only some stuff, if Windows was detected.
-% \begin{macrocode}
-\newcommand*\svgx@onlywindows[1]{}
-\AfterPackage*{ifplatform}{\renewcommand*\svgx@onlywindows[1]{\ifwindows#1\fi}}
-% \end{macrocode}
-% \end{macro}^^A \svgx@onlywindows
-% \begin{macro}{\svgx@ifkeyandval}
-% It is checked whether a key was given as \val{\meta{key}=\meta{value}} or
-% like \val{\meta{key}=\{\meta{format}=\meta{value}\}}.
-% \begin{macrocode}
-\newcommand*\svgx@ifkeyandval[3]{%
- \def\svg@tempa##1=##2=##3\@nil{\Ifstr{##3}{=}{#2}{#3}}%
- \svg@tempa#1==\@nil%
-}
-% \end{macrocode}
-% \end{macro}^^A \svgx@ifkeyandval
-% \begin{macro}{\svgx@cnv@get@dpi}
-% This macro is used to resolve a given value to set the density for the
-% conversion. The delimited macros \cs{svg@tempa} and \cs{svg@tempb} are
-% defined to first crop any given suffix \val{dpi} and second to split two
-% numbers at |x|, if present. Pay attention how both macros are invoked. In the
-% end, a passed value in any of the forms \val{300}, \val{300dpi}, \val{300x400}
-% or \val{300x400dpi} and even \val{300dpix400dpi} is possible. The result is
-% stored in \cs{svg@tempa}.
-% \begin{macrocode}
-\newcommand*\svgx@cnv@get@dpi[1]{%
- \begingroup%
- \def\svg@tempa##1dpi##2x##3dpi##4\@nil{%
- \edef\svg@tempa{##1}%
-% \end{macrocode}
-% Switch \cs{if@svg@tempswa} as \cs{iftrue} means, a valid value was found.
-% \begin{macrocode}
- \@svg@tempswafalse%
-% \end{macrocode}
-% If only the first argument is a number and third is empty, a single number
-% was given and there's nothing more to do. If the argument is something like
-% \val{300dpix400dpi}, the third argument is the second number.
-% \begin{macrocode}
- \Ifnumber{##1}{%
- \IfArgIsEmpty{##3}{\@svg@tempswatrue}{%
- \Ifnumber{##3}{\edef\svg@tempa{##1x##3}}{}%
- }%
- }{}%
- \if@svg@tempswa\else%
- \expandafter\svg@tempb\svg@tempa xx\@nil%
- \fi%
- }%
-% \end{macrocode}
-% Macro \cs{svg@tempb} splits at |x| and checks, if something valid like
-% \val{300x400} was given. If true, the value is stored in \cs{svg@tempa}.
-% \begin{macrocode}
- \def\svg@tempb##1x##2x##3\@nil{%
- \Ifstr{##3}{x}{%
- \@svg@tempswatrue%
- \IfArgIsEmpty{##1}{\@svg@tempswafalse}{%
- \Ifnumber{##1}{}{\@svg@tempswafalse}%
- }%
- \IfArgIsEmpty{##2}{\@svg@tempswafalse}{%
- \Ifnumber{##2}{}{\@svg@tempswafalse}%
- }%
- \if@svg@tempswa%
- \edef\svg@tempa{##1x##2}%
- \fi%
- }{}%
- }%
- \IfArgIsEmpty{#1}{%
- \let\svg@tempa\@empty%
- }{%
- \lowercase{\svg@tempa#1dpi#1xdpi\@nil}%
- \if@svg@tempswa\else%
- \let\svg@tempa\relax%
- \fi%
- }%
- \edef\svg@tempb{%
- \endgroup%
- \ifx\svg@tempa\relax%
- \let\noexpand\svg@tempa\noexpand\relax%
- \else%
- \def\noexpand\svg@tempa{\svg@tempa}%
- \fi%
- }%
- \svg@tempb%
-}
-% \end{macrocode}
-% \end{macro}^^A \svgx@cnv@get@dpi
-% \begin{macro}{\svgx@setformatkey}
-% \begin{macro}{\svgx@useformatkey}
-% With \cs{svgx@setformatkey} the---maybe output format depend---keys for the
-% conversion tools are set. First argument contains the value given to a key,
-% second the command sequence name of the macro, to whom the value shall be
-% allocated.
-% \begin{macrocode}
-\newcommand*\svgx@setformatkey[2]{%
-% \end{macrocode}
-% A key of the form \val{\meta{key}=\{\meta{format}=\meta{value}\}} is given.
-% The desired output format can be accessed with |##1|, the value with |##2|
-% within the arguments of \cs{svgx@ifkeyandval}.
-% \begin{macrocode}
- \svgx@ifkeyandval{#1}{%
- \svg@ifvalueisrelax{##2}{%
- \expandafter\let\csname #2@##1\endcsname\relax%
- }{%
- \@namedef{#2@##1}{##2}%
- }%
-% \end{macrocode}
-% A key of the form \val{\meta{key}=\{\meta{format}=\meta{value}\}} is given.
-% The value can be used with |##1|.
-% \begin{macrocode}
- }{%
- \svg@ifvalueisrelax{##1}{%
- \expandafter\let\csname #2\endcsname\relax%
- }{%
- \@namedef{#2}{##1}%
- }%
- }%
-}
-% \end{macrocode}
-% The command \cs{svgx@useformatkey} checks, if a format specific key was
-% definded with \cs{svgx@setformatkey}, whereas the format is given in the
-% second argument. If this is not the case, the setting for all output formats
-% is used. After that, a specific key appended with a |+| can be used to do
-% some additional stuff.
-% \begin{macrocode}
-\newcommand*\svgx@useformatkey[3]{%
- \scr@ifundefinedorrelax{#1@#2}{%
- \scr@ifundefinedorrelax{#1}{}{%
- \expandafter\ifx\csname #1\endcsname\@empty\else%
- #3\@nameuse{#1}\space%
- \fi%
- }%
- \scr@ifundefinedorrelax{#1@#2+}{}{%
- \expandafter\ifx\csname #1@#2+\endcsname\@empty\else%
- #3\@nameuse{#1@#2+}\space%
- \fi%
- }%
- }{%
-% \end{macrocode}
-% If this a format specific key was definded, it is used.
-% \begin{macrocode}
- \expandafter\ifx\csname #1@#2\endcsname\@empty\else%
- #3\@nameuse{#1@#2}\space%
- \fi%
- }%
-}
-% \end{macrocode}
-% \end{macro}^^A \svgx@useformatkey
-% \end{macro}^^A \svgx@setformatkey
%
%
%
@@ -5796,7 +5991,7 @@ svg-extract -- Extract independent graphic files from SVG pictures
% \end{macro}^^A \svgxoutputbox
%
% \iffalse
-%</package&extract&option>
+%</package&standalone&extract>
%<*package&option>
% \fi
%
@@ -5807,13 +6002,13 @@ svg-extract -- Extract independent graphic files from SVG pictures
% Setting the default options and processing the given ones during when loading
% the packages.
% \begin{macrocode}
-%<*base>
+%<*main>
\FamilyExecuteOptions{SVG}{%
- inkscape=true,inkscapeversion=auto,inkscapepath=basesubdir,
+ inkscape=true,inkscapeversion=auto,inkscapepath=basesubdir,%
inkscapelatex=true,inkscapearea=drawing,distort=false,%
usexcolor=true,usetransparent=true%
}
-%</base>
+%</main>
%<*extract>
\FamilyExecuteOptions{SVG}{%
extract=true,extractpath=basesubdir,%
@@ -5829,77 +6024,6 @@ svg-extract -- Extract independent graphic files from SVG pictures
%
% \iffalse
%</package&option>
-%<*package&base&body>
-% \fi
-%
-%
-%
-% \section{Macros for file access}
-%
-% Finally, platform dependend macros for creating directories as well as moving
-% and deleting files are provided, if \file{-{}-shell-escape} is enabled. Only
-% then package \pkg{ifplatform} is only used in order to do not raise a warning.
-% \begin{macrocode}
-\ifnum\pdf@shellescape=\@ne\relax\else%
- \expandafter\endinput%
-\fi
-\RequirePackage{ifplatform}[2017/10/13]
-% \end{macrocode}
-% \begin{macro}{\svg@shell@mkdir}
-% \begin{macro}{\svg@shell@@mkdir}
-% \begin{macro}{\svg@shell@mv}
-% \begin{macro}{\svg@shell@@mv}
-% \begin{macro}{\svg@shell@rm}
-% \begin{macro}{\svg@shell@@rm}
-% The platform dependent commands for file access.
-% \begin{macrocode}
-\ifwindows
- \newcommand*\svg@shell@@mkdir[1]{if not exist "#1" mkdir "#1"}
- \newcommand*\svg@shell@@mv{move}
- \newcommand*\svg@shell@@rm{del}
-\else
- \newcommand*\svg@shell@@mkdir[1]{mkdir -p "#1"}
- \newcommand*\svg@shell@@mv{mv}
- \newcommand*\svg@shell@@rm{rm}
-\fi
-% \end{macrocode}
-% A directory should only be created, if it isn't the current working directory.
-% \begin{macrocode}
-\newcommand*\svg@shell@mkdir[1]{%
- \begingroup%
- \svg@quotes@remove[{#1}]{\svg@tempa}%
- \@svg@tempswatrue%
- \Ifstr{\svg@tempa}{}{\@svg@tempswafalse}{%
- \Ifstr{\svg@tempa}{./}{\@svg@tempswafalse}{%
- }}%
- \if@svg@tempswa%
- \ShellEscape{\svg@shell@@mkdir{\svg@tempa}}%
- \fi%
- \endgroup%
-}
-% \end{macrocode}
-% Commands for moving and deleting files.
-% \begin{macrocode}
-\newcommand*\svg@shell@move[2]{%
- \ShellEscape{\svg@shell@@mv\space"#1"\space"#2"}%
-}
-\newcommand*\svg@shell@rm[1]{%
- \ShellEscape{\svg@shell@@rm\space"#1"}%
-}
-% \end{macrocode}
-% \end{macro}^^A \svg@shell@@rm
-% \end{macro}^^A \svg@shell@rm
-% \end{macro}^^A \svg@shell@@mv
-% \end{macro}^^A \svg@shell@mv
-% \end{macro}^^A \svg@shell@@mkdir
-% \end{macro}^^A \svg@shell@mkdir
-% At the very end, the catcodes are restored.
-% \begin{macrocode}
-\svg@catcodecodes@restore
-% \end{macrocode}
-%
-% \iffalse
-%</package&base&body>
% \fi
%
% \Finale