%% %% This is file `svg.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% svg.dtx (with options: `package,option,base') %% svg.dtx (with options: `package,body,base') %% %% svg -- Include SVG pictures in LaTeX documents using Inkscape %% %% Copyright (C) Philip Ilten , 2012-2016 %% Copyright (C) Falk Hanisch , 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). %% %% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{svg}[% 2017/05/23 v2.00b\space% (include SVG pictures)% ] \RequirePackage{scrbase}[2016/06/14] \RequirePackage{ifxetex}[2010/09/12] \RequirePackage{ifluatex}[2016/05/16] \RequirePackage{ifpdf}[2016/05/14] \RequirePackage{pdftexcmds}[2016/05/21] \RequirePackage{shellesc}[2016/06/07] \RequirePackage{graphicx}[1999/02/16] \DefineFamily{SVG} \DefineFamilyMember{SVG} \newcommand*\svg@deprecated@key[3][svg]{% \PackageWarning{#1}{% The option key `#2' is deprecated.\MessageBreak% It's recommended to use `#3'\MessageBreak% instead% }% \FamilyOptions{SVG}{#3}% } \newcommand*\svg@tempa{} \newcommand*\svg@tempb{} \newif\if@svg@tempswa \newif\if@svg@use@xcolor \FamilyBoolKey{SVG}{usexcolor}{@svg@use@xcolor} \DeclareOption{noxcolor}{\FamilyOptions{SVG}{usexcolor=false}} \newif\if@svg@use@transparent \FamilyBoolKey{SVG}{usetransparent}{@svg@use@transparent} \DeclareOption{notransparent}{\FamilyOptions{SVG}{usetransparent=false}} \AtEndOfPackage{% \RelaxFamilyKey{SVG}{usexcolor}% \RelaxFamilyKey{SVG}{usetransparent}% \if@svg@use@xcolor% \RequirePackage{xcolor}[2016/05/11]% \else% \AfterPackage*{xcolor}{% \PackageWarning{svg}{Package `xcolor' was loaded anyway}% }% \fi% \if@svg@use@transparent% \RequirePackage{transparent}[2016/05/16]% \else% \AfterPackage*{transparent}{% \PackageWarning{svg}{Package `transparent' was loaded anyway}% }% \fi% } \newcommand*\svg@ink@mode{} \DefineFamilyKey{SVG}{inkscape}[true]{% \lowercase{\def\svg@tempa{#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},% {drawing}{7},{crop}{7},% {page}{8},{nocrop}{8},% {tex}{9},{latex}{9},{exportlatex}{9},{latexexport}{9},% {notex}{10},{nolatex}{10},{noexportlatex}{10},{nolatexexport}{10},% {latexnoexport}{10},{raw}{10},{plain}{10},{simple}{10}% }{\svg@tempa}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% \ifnum\svg@tempa<\thr@@\relax% \let\svg@ink@mode\svg@tempa% \else% \ifcase\svg@tempa\relax\or\or\or% pdf \FamilyOptions{SVG}{inkscapeformat=pdf}% \or% eps \FamilyOptions{SVG}{inkscapeformat=eps}% \or% ps \FamilyOptions{SVG}{inkscapeformat=ps}% \or% png \FamilyOptions{SVG}{inkscapeformat=png}% \or% drawing \FamilyOptions{SVG}{inkscapearea=drawing}% \or% page \FamilyOptions{SVG}{inkscapearea=page}% \or% tex \FamilyOptions{SVG}{inkscapelatex=true}% \or% notex \FamilyOptions{SVG}{inkscapelatex=false}% \fi% \fi% \else% dpi \def\svg@tempa##1dpi##2\@nil{% \ifstr{##2}{dpi}{\FamilyOptions{SVG}{inkscapedpi=##1}}{}% }% \lowercase{\svg@tempa#1dpi\@nil}% \ifx\FamilyKeyState\FamilyKeyStateProcessed\else% \def\svg@tempa##1-##2\@nil{% \IfArgIsEmpty{##2}{\def\svg@tempb{}}{% \def\svg@tempa##1####1\@nil{\def\svg@tempb{####1}}% \svg@tempa#1\@nil% }% \def\svg@tempa{##1}% }% \svg@tempa#1-\@nil% \PackageWarning{svg}{% Setting the executable% \ifx\svg@tempb\@empty\else% \space and associated options% \fi% \MessageBreak% for Inkscape should be done with options\MessageBreak% `inkscapeexe=\svg@tempa'% \ifx\svg@tempb\@empty\else% \MessageBreak and `inkscapeopt=\svg@tempb'% \fi.\MessageBreak% Nevertheless, this was done by now anyway% }% \edef\svg@tempa{% \noexpand\FamilyOptions{SVG}{inkscapeexe=\svg@tempa}% \ifx\svg@tempb\@empty\else% \noexpand\FamilyOptions{SVG}{inkscapeopt=\svg@tempb}% \fi% }% \svg@tempa% \fi% \fi% } \DeclareOption{on}{\FamilyOptions{SVG}{inkscape=true}} \DeclareOption{off}{\FamilyOptions{SVG}{inkscape=false}} \newcommand*\svg@ink@format{pdf} \ifxetex\else\ifpdf\else \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}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% \ifcase\svg@tempa\relax% latex \renewcommand*\svg@ink@format{pdf}% \or% eps \renewcommand*\svg@ink@format{eps}% \or% ps \renewcommand*\svg@ink@format{ps}% \or% png \renewcommand*\svg@ink@format{png}% \fi% \fi% } \newif\if@svg@ink@latex \FamilyBoolKey{SVG}{inkscapelatex}{@svg@ink@latex} \FamilyBoolKey{SVG}{latex}{@svg@ink@latex} \FamilyBoolKey{SVG}{tex}{@svg@ink@latex} \newcommand*\svg@ink@area{} \DefineFamilyKey{SVG}{inkscapearea}{% \FamilySetNumerical{SVG}{inkscapearea}{svg@tempa}{% {drawing}{0},{crop}{0},% {page}{1},{nocrop}{1}% }{#1}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% \ifcase\svg@tempa\relax% drawing \renewcommand*\svg@ink@area{-D}% \else% page \renewcommand*\svg@ink@area{-C}% \fi% \fi% } \newcommand*\svg@ink@dpi{} \let\svg@ink@dpi\relax \DefineFamilyKey{SVG}{inkscapedpi}{% \FamilyKeyStateUnknownValue% \svg@ifvalueisrelax{#1}{% \let\svg@ink@dpi\relax% \FamilyKeyStateProcessed% }{% \def\svg@tempa##1dpi##2\@nil{\def\svg@tempa{##1}}% \lowercase{\svg@tempa#1dpi\@nil}% \ifnumber{\svg@tempa}{% \edef\svg@ink@dpi{\svg@tempa}% \FamilyKeyStateProcessed% }{}% }% } \DefineFamilyKey{SVG}{inkscapedensity}{\FamilyOptions{SVG}{inkscapedpi=#1}} \newcommand*\svg@ink@exe{inkscape} \DefineFamilyKey{SVG}{inkscapeexe}{% \renewcommand*\svg@ink@exe{#1}% \FamilyKeyStateProcessed% } \newcommand*\svg@ink@opt{} \DefineFamilyKey{SVG}{inkscapeopt}{% \renewcommand*\svg@ink@opt{#1}% \FamilyKeyStateProcessed% } \DefineFamilyKey{SVG}{svgpath}{% \PackageWarning{svg}{% The key `svgpath' is deprecated. It's recommended\MessageBreak% to use `\string\svgpath' instead% }% \ifx\svgpath\@undefined% \AtEndOfPackage{\svgpath{{#1}}}% \else% \svgpath{{#1}}% \fi% \FamilyKeyStateProcessed% } \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}{% \FamilySetNumerical{SVG}{inkscapepath}{svg@tempa}{% {svgpath}{0},{svgdir}{0},% {svgsubpath}{1},{svgsubdir}{1},% {basepath}{2},{basedir}{2},{jobpath}{2},{jobdir}{2},% {basesubpath}{3},{basesubdir}{3},{jobsubpath}{3},{jobsubdir}{3}% }{#1}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% \ifcase\svg@tempa\relax% svgpath \renewcommand*\svg@out@path{\svg@file@path}% \or% svgsubpath \renewcommand*\svg@out@path{\svg@file@path svg-inkscape/}% \or% basepath \renewcommand*\svg@out@path{./}% \or% basesubpath \renewcommand*\svg@out@path{./svg-inkscape/}% \fi% \else% \renewcommand*\svg@out@path{#1}% \svg@normalize@path{\svg@out@path}% \FamilyKeyStateProcessed% \fi% } \DefineFamilyKey{SVG}{inkscapename}{% \renewcommand*\svg@out@name{#1\svg@file@suffix}% \FamilyKeyStateProcessed% } \newcommand*\svg@param@width{\z@} \DefineFamilyKey{SVG}{width}{% \FamilyKeyStateUnknownValue% \svg@ifvalueisrelax{#1}{% \renewcommand*\svg@param@width{\z@}% \FamilyKeyStateProcessed% }{% \FamilySetLengthMacro{SVG}{width}{\svg@param@width}{#1}% \ifdim\svg@param@width<\z@\relax% \FamilyKeyStateUnknownValue% \fi% }% } \newcommand*\svg@param@height{\z@} \DefineFamilyKey{SVG}{height}{% \FamilyKeyStateUnknownValue% \svg@ifvalueisrelax{#1}{% \renewcommand*\svg@param@height{\z@}% \FamilyKeyStateProcessed% }{% \FamilySetLengthMacro{SVG}{height}{\svg@param@height}{#1}% \ifdim\svg@param@height<\z@\relax% \FamilyKeyStateUnknownValue% \fi% }% } \newcommand*\svg@param@scale{1} \DefineFamilyKey{SVG}{scale}{% \FamilyKeyStateUnknownValue% \svg@ifvalueisrelax{#1}{% \renewcommand*\svg@param@scale{1}% \FamilyKeyStateProcessed% }{% \ifisdimension{#1\p@}{% \ifdim\dimexpr#1\p@\relax>\z@\relax% \renewcommand*\svg@param@scale{#1}% \FamilyKeyStateProcessed% \fi% }{}% }% } \newcommand*\svg@param@pretex{} \let\svg@param@pretex\relax \DefineFamilyKey{SVG}{pretex}{% \svg@ifvalueisrelax{#1}{% \let\svg@param@pretex\relax% }{% \def\svg@param@pretex{#1}% }% \FamilyKeyStateProcessed% } \newcommand*\svg@param@apptex{} \let\svg@param@apptex\relax \DefineFamilyKey{SVG}{apptex}{% \svg@ifvalueisrelax{#1}{% \let\svg@param@apptex\relax% }{% \def\svg@param@apptex{#1}% }% \FamilyKeyStateProcessed% } \DefineFamilyKey{SVG}{postex}{% \svg@deprecated@key{postex=#1}{apptex=#1}% } \newcounter{svg@param@lastpage} \DefineFamilyKey{SVG}{lastpage}{% \FamilySetNumerical{SVG}{lastpage}{svg@tempa}{% {false}{0},{off}{0},{no}{0},{ignore}{0},% {true}{1},{on}{1},{yes}{1},{auto}{1}% }{#1}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% \ifcase\svg@tempa\relax% false \FamilySetCounter{SVG}{lastpage}{svg@param@lastpage}{\m@ne}% \or% true \FamilySetCounter{SVG}{lastpage}{svg@param@lastpage}{\z@}% \fi% \fi% } \newif\if@svg@draft \FamilyBoolKey{SVG}{draft}{@svg@draft} \AtBeginDocument{\if@svg@draft\else\ifGin@draft\@svg@drafttrue\fi\fi} \newcommand*\svg@quotes@remove[1]{% \begingroup% \edef\svg@tempa{#1}% \expandafter\svg@quotes@@remove\svg@tempa""\@nil% \edef\svg@tempb{% \endgroup% \noexpand\def\noexpand#1{\unexpanded\expandafter{\svg@tempa}}% }% \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% }% } \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}% } \newcommand*\svg@normalize@path[1]{% \begingroup% \edef\svg@tempa{#1}% \svg@quotes@check{\svg@tempa}% \svg@quotes@remove{\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% \noexpand\def\noexpand#1{"\unexpanded\expandafter{\svg@tempa}"}% \else% \noexpand\def\noexpand#1{\unexpanded\expandafter{\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/\unexpanded\expandafter{\svg@tempa}}% }% } \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% } \DefineFamilyMember[.dummy]{SVG} \newcommand*\svg@dummy@key[2][]{% \@ifpackageloaded{svg-extract}{}{% \IfArgIsEmpty{#1}{% \DefineFamilyKey[.dummy]{SVG}{#2}{% \PackageWarning{svg}{% The option key `#2' can only\MessageBreak% be used with package `svg-extract', but\MessageBreak% you didn't load it% }% \FamilyKeyStateProcessed% }% }{% \DefineFamilyKey[.dummy]{SVG}{#2}[{#1}]{% \PackageWarning{svg}{% The option key `#2' can only\MessageBreak% be used with package `svg-extract', but\MessageBreak% you didn't load it% }% \FamilyKeyStateProcessed% }% }% \AfterPackage{svg-extract}{\RelaxFamilyKey[.dummy]{SVG}{#2}}% }% } \svg@dummy@key[true]{extract} \svg@dummy@key{extractformat} \svg@dummy@key[true]{pdf} \svg@dummy@key[true]{eps} \svg@dummy@key{extractpreamble} \svg@dummy@key{preamble} \svg@dummy@key{extractpreambleend} \svg@dummy@key{end} \svg@dummy@key{extractruns} \svg@dummy@key{latexexe} \svg@dummy@key{pdflatex} \svg@dummy@key{latexext} \svg@dummy@key{latexopt} \svg@dummy@key{dvipsopt} \svg@dummy@key{pstoepsopt} \svg@dummy@key{pstopdfopt} \svg@dummy@key{pdftoepsopt} \svg@dummy@key{pdftopsopt} \svg@dummy@key{pdftops} \svg@dummy@key[true]{convert} \svg@dummy@key{convertformat} \svg@dummy@key[true]{png} \svg@dummy@key{convertdpi} \svg@dummy@key{convertdensity} \svg@dummy@key{magickexe} \svg@dummy@key{magicksetting} \svg@dummy@key{magickoperator} \svg@dummy@key{gsexe} \svg@dummy@key{gsopt} \svg@dummy@key{gsdevice} \svg@dummy@key{extractpath} \svg@dummy@key{path} \svg@dummy@key{extractname} \svg@dummy@key{name} \svg@dummy@key{extractwidth} \svg@dummy@key{extractheight} \svg@dummy@key{extractscale} \svg@dummy@key{extractpretex} \svg@dummy@key{extractapptex} \svg@dummy@key{extractpostex} \svg@dummy@key[true]{clean} \svg@dummy@key[true]{clear} \svg@dummy@key[true]{exclude} \FamilyExecuteOptions{SVG}{% inkscape=true,inkscapepath=basesubdir,inkscapelatex=true,% inkscapearea=drawing,usexcolor=true,usetransparent=true% } \FamilyProcessOptions{SVG} \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]{% \begingroup% \edef\svg@tempa{#2}% \svg@quotes@check{\svg@tempa}% \svg@quotes@remove{\svg@tempa}% \expandafter\svg@filename@parse\expandafter{\svg@tempa}% \IfArgIsEmpty{#1}{% \edef\svg@tempa{\filename@area\filename@base.\filename@ext}% }{% \edef\svg@tempa{\filename@area\filename@base.#1}% }% \if@svg@quotes@found% \edef\svg@tempa{"\svg@tempa"}% \fi% \@svg@file@foundfalse% \let\input@path\svg@path% \svg@get@@path{\svg@tempa}% \if@svg@file@found\else% \ifx\Ginput@path\@undefined\else% \let\input@path\Ginput@path% \svg@get@@path{\svg@tempa}% \fi% \fi% \IfArgIsEmpty{#3}{}{% \if@svg@file@found\else% \ifx#3\@undefined\else% \edef\svg@tempb{{#3}}% \let\input@path\svg@tempb% \svg@get@@path{\svg@tempa}% \fi% \fi% }% \edef\svg@tempa{% \endgroup% \if@svg@file@found% \noexpand\@svg@file@foundtrue% \noexpand\def\noexpand\svg@file@path{\filename@area}% \noexpand\def\noexpand\svg@file@name{\filename@base}% \noexpand\def\noexpand\svg@file@base{\filename@area\filename@base}% \else% \noexpand\@svg@file@foundfalse% \noexpand\def\noexpand\svg@file@path{}% \noexpand\def\noexpand\svg@file@name{#2}% \noexpand\def\noexpand\svg@file@base{#2}% \fi% }% \svg@tempa% } \newcommand*\svg@get@@path[1]{% \expandafter\IfFileExists\expandafter{#1}{% \@svg@file@foundtrue% \expandafter\svg@filename@parse\expandafter{\@filef@und}% }{}% } \newcommand*\svg@filename@parse[1]{% \begingroup% \def\svg@tempa##1{% \def\svg@tempb####1####2\@nil{% \ifstr{####1}{"}{\def\svg@tempb{####2}}{\def\svg@tempb{####1####2}}% }% \expandafter\svg@tempb##1\@nil% \edef##1{\svg@tempb}% }% \filename@parse{#1}% \ifx\filename@ext\relax\else% \edef\filename@base{\filename@base.\filename@ext}% \fi% \svg@quotes@check{\filename@area}% \if@svg@quotes@found% \svg@quotes@remove{\filename@area}% \edef\filename@area{"\filename@area"}% \svg@tempa{\filename@base}% \fi% \svg@quotes@check{\filename@base}% \if@svg@quotes@found% \svg@quotes@remove{\filename@base}% \fi% \let\svg@tempa\filename@area% \expandafter\filename@parse\expandafter{\filename@base}% \let\filename@area\svg@tempa% \if@svg@quotes@found% \edef\filename@base{"\filename@base"}% \fi% \edef\svg@tempa{% \noexpand\endgroup% \noexpand\def\noexpand\filename@area{\filename@area}% \noexpand\def\noexpand\filename@base{\filename@base}% \ifx\filename@ext\relax% \noexpand\let\noexpand\filename@ext\noexpand\relax% \else% \noexpand\def\noexpand\filename@ext{\filename@ext}% \fi% }% \svg@tempa% } \newcommand*\svg@file@missing[3][]{% \begingroup% \edef\svg@tempa{#2}% \expandafter\svg@filename@parse\expandafter{\svg@tempa}% \svg@quotes@remove{\filename@area}% \svg@quotes@remove{\filename@base}% \ifx\filename@ext\relax\else% \svg@quotes@remove{\filename@ext}% \fi% \IfArgIsEmpty{#1}{% \def\svg@tempa{% Did you run the export with Inkscape? There's no file\MessageBreak% `\filename@area\filename@base.\filename@ext'% }% }{% \edef\filename@ext{#1}% \edef\svg@tempb{#3}% \ifstr{\svg@tempb}{./}{\let\svg@tempb\@empty}{}% \ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% \def\svg@tempa{% There's no file `\filename@base.\filename@ext'\MessageBreak% \ifx\filename@area\@empty% neither in the current directory nor\MessageBreak% any other searched path given by\MessageBreak% \string\svgpath% \ifx\svg@path\@undefined\space\else% \space(\svg@path)\MessageBreak% \fi% or \string\graphicspath% \ifx\Ginput@path\@undefined\else% \space(\Ginput@path)% \fi% \ifx\svg@tempb\@empty\else% \MessageBreak or even `inkscapepath' (`\svg@tempb')% \fi.% \else% in folder `\filename@area'.% \fi% }% }% \PackageError{svg}{% File `\filename@base.\filename@ext' is missing% }{\svg@tempa}% \endgroup% } \ifx\pdf@filemoddate\@undefined \newcommand*\svg@iffilenewer[2]{\@gobbletwo} \else \newcommand*\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 \newcommand*\svg@local@param@set[1]{% \svg@local@param@use% \FamilyOptions{SVG}{#1}% \ifstr{\svg@ink@format}{png}{\FamilyOptions{SVG}{inkscapelatex=false}}{}% } \newcommand*\svg@local@param@use{} \newcommand*\svg@local@param@def[1]{% \edef\svg@local@param@use{% \unexpanded\expandafter{\svg@local@param@use}\unexpanded{#1}% }% } \DefineFamilyMember[.param]{SVG} \newcommand*\svgsetup{\FamilyOptions{SVG}} \newcommand*\setsvg{\FamilyOptions{SVG}} \newcommand*\svg@path{} \let\svg@path\input@path \newcommand*\svgpath[1]{% \def\svg@tempb{}% \@tfor\svg@tempa:=#1\do{% \ifx\svg@tempa\@empty\else% \svg@normalize@path{\svg@tempa}% \edef\svg@tempb{\svg@tempb{\svg@tempa}}% \fi% }% \ifx\svg@tempb\@empty\else% \let\svg@path\svg@tempb% \fi% } \newcommand*{\includesvg}[2][]{% \begingroup% \svg@deprecated@param% \svg@local@param@set{#1}% \if@svg@ink@latex% \def\svg@file@suffix{_svg-tex}% \else% \def\svg@file@suffix{_svg-raw}% \fi% \@onelevel@sanitize\svg@file@suffix% \svg@get@path{#2}{}% \if@svg@file@found% \svg@ink@run% \IfFileExists{\svg@out@base}{}{% \@svg@file@foundfalse% \svg@file@missing{\svg@out@base}{}% }% \if@svg@ink@latex% \IfFileExists{\svg@out@base_tex}{}{% \@svg@file@foundfalse% \svg@file@missing{\svg@out@base_tex}{}% }% \fi% \if@svg@file@found% \svg@input{\svg@out@base}% \svg@extract{\svg@out@base}% \fi% \else% \svg@file@missing[svg]{\svg@file@base}{}% \fi% \endgroup% } \svg@local@param@def{% \FamilyCounterKey[.param]{SVG}{lastpage}{svg@param@lastpage}% } \newcommand*\svg@param@angle{0} \svg@local@param@def{% \DefineFamilyKey[.param]{SVG}{angle}{% \renewcommand*\svg@param@angle{#1}% \FamilyKeyStateProcessed% }% } \newcommand*\svg@param@origin{c} \svg@local@param@def{% \DefineFamilyKey[.param]{SVG}{origin}[c]{% \renewcommand*\svg@param@origin{#1}% \FamilyKeyStateProcessed% }% } \newcommand*{\includeinkscape}[2][]{% \begingroup% \svg@deprecated@param% \filename@parse{#2}% \ifx\filename@ext\relax\else% \svg@quotes@remove{\filename@ext}% \expandafter\lowercase\expandafter{% \expandafter\def\expandafter\filename@ext\expandafter{\filename@ext}% }% \let\svg@tempb\filename@ext% \def\svg@tempa##1_tex##2\@nil{\def\svg@tempb{##1}}% \expandafter\svg@tempa\svg@tempb_tex\@nil% \@for\svg@tempa:={pdf,eps,ps,png}\do{% \ifstr{\svg@tempb}{\svg@tempa}{% \edef\svg@tempa{% \noexpand\FamilyOptions{SVG}{inkscapeformat=\svg@tempb}% }% \svg@tempa% }{}% }% \ifstr{\filename@ext}{\svg@ink@format_tex}{% \FamilyOptions{SVG}{inkscapelatex=true}% }{}% \fi% \svg@local@param@set{#1}% \expandafter\svg@get@path\expandafter[\svg@ink@format]{#2}{\svg@out@path}% \if@svg@file@found% \edef\svg@out@name{\svg@file@name}% \edef\svg@out@base{\svg@file@path\svg@file@name.\svg@ink@format}% \if@svg@ink@latex% \IfFileExists{\svg@out@base_tex}{}{% \@svg@file@foundfalse% \svg@file@missing{\svg@out@base_tex}{}% }% \fi% \if@svg@file@found% \svg@input{\svg@out@base}% \svg@extract{\svg@out@base}% \fi% \else% \svg@file@missing[\svg@ink@format]{\svg@file@base}{\svg@out@path}% \fi% \endgroup% } \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% } \newif\if@svg@ink@run \newcommand*\svg@ink@run{% \ifnum\svg@ink@mode>\z@\relax% \begingroup% \@svg@ink@runtrue% \ifnum\svg@ink@mode=\tw@\relax\else% \svg@iffilenewer{\svg@file@base.svg}{\svg@out@base}{}{% \@svg@ink@runfalse% }% \if@svg@ink@latex% \IfFileExists{\svg@out@base_tex}{% \ifnum\pdf@shellescape=\@ne\relax\if@svg@ink@run% \svg@iffilenewer{\svg@out@base_tex}{\svg@out@base}{% \@svg@ink@runfalse% \edef\svg@tempa{\svg@out@base}% \svg@quotes@remove{\svg@tempa}% \PackageWarning{svg}{% Since the encountered filedate of file\MessageBreak% `\svg@tempa_tex' is newer than \MessageBreak% `\svg@tempa' it's supposed that\MessageBreak% you customized this file. To avoid an accidental\MessageBreak% overwriting of this file, the Inkscape export\MessageBreak% won't be done. If you want to overwrite the\MessageBreak% existing file please choose the parameter\MessageBreak% `inkscape=force'% }% }{}% \fi\fi% }{\@svg@ink@runtrue}% \fi% \fi% \if@svg@ink@run% \ifnum\pdf@shellescape=\@ne\relax% \ifx\svg@ink@dpi\relax% \ifstr{\svg@ink@format}{png}{% \FamilyOptions{SVG}{inkscapedpi=300}% }{}% \fi% \PackageInfo{svg}{% Calling Inkscape% \ifx\svg@ink@opt\@empty\else% \space with added options `\svg@ink@opt'% \fi% }% \edef\svg@tempa{\svg@file@base}% \edef\svg@tempb{\svg@out@name}% \svg@quotes@remove{\svg@tempa}% \svg@quotes@remove{\svg@tempb}% \ShellEscape{\svg@ink@cmd{\svg@tempa}{\svg@tempb}}% \IfFileExists{\svg@out@name.\svg@ink@format}{% \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}% \if@svg@ink@latex% \svg@shell@move{\svg@tempb_tex}{\svg@out@base_tex}% \fi% }{% \PackageWarning{svg}{% The export with Inkscape failed for file\MessageBreak% `\svg@tempa.svg'\MessageBreak% Troubleshooting: Please check in the log file how\MessageBreak% the invocation of Inkscape took place and try to\MessageBreak% execute it yourself in the terminal% }% }% \else% \edef\svg@tempa{\svg@file@base}% \svg@quotes@remove{\svg@tempa}% \PackageWarning{svg}{% You didn't enable `shell escape' (or `write18')\MessageBreak% so it wasn't possible to launch the Inkscape export\MessageBreak% for `\svg@tempa.svg'% }% \fi% \fi% \endgroup% \fi% } \newcommand*\svg@ink@cmd[2]{% \svg@ink@exe\space-z\space\svg@ink@area\space% \ifx\svg@ink@dpi\relax\else--export-dpi=\svg@ink@dpi\space\fi% \if@svg@ink@latex--export-latex\space\fi% \svg@ink@opt\space% --file="#1.svg"\space% --export-\svg@ink@format="#2.\svg@ink@format"\space% } \newcommand*\svg@get@lastpage[1]{% \ifstr{\svg@ink@format}{pdf}{% \begingroup% \@tempcnta=\m@ne\relax% \ifx\XeTeXpdfpagecount\@undefined% \ifpdf% \ifx\pdfximage\@undefined% \ifx\saveimageresource\@undefined\else% \saveimageresource{#1}% \@tempcnta=\lastsavedimageresourcepages\relax% \fi% \else% \pdfximage{#1}% \@tempcnta=\pdflastximagepages\relax% \fi% \fi% \else% \@tempcnta=\XeTeXpdfpagecount#1\relax% \fi% \ifnum\@tempcnta=\m@ne\relax% \PackageWarning{svg}{% It wasn't possible to detect the last page\MessageBreak% of `#1'% }% \else% \PackageInfo{svg}{Last page of `#1' is \the\@tempcnta}% \fi% \edef\svg@tempa{% \noexpand\endgroup% \noexpand\FamilyOptions{SVG}{lastpage=\the\@tempcnta}% }% \svg@tempa% }{}% } \newcommand*\svg@wrn@scale{% \ifdim\dimexpr\svg@param@scale\p@\relax=\p@\relax\else% \@svg@tempswafalse% \ifdim\svg@param@width>\z@\relax% \@svg@tempswatrue% \fi% \ifdim\svg@param@height>\z@\relax% \@svg@tempswatrue% \fi% \if@svg@tempswa% \PackageWarning{svg}{% The parameter `scale' is only considered if neither\MessageBreak% `width' nor `height' are specified% }% \fi% \fi% } \newcommand*\svg@input{\svg@@input} \newcommand*\svg@@input[2][]{% \IfArgIsEmpty{#1}{}{\svg@local@param@set{#1}}% \if@svg@draft% \@svg@ink@latexfalse% \fi% \edef\svg@tempa{#2}% \if@svg@ink@latex% \svg@patches{\svg@tempa}% \ifnum\value{svg@param@lastpage}=\z@\relax% \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@tempa_tex}% \ifx\svg@param@apptex\relax\else% \noexpand\svg@param@apptex% \fi% }% \ifdim\dimexpr\svg@param@angle\p@\relax=\z@\relax% \svg@tempa% \else% \edef\svg@tempb{origin=\svg@param@origin}% \expandafter\rotatebox\expandafter[\svg@tempb]{\svg@param@angle}{% \svg@tempa% }% \fi% \else% \svg@wrn@scale% \edef\svg@tempb{keepaspectratio,scale=\svg@param@scale}% \ifdim\svg@param@height>\z@\relax% \edef\svg@tempb{\svg@tempb,height=\svg@param@height}% \fi% \ifdim\svg@param@width>\z@\relax% \edef\svg@tempb{\svg@tempb,width=\svg@param@width}% \fi% \ifdim\dimexpr\svg@param@angle\p@\relax=\z@\relax\else% \edef\svg@tempb{% \svg@tempb,origin=\svg@param@origin,angle=\svg@param@angle% }% \fi% \if@svg@draft% \edef\svg@tempb{\svg@tempb,draft}% \else% \edef\svg@tempb{\svg@tempb,draft=false}% \fi% \expandafter\includegraphics\expandafter[\svg@tempb]{\svg@tempa}% \fi% } \newcommand*\svg@patches[1]{% \let\svg@picture@saved\picture% \let\picture\svg@picture@patched% \let\svg@includegraphics@saved\includegraphics% \let\includegraphics\svg@includegraphics@patched% \edef\svg@includegraphics@file{#1}% } \newcommand*\svg@picture@saved{} \newcommand*\svg@picture@patched{} \newcommand*\svg@pictur@patched{} \long\def\svg@picture@patched#1{\svg@pictur@patched@#1} \def\svg@pictur@patched@(#1,#2){% \svg@wrn@scale% \ifdim\svg@param@height>\z@\relax% \Gscale@div\svg@tempa{#1\p@}{#2\p@}% \setlength\unitlength{\svg@param@height}% \setlength\unitlength{\svg@tempa\unitlength}% \ifdim\svg@param@width>\z@\relax% \ifdim\unitlength>\svg@param@width\relax% \setlength\unitlength{\svg@param@width}% \fi% \fi% \else% \ifdim\svg@param@width>\z@\relax% \setlength\unitlength{\svg@param@width}% \else% \setlength\unitlength{\svg@param@scale\unitlength}% \fi% \fi% \svg@picture@saved(#1,#2)% } \DefineFamily{SVGpatch} \DefineFamilyMember{SVGpatch} \newcounter{svg@param@currpage} \setcounter{svg@param@currpage}{\m@ne} \FamilyCounterKey{SVGpatch}{page}{svg@param@currpage} \DefineFamilyKey{SVGpatch}{width}{\FamilyKeyStateProcessed} \newcommand*\svg@includegraphics@file{} \newcommand*\svg@includegraphics@saved{} \newcommand*\svg@includegraphics@patched[2][]{% \FamilyOptions{SVGpatch}{#1}% \ifnum\value{svg@param@lastpage}<\z@\relax% \FamilySetCounter{SVGpatch}{page}{svg@param@currpage}{% \the\value{svg@param@lastpage}% }% \fi% \ifnum\value{svg@param@currpage}>\value{svg@param@lastpage}\relax\else% \svg@includegraphics@saved[{#1}]{\svg@includegraphics@file}% \fi% } \newcommand*\svghidepreamblestart{% \PackageWarning{svg}{% The macro `\string\svghidepreamblestart' is only meant\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% Nevertheless, nothing will happen% }% } \newcommand*\svg@extract[1]{} \ifnum\pdf@shellescape=\@ne\relax\else% \expandafter\endinput% \fi \RequirePackage{ifplatform}[2010/10/22] \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 \newcommand*\svg@shell@mkdir[1]{% \begingroup% \edef\svg@tempa{#1}% \svg@quotes@remove{\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@move[2]{% \ShellEscape{\svg@shell@@mv\space"#1"\space"#2"}% } \newcommand*\svg@shell@rm[1]{% \ShellEscape{\svg@shell@@rm\space"#1"}% } \endinput %% %% End of file `svg.sty'.