You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
tex-compiler/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty

454 lines
13 KiB

%%
%% This is file `lwarp-graphics.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% lwarp.dtx (with options: `graphics')
%% This is a generated file.
%% Copyright 2016-2020 Brian Dunn
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
\LWR@ProvidesPackagePass{graphics}[2017/06/25]
\AtBeginDocument{
\DeclareGraphicsExtensions{.svg,.SVG,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG}
\DeclareGraphicsRule{.svg}{svg}{.svg}{}
\DeclareGraphicsRule{.SVG}{svg}{.SVG}{}
}
\ifpdf
\appto\LWR@restoreorigformatting{%
\DeclareGraphicsExtensions{.pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG}%
}
\else% \ifpdf
\ifXeTeX
\appto\LWR@restoreorigformatting{%
\DeclareGraphicsExtensions{.pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG}%
}
\else
\appto\LWR@restoreorigformatting{%
\DeclareGraphicsExtensions{.eps,.EPS,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG}%
}
\fi
\fi
\newlength{\LWR@igwidth}
\newlength{\LWR@igheight}
\newcommand*{\LWR@igwidthstyle}{}
\newcommand*{\LWR@igheightstyle}{}
\newcommand*{\LWR@igorigin}{}
\newcommand*{\LWR@igangle}{}
\newcommand*{\LWR@igxscale}{1}
\newcommand*{\LWR@igyscale}{1}
\newcommand*{\LWR@igclass}{inlineimage}
\newcommand*{\LWR@igalt}{\ImageAltText}
\define@key{igraph}{width}{%
\setlength{\LWR@igwidth}{#1}%
\ifthenelse{\lengthtest{\LWR@igwidth > 0pt}}%
{%
\renewcommand*{\LWR@igwidthstyle}{width:\LWR@printlength{\LWR@igwidth}}%
\IfEndWith{#1}{ex}%
{\renewcommand*{\LWR@igwidthstyle}{width:#1}}% yes ex
{}% not ex
\IfEndWith{#1}{em}%
{\renewcommand*{\LWR@igwidthstyle}{width:#1}}% yes em
{}% not em
\IfEndWith{#1}{\%}%
{\renewcommand*{\LWR@igwidthstyle}{width:#1}}% yes percent
{}% not percent
\IfEndWith{#1}{px}%
{\renewcommand*{\LWR@igwidthstyle}{width:#1}}% yes px
{}% not px
}{}% end of length > 0pt
}
\define@key{igraph}{height}{%
\setlength{\LWR@igheight}{#1}%
\ifthenelse{\lengthtest{\LWR@igheight > 0pt}}%
{%
\renewcommand*{\LWR@igheightstyle}{%
height:\LWR@printlength{\LWR@igheight} % extra space
}%
\IfEndWith{#1}{ex}%
{\renewcommand*{\LWR@igheightstyle}{height:#1}}% yes ex
{}% not ex
\IfEndWith{#1}{em}%
{\renewcommand*{\LWR@igheightstyle}{height:#1}}% yes em
{}% not em
\IfEndWith{#1}{\%}%
{\renewcommand*{\LWR@igheightstyle}{height:#1}}% yes percent
{}% not percent
\IfEndWith{#1}{px}%
{\renewcommand*{\LWR@igheightstyle}{height:#1}}% yes px
{}% not px
}{}% end of length > 0pt
}
\define@key{igraph}{origin}[c]{%
\renewcommand*{\LWR@igorigin}{#1}%
}
\define@key{igraph}{angle}{\renewcommand*{\LWR@igangle}{#1}}
\define@key{igraph}{class}{\renewcommand*{\LWR@igclass}{#1}}
\define@key{igraph}{alt}{\renewcommand*{\LWR@igalt}{#1}}
\define@key{igraph}{scale}{%
\ifthenelse{\equal{#1}{1}}{}{% must expand #1
\PackageWarning{lwarp}{%
It is recommended to use ``[width=xx\protect\linewidth]''\MessageBreak
instead of ``[scale=yy]'',%
}%
}%
\renewcommand*{\LWR@igxscale}{#1}%
\renewcommand*{\LWR@igyscale}{#1}%
}
\define@key{igraph}{bb}{}
\define@key{igraph}{bbllx}{}
\define@key{igraph}{bblly}{}
\define@key{igraph}{bburx}{}
\define@key{igraph}{bbury}{}
\define@key{igraph}{natwidth}{}
\define@key{igraph}{natheight}{}
\define@key{igraph}{hiresbb}[true]{}
\define@key{igraph}{viewport}{}
\define@key{igraph}{trim}{}
\define@key{igraph}{totalheight}{}
\define@key{igraph}{keepaspectratio}[true]{}
\define@key{igraph}{clip}[true]{}
\define@key{igraph}{draft}[true]{}
\define@key{igraph}{type}{}
\define@key{igraph}{ext}{}
\define@key{igraph}{read}{}
\define@key{igraph}{command}{}
\define@key{igraph}{quite}{}
\define@key{igraph}{page}{}
\define@key{igraph}{pagebox}{}
\define@key{igraph}{interpolate}[true]{}
\define@key{igraph}{decodearray}{}
\newcommand*{\LWR@rotstyle}[2]{%
\edef\LWR@tempone{#2}%
\setcounter{LWR@tempcountone}{-1*\real{\LWR@tempone}} % space
#1transform:rotate(\arabic{LWR@tempcountone}deg); % space
}
\newcommand*{\LWR@scalestyle}[3]{%
#1transform:scale(#2,#3);
}
\def\LWR@opacity{1}
\newsavebox{\LWR@imagesizebox}
\newcommand*{\LWR@HTML@Gin@setfile}[3]{%
\xdef\LWR@parsedfilename{#3}%
}
\AtBeginDocument{
\define@key{Gin}{class}{}
\define@key{Gin}{alt}{}
}
\AtBeginDocument{
\@ifpackageloaded{epstopdf}
{
\newcommand*{\LWR@replaceEPSSVG}{}
}{%
\newcommand*{\LWR@replaceEPSSVG}{%
\StrSubstitute{\LWR@tempone}{.eps}{.svg}[\LWR@tempone]%
\StrSubstitute{\LWR@tempone}{.EPS}{.SVG}[\LWR@tempone]%
}
}%
}
\newcommand*{\LWR@ig@wpimagesizes}[4]{%
\ifbool{FormatWP}{%
\begingroup%
\LWR@restoreorigformatting%
\ifpdf%
\appto\LWR@restoreorigformatting{%
\DeclareGraphicsExtensions{%
.pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
}%
}%
\else% \ifpdf
\ifXeTeX%
\appto\LWR@restoreorigformatting{%
\DeclareGraphicsExtensions{%
.pdf,.PDF,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
}%
}%
\else%
\appto\LWR@restoreorigformatting{%
\DeclareGraphicsExtensions{%
.eps,.EPS,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG%
}%
}%
\fi%
\fi% \ifpdf
\define@key{Gin}{angle}{}%
\IfBooleanTF{#1}%
{% starred
\IfValueTF{#3}%
{%
\global\sbox{\LWR@imagesizebox}{%
\LWR@origincludegraphics*[#2][#3]{#4}%
}%
}%
{%
\IfValueTF{#2}%
{%
\global\sbox{\LWR@imagesizebox}{%
\LWR@origincludegraphics*[#2]{#4}%
}%
}{%
\global\sbox{\LWR@imagesizebox}{%
\LWR@origincludegraphics*{#4}%
}%
}%
}%
}% starred
{% not starred
\IfValueTF{#3}%
{%
\global\sbox{\LWR@imagesizebox}{%
\LWR@origincludegraphics[#2][#3]{#4}%
}%
}%
{%
\IfValueTF{#2}%
{%
\global\sbox{\LWR@imagesizebox}{%
\LWR@origincludegraphics[#2]{#4}%
}%
}{%
\global\sbox{\LWR@imagesizebox}{%
\LWR@origincludegraphics{#4}%
}%
}%
}%
}% not starred
\endgroup%
\settowidth{\LWR@igwidth}{\usebox{\LWR@imagesizebox}}%
\global\renewcommand*{\LWR@igwidthstyle}{%
width:\LWR@printlength{\LWR@igwidth}%
}%
\settoheight{\LWR@igheight}{\usebox{\LWR@imagesizebox}}%
\global\renewcommand*{\LWR@igheightstyle}{%
height:\LWR@printlength{\LWR@igheight}%
}%
}{}% FormatWP
}
\newcommand*{\LWR@ig@htmltag}{%
img\LWR@indentHTML%
src="%
\detokenize\expandafter{\LWR@parsedfilename}%
"\LWR@indentHTML%
\ifthenelse{
\NOT\equal{\LWR@igwidthstyle}{} \OR
\NOT\equal{\LWR@igheightstyle}{} \OR
\NOT\equal{\LWR@igorigin}{} \OR
\NOT\equal{\LWR@igangle}{} \OR
\NOT\equal{\LWR@igxscale}{1} \OR
\NOT\equal{\LWR@igyscale}{1}
}%
{%
style="\LWR@indentHTML
\ifthenelse{\NOT\equal{\LWR@igwidthstyle}{}}%
{\LWR@igwidthstyle;\LWR@indentHTML}{}%
\ifthenelse{\NOT\equal{\LWR@igheightstyle}{}}%
{\LWR@igheightstyle;\LWR@indentHTML}{}%
\ifthenelse{\NOT\equal{\LWR@igorigin}{}}%
{%
transform-origin: \LWR@originnames{\LWR@igorigin};%
\LWR@indentHTML%
}{}%
\ifthenelse{\NOT\equal{\LWR@igangle}{}}%
{%
\LWR@rotstyle{-ms-}{\LWR@igangle}\LWR@indentHTML
\LWR@rotstyle{-webkit-}{\LWR@igangle}\LWR@indentHTML
\LWR@rotstyle{}{\LWR@igangle }\LWR@indentHTML
}{}%
\ifthenelse{%
\NOT\equal{\LWR@igxscale}{1}\OR%
\NOT\equal{\LWR@igyscale}{1}%
}%
{%
\LWR@scalestyle{-ms-}{\LWR@igxscale}{\LWR@igyscale}%
\LWR@indentHTML
\LWR@scalestyle{-webkit-}{\LWR@igxscale}{\LWR@igyscale}%
\LWR@indentHTML
\LWR@scalestyle{}{\LWR@igxscale}{\LWR@igyscale}%
\LWR@indentHTML
}{}%
%
\ifthenelse{\NOT\equal{\LWR@opacity}{1}}%
{opacity:\LWR@opacity;\LWR@indentHTML}{}%
%
"\LWR@indentHTML%
}{}%
class="\LWR@igclass"\LWR@indentHTML%
alt="\AltTextOpen\LWR@igalt\AltTextClose" \LWR@orignewline%
}% end of image tags
\NewDocumentCommand{\LWR@includegraphicsb}{s o o m}
{%
\LWR@origtilde \LWR@orignewline%
\begin{LWR@setvirtualpage}%
\large%
\setlength{\LWR@igwidth}{0pt}%
\setlength{\LWR@igheight}{0pt}%
\renewcommand*{\LWR@igwidthstyle}{}%
\renewcommand*{\LWR@igheightstyle}{}%
\renewcommand*{\LWR@igorigin}{}%
\renewcommand*{\LWR@igangle}{}%
\renewcommand*{\LWR@igxscale}{1}%
\renewcommand*{\LWR@igyscale}{1}%
\renewcommand*{\LWR@igclass}{inlineimage}%
\ifdefvoid{\LWR@ThisAltText}{%
\edef\LWR@igalt{\ImageAltText}%
}{%
\edef\LWR@igalt{\LWR@ThisAltText}%
}%
\IfValueF{#3}{%
\IfValueTF{#2}%
{\setkeys{igraph}{#2}}%
{\setkeys{igraph}{}}%
}%
\begingroup%
\LetLtxMacro\Gin@setfile\LWR@HTML@Gin@setfile%
\edef\LWR@tempone{#4}%
\StrSubstitute{\LWR@tempone}{.pdf}{.svg}[\LWR@tempone]%
\StrSubstitute{\LWR@tempone}{.PDF}{.SVG}[\LWR@tempone]%
\LWR@replaceEPSSVG%
\xdef\LWR@parsedfilename{\LWR@tempone}%
\Ginclude@graphics{\detokenize\expandafter{\LWR@tempone}}%
\endgroup%
\filename@parse{\LWR@parsedfilename}%
\LWR@traceinfo{LWR@parsedfilename is \LWR@parsedfilename}%
\LWR@ig@wpimagesizes{#1}{#2}{#3}{#4}%
\LWR@traceinfo{LWR@includegraphicsb: about to create href}%
\LWR@href{\LWR@parsedfilename}%
{% start of href
\LWR@traceinfo{LWR@includegraphicsb: about to LWR@htmltag}%
\LWR@htmltag{\LWR@ig@htmltag}%
}% end of href
\end{LWR@setvirtualpage}%
\gdef\LWR@ThisAltText{}%
\LWR@traceinfo{LWR@includegraphicsb done}%
}
\AtBeginDocument{
\LWR@traceinfo{Patching includegraphics.}
\LetLtxMacro\LWR@origincludegraphics\includegraphics
\renewrobustcmd*{\includegraphics}
{%
\LWR@traceinfo{includegraphics}%
\LWR@ensuredoingapar%
\LWR@includegraphicsb%
}% includegraphics
}% AtBeginDocument
\newcommand*{\LWR@rotboxorigin}{}
\newcommand*{\LWR@originname}[1]{%
\ifthenelse{\equal{#1}{t}}{top}{}%
\ifthenelse{\equal{#1}{b}}{bottom}{}%
\ifthenelse{\equal{#1}{c}}{center}{}%
\ifthenelse{\equal{#1}{l}}{left}{}%
\ifthenelse{\equal{#1}{r}}{right}{}%
}
\newcommand*{\LWR@originnames}[1]{%
\StrChar{#1}{1}[\LWR@strresult]%
\LWR@originname{\LWR@strresult}
\StrChar{#1}{2}[\LWR@strresult]%
\LWR@originname{\LWR@strresult}
}
\define@key{krotbox}{origin}{%
\renewcommand*{\LWR@rotboxorigin}{#1}%
}
\define@key{krotbox}{x}{}
\define@key{krotbox}{y}{}
\define@key{krotbox}{units}{}
\AtBeginDocument{
\NewDocumentCommand{\LWR@HTML@rotatebox}{O{} m +m}{%
\renewcommand*{\LWR@rotboxorigin}{}
\setkeys{krotbox}{#1}%
\LWR@htmltagc{%
span\LWR@indentHTML
style="\LWR@indentHTML
display: inline-block;\LWR@indentHTML
\ifthenelse{\NOT\equal{\LWR@rotboxorigin}{}}%
{transform-origin: \LWR@originnames{\LWR@rotboxorigin};\LWR@indentHTML}%
{}%
\LWR@rotstyle{-ms-}{#2}\LWR@indentHTML
\LWR@rotstyle{-webkit-}{#2}\LWR@indentHTML
\LWR@rotstyle{}{#2}"\LWR@orignewline%
}\LWR@orignewline%
\begin{LWR@nestspan}%
#3%
\LWR@htmltagc{/span}%
\end{LWR@nestspan}%
}
\LWR@formatted{rotatebox}
}% AtBeginDocument
\AtBeginDocument{
\NewDocumentCommand{\LWR@HTML@scalebox}{m o m}{%
\LWR@htmltagc{%
span\LWR@indentHTML
style="\LWR@indentHTML
display: inline-block;\LWR@indentHTML
\LWR@scalestyle{-ms-}{#1}{\IfNoValueTF{#2}{#1}{#2}}\LWR@indentHTML
\LWR@scalestyle{-webkit-}{#1}{\IfNoValueTF{#2}{#1}{#2}}\LWR@indentHTML
\LWR@scalestyle{}{#1}{\IfNoValueTF{#2}{#1}{#2}}
"\LWR@orignewline
}\LWR@orignewline%
\begin{LWR@nestspan}%
#3%
\LWR@htmltagc{/span}%
\end{LWR@nestspan}%
}
\LWR@formatted{scalebox}
}% AtBeginDocument
\AtBeginDocument{
\newcommand{\LWR@HTML@reflectbox}[1]{%
\scalebox{-1}[1]{#1}%
}% \reflectbox
\LWR@formatted{reflectbox}
}% AtBeginDocument
\AtBeginDocument{
\NewDocumentCommand{\LWR@HTML@resizebox}{s m m m}{%
#4%
}
\LWR@formatted{resizebox}
}% AtBeginDocument
\endinput
%%
%% End of file `lwarp-graphics.sty'.