From cd3505f88f11b375a6fcc7b4d112edc9db836914 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 29 Nov 2017 22:07:30 +0000 Subject: svg (29nov17) git-svn-id: svn://tug.org/texlive/trunk@45941 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/svg/README.md | 8 +- Master/texmf-dist/doc/latex/svg/svg-example.svg | 147 ++++++------ Master/texmf-dist/doc/latex/svg/svg.pdf | Bin 967462 -> 953193 bytes Master/texmf-dist/source/latex/svg/svg.dtx | 287 ++++++++++++++++-------- Master/texmf-dist/tex/latex/svg/svg-extract.sty | 8 +- Master/texmf-dist/tex/latex/svg/svg.sty | 149 ++++++------ 6 files changed, 369 insertions(+), 230 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/svg/README.md b/Master/texmf-dist/doc/latex/svg/README.md index af334225cd8..f438bca1b10 100644 --- a/Master/texmf-dist/doc/latex/svg/README.md +++ b/Master/texmf-dist/doc/latex/svg/README.md @@ -5,7 +5,7 @@ Copyright (C) Philip Ilten , 2012-2016 Copyright (C) Falk Hanisch , 2017- - svg 2017/05/23 v2.00b + svg 2017/11/29 v2.01 ---------------------------------------------------------------------------- @@ -34,6 +34,12 @@ it is rendered within the LaTeX document using either ***ImageMagick*** or Versions -------- +**v2.01** (2017/11/29) ++ new option `svgextension` to change the format of files exported by + ***Inkscape*** from `svg` to a custom one ++ usage of `\input{tex filename}` within ***Inkscape*** graphics + locates files in all declared searched folders + **v2.00b** (2017/05/23) + improved warnings, if package **svg** is loaded by package **svg-extract** diff --git a/Master/texmf-dist/doc/latex/svg/svg-example.svg b/Master/texmf-dist/doc/latex/svg/svg-example.svg index 1a044b86f7e..408a81d636e 100644 --- a/Master/texmf-dist/doc/latex/svg/svg-example.svg +++ b/Master/texmf-dist/doc/latex/svg/svg-example.svg @@ -13,7 +13,7 @@ height="1052.3622047" id="svg2" version="1.1" - inkscape:version="0.91 r13725" + inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" sodipodi:docname="svg-example.svg"> @@ -60,18 +60,18 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="3.0835719" - inkscape:cx="476.83032" - inkscape:cy="630.19665" + inkscape:zoom="4.4663395" + inkscape:cx="336.88588" + inkscape:cy="726.16663" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:snap-bbox="true" showguides="true" inkscape:guide-bbox="true" - inkscape:window-width="1600" - inkscape:window-height="838" - inkscape:window-x="-8" + inkscape:window-width="1920" + inkscape:window-height="1138" + inkscape:window-x="1592" inkscape:window-y="-8" inkscape:window-maximized="1" inkscape:object-paths="true" @@ -80,15 +80,18 @@ + id="guide2945" + inkscape:locked="false" /> + id="guide2947" + inkscape:locked="false" /> + id="guide2951" + inkscape:locked="false" /> @@ -134,37 +137,40 @@ id="text2919" y="-241.42493" x="366.52673" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:black;stroke:none;font-family:Times New Roman;-inkscape-font-specification:'Times New Roman,'" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:0%;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman,';fill:#000000;stroke:none" xml:space="preserve" - transform="matrix(0.5,0.8660254,-0.8660254,0.5,0,0)">InkInkscape red + y="374.1954" + style="line-height:1.25">red 45 graden + y="426.89032" + style="font-size:12px;line-height:1.25">45 graden $\lim_{n \to \infty}\sum_{k=1}^n \frac{1}{k^2}$ + y="252.77005" + style="font-size:6.09581709px;line-height:1.25">$\lim_{n \to \infty}\sum_{k=1}^n \frac{1}{k^2}$ I am figure \ref{fig:example-tex} + y="229.59294" + style="line-height:1.25">I am figure \ref{fig:example-tex} ooo + y="285.06882" + style="font-size:12px;line-height:0">ooo \tiny Flowed text also works. This is a test text to see that it does work.But, only for rectangular flow shapes. blue + style="font-size:19.38392448px;line-height:0;stroke-width:1.21140051">blue green + sodipodi:role="line" + style="font-size:12px;line-height:0">green aligned on baseline + y="400.95963" + style="font-size:9.62269783px;line-height:1">aligned on baseline @@ -275,81 +285,88 @@ x="146.40045" y="281.01093" /> 90 degrees + sodipodi:role="line" + style="font-size:12px;line-height:1.25">90 degrees 90 degrees + y="181.70923" + style="font-size:12px;line-height:1.25">90 degrees ooo + sodipodi:role="line" + style="font-size:12px;line-height:0">ooo ooo + sodipodi:role="line" + style="font-size:12px;line-height:0">ooo $x$ + y="271.55551" + style="font-size:12px;line-height:0">$x$ $y$ + y="277.02844" + style="font-size:12px;line-height:0">$y$ $z$ + y="283.86963" + style="font-size:12px;line-height:0">$z$ TikZ this$\rightarrow$ + y="61.904903" + style="font-size:5.83658981px;line-height:0">TikZ this$\rightarrow$ transparent - + y="345.14746" + style="font-size:12px;line-height:0">transparent + id="flowPara3401" + style="font-size:40px;line-height:1.25">  diff --git a/Master/texmf-dist/doc/latex/svg/svg.pdf b/Master/texmf-dist/doc/latex/svg/svg.pdf index d60ae8fcbe0..828ea4fbcda 100644 Binary files a/Master/texmf-dist/doc/latex/svg/svg.pdf and b/Master/texmf-dist/doc/latex/svg/svg.pdf differ diff --git a/Master/texmf-dist/source/latex/svg/svg.dtx b/Master/texmf-dist/source/latex/svg/svg.dtx index 7577c0e84a0..46e17750e28 100644 --- a/Master/texmf-dist/source/latex/svg/svg.dtx +++ b/Master/texmf-dist/source/latex/svg/svg.dtx @@ -1,4 +1,4 @@ -% \CheckSum{3465} +% \CheckSum{3514} % \iffalse meta-comment % % svg and svg-extract -- Include and extract SVG pictures in LaTeX documents @@ -44,9 +44,9 @@ 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). +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 @@ -115,7 +115,7 @@ svg-extract -- Extract independent graphic files from SVG pictures %\ProvidesPackage{svg}[% %\ProvidesPackage{svg-extract}[% %<*driver|package&option> - 2017/05/23 v2.00b\space% + 2017/11/29 v2.01\space% % (include SVG pictures)% % (extract independent graphics from SVG pictures)% ] @@ -229,7 +229,15 @@ svg-extract -- Extract independent graphic files from SVG pictures % 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.% +% for all variants of subfigures, so it's neglected% +% }^^A +% \changes{v2.01}{2017/11/27}{% +% new option \opt{svgextension} to change the 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 +% locates files in all declared searched folders % }^^A % % @@ -473,6 +481,15 @@ svg-extract -- Extract independent graphic files from SVG pictures % command line tool. For further information see the documentation of % \hrfn{https://inkscape.org/de/doc/inkscape-man.html}{\app{Inkscape}}. % +% \DescribeOption{svgextension} +% 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}§ +% \end{svgexample} +% % % % \subsection{Options for the graphic inclusion} @@ -495,7 +512,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % graphic~file and \opt{apptex} right afterwards. For example, to change the % size of the included text one could use: % \begin{svgexample} -% \includsvg[pretex=\tiny,§\meta{additional options}§]§\marg{svg filename}§ +% \includesvg[pretex=\tiny,§\meta{additional options}§]§\marg{svg filename}§ % \end{svgexample} % % \DescribeOption{draft} @@ -532,15 +549,18 @@ svg-extract -- Extract independent graphic files from SVG pictures % \begin{DescribeParameterParent}{Macro}{\includesvg} % \DescribeParameters{% % inkscape,inkscapeformat,inkscapelatex,inkscapearea,inkscapedpi,inkscapeopt,% -% width,height,scale,pretex,apptex,draft,% +% svgextension,width,height,scale,pretex,apptex,draft,% % } % It is used right in the same way but where \marg{svg filename} is the % file~name of the SVG~file, where any given file~extension will be replaced -% with \file{.svg} ruthlessly. If this 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. +% 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. % % 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 @@ -576,6 +596,10 @@ svg-extract -- Extract independent graphic files from SVG pictures % corresponding to the graphic~files generated by \app{Inkscape}. % \end{DescribeParameterParent} % +% +% +% \subsection{Including already exported SVG~files} +% % \DescribeMacro{\includeinkscape} % If you don't want to make use of the automated export with \app{Inkscape} but % the user interface provided by the \pkg{svg} package, you can use @@ -583,7 +607,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % \begin{svgexample} % \includeinkscape§\oarg{parameters}\marg{graphic filename}§ % \end{svgexample} -% +% % \begin{DescribeParameterParent}{Macro}{\includeinkscape} % \DescribeParameters{% % inkscapeformat,inkscapelatex,% @@ -598,7 +622,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % same effect as described before for command \cs{includesvg} once when % \cs{includeinkscape} is executed and remain unchanged afterwards. % \end{DescribeParameterParent} -% +% % % % \section{Usage of package \pkg{svg-extract}} @@ -915,7 +939,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % (\opt{\meta{option}}|=|\val{\{\meta{outputformat}[+]=\cs{relax}\}}). % % \DescribeOption{convertdpi} -% This options controls the used density for all file~formats or a specific one, +% 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 % inch~(DPI) either as a scalar value (e.g.~\opt{convertdpi}|=|\val{600}) or @@ -1506,7 +1530,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % \begin{option}{tex} % \changes{v2.00b}{2017/03/28}{new, alternative key for \opt{inkscapelatex}}^^A % \begin{macro}{\svg@ink@latex} -% This options controls whether the \app{Inkscape} export will be invoked with +% This option controls whether the \app{Inkscape} export will be invoked with % or without the generation of a seperate \LaTeX~file. % \begin{macrocode} \newif\if@svg@ink@latex @@ -1595,7 +1619,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % % % -% \subsubsection{Setting input folder} +% \subsubsection{Setting input folder and file} % % \begin{option}{svgpath} % \changes{v2.00}{2017/02/12}{deprecated}^^A @@ -1616,6 +1640,38 @@ svg-extract -- Extract independent graphic files from SVG pictures } % \end{macrocode} % \end{option}^^A svgpath +% \begin{option}{svgextension} +% \changes{v2.01}{2017/11/27}{new due to user request}^^A +% \begin{option}{extension} +% \begin{option}{ext} +% \begin{macro}{\svg@file@ext} +% This option modifies the expected extension for the input file which is +% exported with \app{Inkscape}. It is set to \file{svg} by default. +% \begin{macrocode} +\newcommand*\svg@file@ext{svg} +\DefineFamilyKey{SVG}{svgextension}{% +% \end{macrocode} +% Remove leading dots from the extension. +% \begin{macrocode} + \def\svg@tempa##1.##2.##3\relax{% + \IfArgIsEmpty{##1}{% + \def\svg@file@ext{##2}% + }{% + \def\svg@file@ext{##1}% + }% + }% +% \end{macrocode} +% The extension should be in lower case letters. +% \begin{macrocode} + \lowercase{\svg@tempa#1..\relax}% +} +\DefineFamilyKey{SVG}{extension}{\FamilyOptions{SVG}{svgextension=#1}} +\DefineFamilyKey{SVG}{ext}{\FamilyOptions{SVG}{svgextension=#1}} +% \end{macrocode} +% \end{macro}^^A \svg@file@ext +% \end{option}^^A ext +% \end{option}^^A extension +% \end{option}^^A svgextension % % % @@ -1870,6 +1926,70 @@ svg-extract -- Extract independent graphic files from SVG pictures % \end{macro}^^A \if@svg@quotes@found % \end{macro}^^A \svg@quotes@@check % \end{macro}^^A \svg@quotes@check +% \begin{macro}{\svg@set@input@path} +% \changes{v2.01}{2017/11/28}{new}% +% \begin{macro}{\svg@append@input@path} +% \changes{v2.01}{2017/11/28}{new}% +% 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% +% \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% + \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}% + \svg@append@input@path{\svg@file@path}{{#1}}% + \svg@append@input@path{\svg@file@path}{\input@path}% +% \end{macrocode} +% Passing each path to \cs{svg@normalize@path}. +% \begin{macrocode} + \def\svg@tempb{}% + \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% + \svg@file@path\do{% + \ifx\svg@tempa\@empty\else% + \svg@normalize@path{\svg@tempa}% + \edef\svg@tempb{% + \unexpanded\expandafter{\svg@tempb}{\svg@tempa}% + }% + \fi% + }% +% \end{macrocode} +% Finally, \cs{input@path} is set. +% \begin{macrocode} + \edef\svg@tempa{% + \endgroup% + \ifx\svg@tempb\@empty\else% + \noexpand\def\noexpand\input@path{\unexpanded\expandafter{\svg@tempb}}% + \fi% + }% + \svg@tempa% +} +% \end{macrocode} +% Only, if a certain search path is defined, it is added. +% \begin{macrocode} +\newcommand*\svg@append@input@path[2]{% + \ifx#2\@undefined\else% + \edef#1{\unexpanded\expandafter{#1}#2}% + \fi% +} +% \end{macrocode} +% \end{macro}^^A \svg@append@input@path +% \end{macro}^^A \svg@set@input@path % \begin{macro}{\svg@normalize@path} % \begin{macro}{\svg@normalize@@path} % If any path is given, a trailing slash is needed. These two macros ensure @@ -1934,7 +2054,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % \fi % % \begin{macro}{\svg@get@path} -% \begin{macro}{\svg@get@@path} +% \changes{v2.01}{2017/11/28}{using \cs{svg@set@input@path}}% % \begin{macro}{\if@svg@file@found} % \begin{macro}{\svg@file@path} % \begin{macro}{\svg@file@name} @@ -1953,7 +2073,7 @@ svg-extract -- Extract independent graphic files from SVG pictures \newcommand*\svg@file@name{} \newcommand*\svg@file@base{} \newcommand*\svg@file@suffix{} -\newcommand*\svg@get@path[3][svg]{% +\newcommand*\svg@get@path[3][\svg@file@ext]{% \begingroup% % \end{macrocode} % A maybe given, unneeded file extension is removed. @@ -1971,32 +2091,23 @@ svg-extract -- Extract independent graphic files from SVG pictures \edef\svg@tempa{"\svg@tempa"}% \fi% % \end{macrocode} -% If \cs{svgpath} was used, it is searched first. 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@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% - }% +% 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}{% + \@svg@tempswatrue% + \expandafter\svg@filename@parse\expandafter{\@filef@und}% + }{}% \edef\svg@tempa{% \endgroup% - \if@svg@file@found% + \if@svg@tempswa% \noexpand\@svg@file@foundtrue% \noexpand\def\noexpand\svg@file@path{\filename@area}% \noexpand\def\noexpand\svg@file@name{\filename@base}% @@ -2011,24 +2122,11 @@ svg-extract -- Extract independent graphic files from SVG pictures \svg@tempa% } % \end{macrocode} -% The macro \cs{svg@get@@path} does the actual search job. -% \begin{macrocode} -\newcommand*\svg@get@@path[1]{% -% 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} - \expandafter\IfFileExists\expandafter{#1}{% - \@svg@file@foundtrue% - \expandafter\svg@filename@parse\expandafter{\@filef@und}% - }{}% -} -% \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 % \end{macro}^^A \svg@get@path % \begin{macro}{\svg@filename@parse} % As the internal \LaTeXe{} command \cs{filename@parse} is not able to split a @@ -2116,25 +2214,35 @@ svg-extract -- Extract independent graphic files from SVG pictures }% }{% \edef\filename@ext{#1}% + \ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% +% \end{macrocode} +% Collecting all considered path for the error message. +% \begin{macrocode} \edef\svg@tempb{#3}% \ifstr{\svg@tempb}{./}{\let\svg@tempb\@empty}{}% - \ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% + \ifx\svg@tempb\@empty% + \svg@set@input@path% + \else% + \svg@set@input@path[\svg@tempb]% + \fi% + \ifx\input@path\@undefined% + \def\svg@tempb{No additional path was given.}% + \else% + \def\svg@tempb{Following folders have been searched:}% + \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% + \input@path\do{% + \edef\svg@tempb{\svg@tempb\noexpand\MessageBreak\svg@tempa}% + }% + \fi% +% \end{macrocode} +% The error message itself. +% \begin{macrocode} \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.% + neither in the current directory nor any other searched\MessageBreak% + path given by \string\svgpath\space or \string\graphicspath.% + \MessageBreak\svg@tempb% \else% in folder `\filename@area'.% \fi% @@ -2226,27 +2334,18 @@ svg-extract -- Extract independent graphic files from SVG pictures % \end{macro}^^A \svgsetup % \begin{macro}{\svgpath} % \changes{v2.00}{2017/02/12}{new}^^A -% \begin{macro}{\svg@path} +% \begin{macro}{\svg@input@path} % With \cs{svgpath} the user can give several root paths to SVG~files in the % same way as \cs{graphicspath} is used. The only difference is that a missing % slash is added at the end of the path, if needed. % \begin{macrocode} -\newcommand*\svg@path{} -\let\svg@path\input@path +\newcommand*\svg@input@path{} +\let\svg@input@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% + \def\svg@input@path{#1}% } % \end{macrocode} -% \end{macro}^^A \svg@path +% \end{macro}^^A \svg@input@path % \end{macro}^^A \svgpath % \begin{macro}{\includesvg} % \changes{v2.00}{2017/02/17}{changes, especially to optional parameters}^^A @@ -2341,9 +2440,9 @@ svg-extract -- Extract independent graphic files from SVG pictures % The file suffix used by both packages \pkg{svg} and \pkg{svg-extract}. % \begin{macrocode} \if@svg@ink@latex% - \def\svg@file@suffix{_svg-tex}% + \edef\svg@file@suffix{_\svg@file@ext-tex}% \else% - \def\svg@file@suffix{_svg-raw}% + \edef\svg@file@suffix{_\svg@file@ext-raw}% \fi% \@onelevel@sanitize\svg@file@suffix% % \end{macrocode} @@ -2377,7 +2476,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % \end{macrocode} % Raise an error, if the requested SVG~file wasn't found. % \begin{macrocode} - \svg@file@missing[svg]{\svg@file@base}{}% + \svg@file@missing[\svg@file@ext]{\svg@file@base}{}% \fi% \endgroup% } @@ -2607,7 +2706,7 @@ svg-extract -- Extract independent graphic files from SVG pictures % This is the case when the SVG~file is newer than the corresponding exported % file, or if the latter isn't present at all. % \begin{macrocode} - \svg@iffilenewer{\svg@file@base.svg}{\svg@out@base}{}{% + \svg@iffilenewer{\svg@file@base.\svg@file@ext}{\svg@out@base}{}{% \@svg@ink@runfalse% }% % \end{macrocode} @@ -2678,7 +2777,7 @@ svg-extract -- Extract independent graphic files from SVG pictures }{% \PackageWarning{svg}{% The export with Inkscape failed for file\MessageBreak% - `\svg@tempa.svg'\MessageBreak% + `\svg@tempa.\svg@file@ext'\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% @@ -2693,7 +2792,7 @@ svg-extract -- Extract independent graphic files from SVG pictures \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'% + for `\svg@tempa.\svg@file@ext'% }% \fi% \fi% @@ -2711,7 +2810,7 @@ svg-extract -- Extract independent graphic files from SVG pictures \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% + --file="#1.\svg@file@ext"\space% --export-\svg@ink@format="#2.\svg@ink@format"\space% } % \end{macrocode} @@ -2784,11 +2883,13 @@ svg-extract -- Extract independent graphic files from SVG pictures % \begin{macro}{\svg@@input} % 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}. +% 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} \newcommand*\svg@input{\svg@@input} \newcommand*\svg@@input[2][]{% \IfArgIsEmpty{#1}{}{\svg@local@param@set{#1}}% + \svg@set@input@path% \if@svg@draft% \@svg@ink@latexfalse% \fi% diff --git a/Master/texmf-dist/tex/latex/svg/svg-extract.sty b/Master/texmf-dist/tex/latex/svg/svg-extract.sty index fb2a247af56..f7472d3a063 100644 --- a/Master/texmf-dist/tex/latex/svg/svg-extract.sty +++ b/Master/texmf-dist/tex/latex/svg/svg-extract.sty @@ -26,14 +26,14 @@ %% %% 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). +%% 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-extract}[% - 2017/05/23 v2.00b\space% + 2017/11/29 v2.01\space% (extract independent graphics from SVG pictures)% ] \RequirePackage{svg}[2017/03/27] diff --git a/Master/texmf-dist/tex/latex/svg/svg.sty b/Master/texmf-dist/tex/latex/svg/svg.sty index 9fa4dadd0c4..0948d5dc94b 100644 --- a/Master/texmf-dist/tex/latex/svg/svg.sty +++ b/Master/texmf-dist/tex/latex/svg/svg.sty @@ -26,14 +26,14 @@ %% %% 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). +%% 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% + 2017/11/29 v2.01\space% (include SVG pictures)% ] \RequirePackage{scrbase}[2016/06/14] @@ -233,6 +233,19 @@ \fi% \FamilyKeyStateProcessed% } +\newcommand*\svg@file@ext{svg} +\DefineFamilyKey{SVG}{svgextension}{% + \def\svg@tempa##1.##2.##3\relax{% + \IfArgIsEmpty{##1}{% + \def\svg@file@ext{##2}% + }{% + \def\svg@file@ext{##1}% + }% + }% + \lowercase{\svg@tempa#1..\relax}% +} +\DefineFamilyKey{SVG}{extension}{\FamilyOptions{SVG}{svgextension=#1}} +\DefineFamilyKey{SVG}{ext}{\FamilyOptions{SVG}{svgextension=#1}} \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} @@ -370,6 +383,38 @@ \def\svg@quotes@@check#1"#2\@nil{% \IfArgIsEmpty{#2}{\@svg@quotes@foundfalse}{\@svg@quotes@foundtrue}% } +\newcommand*\svg@set@input@path[1][]{% + \begingroup% + \ifx\svg@file@path\@empty\else% + \edef\svg@file@path{{\svg@file@path}}% + \fi% + \svg@append@input@path{\svg@file@path}{\svg@input@path}% + \svg@append@input@path{\svg@file@path}{\Ginput@path}% + \svg@append@input@path{\svg@file@path}{{#1}}% + \svg@append@input@path{\svg@file@path}{\input@path}% + \def\svg@tempb{}% + \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% + \svg@file@path\do{% + \ifx\svg@tempa\@empty\else% + \svg@normalize@path{\svg@tempa}% + \edef\svg@tempb{% + \unexpanded\expandafter{\svg@tempb}{\svg@tempa}% + }% + \fi% + }% + \edef\svg@tempa{% + \endgroup% + \ifx\svg@tempb\@empty\else% + \noexpand\def\noexpand\input@path{\unexpanded\expandafter{\svg@tempb}}% + \fi% + }% + \svg@tempa% +} +\newcommand*\svg@append@input@path[2]{% + \ifx#2\@undefined\else% + \edef#1{\unexpanded\expandafter{#1}#2}% + \fi% +} \newcommand*\svg@normalize@path[1]{% \begingroup% \edef\svg@tempa{#1}% @@ -487,7 +532,7 @@ \newcommand*\svg@file@name{} \newcommand*\svg@file@base{} \newcommand*\svg@file@suffix{} -\newcommand*\svg@get@path[3][svg]{% +\newcommand*\svg@get@path[3][\svg@file@ext]{% \begingroup% \edef\svg@tempa{#2}% \svg@quotes@check{\svg@tempa}% @@ -501,27 +546,15 @@ \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% - }% + \svg@set@input@path[#3]% + \@svg@tempswafalse% + \expandafter\IfFileExists\expandafter{\svg@tempa}{% + \@svg@tempswatrue% + \expandafter\svg@filename@parse\expandafter{\@filef@und}% + }{}% \edef\svg@tempa{% \endgroup% - \if@svg@file@found% + \if@svg@tempswa% \noexpand\@svg@file@foundtrue% \noexpand\def\noexpand\svg@file@path{\filename@area}% \noexpand\def\noexpand\svg@file@name{\filename@base}% @@ -535,12 +568,6 @@ }% \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{% @@ -598,25 +625,29 @@ }% }{% \edef\filename@ext{#1}% + \ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% \edef\svg@tempb{#3}% \ifstr{\svg@tempb}{./}{\let\svg@tempb\@empty}{}% - \ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% + \ifx\svg@tempb\@empty% + \svg@set@input@path% + \else% + \svg@set@input@path[\svg@tempb]% + \fi% + \ifx\input@path\@undefined% + \def\svg@tempb{No additional path was given.}% + \else% + \def\svg@tempb{Following folders have been searched:}% + \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% + \input@path\do{% + \edef\svg@tempb{\svg@tempb\noexpand\MessageBreak\svg@tempa}% + }% + \fi% \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.% + neither in the current directory nor any other searched\MessageBreak% + path given by \string\svgpath\space or \string\graphicspath.% + \MessageBreak\svg@tempb% \else% in folder `\filename@area'.% \fi% @@ -656,28 +687,19 @@ \DefineFamilyMember[.param]{SVG} \newcommand*\svgsetup{\FamilyOptions{SVG}} \newcommand*\setsvg{\FamilyOptions{SVG}} -\newcommand*\svg@path{} -\let\svg@path\input@path +\newcommand*\svg@input@path{} +\let\svg@input@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% + \def\svg@input@path{#1}% } \newcommand*{\includesvg}[2][]{% \begingroup% \svg@deprecated@param% \svg@local@param@set{#1}% \if@svg@ink@latex% - \def\svg@file@suffix{_svg-tex}% + \edef\svg@file@suffix{_\svg@file@ext-tex}% \else% - \def\svg@file@suffix{_svg-raw}% + \edef\svg@file@suffix{_\svg@file@ext-raw}% \fi% \@onelevel@sanitize\svg@file@suffix% \svg@get@path{#2}{}% @@ -698,7 +720,7 @@ \svg@extract{\svg@out@base}% \fi% \else% - \svg@file@missing[svg]{\svg@file@base}{}% + \svg@file@missing[\svg@file@ext]{\svg@file@base}{}% \fi% \endgroup% } @@ -791,7 +813,7 @@ \begingroup% \@svg@ink@runtrue% \ifnum\svg@ink@mode=\tw@\relax\else% - \svg@iffilenewer{\svg@file@base.svg}{\svg@out@base}{}{% + \svg@iffilenewer{\svg@file@base.\svg@file@ext}{\svg@out@base}{}{% \@svg@ink@runfalse% }% \if@svg@ink@latex% @@ -845,7 +867,7 @@ }{% \PackageWarning{svg}{% The export with Inkscape failed for file\MessageBreak% - `\svg@tempa.svg'\MessageBreak% + `\svg@tempa.\svg@file@ext'\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% @@ -857,7 +879,7 @@ \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'% + for `\svg@tempa.\svg@file@ext'% }% \fi% \fi% @@ -869,7 +891,7 @@ \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% + --file="#1.\svg@file@ext"\space% --export-\svg@ink@format="#2.\svg@ink@format"\space% } \newcommand*\svg@get@lastpage[1]{% @@ -926,6 +948,7 @@ \newcommand*\svg@input{\svg@@input} \newcommand*\svg@@input[2][]{% \IfArgIsEmpty{#1}{}{\svg@local@param@set{#1}}% + \svg@set@input@path% \if@svg@draft% \@svg@ink@latexfalse% \fi% -- cgit v1.2.3