diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty | 136 |
1 files changed, 72 insertions, 64 deletions
diff --git a/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty b/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty index 8611329fb78..6a5d70df83e 100644 --- a/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty +++ b/Master/texmf-dist/tex/latex/lwarp/lwarp-graphics.sty @@ -50,6 +50,10 @@ \newcommand*{\LWR@igangle}{} \newcommand*{\LWR@igxscale}{1} \newcommand*{\LWR@igyscale}{1} + +\newbool{LWR@igkeepaspectratio} +\boolfalse{LWR@igkeepaspectratio} + \newcommand*{\LWR@igclass}{inlineimage} \newcommand*{\LWR@igalt}{\ImageAltText} @@ -93,6 +97,9 @@ {}% not px }{}% end of length > 0pt } +\define@key{igraph}{keepaspectratio}[false]{% + \booltrue{LWR@igkeepaspectratio}% +} \define@key{igraph}{origin}[c]{% \renewcommand*{\LWR@igorigin}{#1}% } @@ -120,7 +127,6 @@ \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}{} @@ -170,83 +176,81 @@ }% } -\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% - }% +\newcommand*{\LWR@ig@useactualimagesize}[4]{% + \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% \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% + }% + \else% + \appto\LWR@restoreorigformatting{% + \DeclareGraphicsExtensions{% + .eps,.EPS,.gif,.GIF,.png,.PNG,.jpg,.JPG,.jpeg,.JPEG% + }% + }% + \fi% + \fi% \ifpdf + \ifbool{FormatWP}{\define@key{Gin}{angle}{}}{}% + \IfBooleanTF{#1}% + {% starred + \IfValueTF{#3}% + {% + \global\sbox{\LWR@imagesizebox}{% + \LWR@origincludegraphics*[#2][#3]{#4}% }% }% - \fi% - \fi% \ifpdf - \define@key{Gin}{angle}{}% - \IfBooleanTF{#1}% - {% starred - \IfValueTF{#3}% + {% + \IfValueTF{#2}% {% \global\sbox{\LWR@imagesizebox}{% - \LWR@origincludegraphics*[#2][#3]{#4}% + \LWR@origincludegraphics*[#2]{#4}% }% - }% - {% - \IfValueTF{#2}% - {% - \global\sbox{\LWR@imagesizebox}{% - \LWR@origincludegraphics*[#2]{#4}% - }% - }{% - \global\sbox{\LWR@imagesizebox}{% - \LWR@origincludegraphics*{#4}% - }% + }{% + \global\sbox{\LWR@imagesizebox}{% + \LWR@origincludegraphics*{#4}% }% }% - }% starred - {% not starred - \IfValueTF{#3}% + }% + }% starred + {% not starred + \IfValueTF{#3}% + {% + \global\sbox{\LWR@imagesizebox}{% + \LWR@origincludegraphics[#2][#3]{#4}% + }% + }% + {% + \IfValueTF{#2}% {% \global\sbox{\LWR@imagesizebox}{% - \LWR@origincludegraphics[#2][#3]{#4}% + \LWR@origincludegraphics[#2]{#4}% }% - }% - {% - \IfValueTF{#2}% - {% - \global\sbox{\LWR@imagesizebox}{% - \LWR@origincludegraphics[#2]{#4}% - }% - }{% - \global\sbox{\LWR@imagesizebox}{% - \LWR@origincludegraphics{#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 + }% 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}% + }% } \newcommand*{\LWR@ig@htmltag}{% @@ -316,6 +320,7 @@ \renewcommand*{\LWR@igxscale}{1}% \renewcommand*{\LWR@igyscale}{1}% \renewcommand*{\LWR@igclass}{inlineimage}% + \boolfalse{LWR@igkeepaspectratio}% \ifdefvoid{\LWR@ThisAltText}{% \edef\LWR@igalt{\ImageAltText}% }{% @@ -338,7 +343,10 @@ \filename@parse{\LWR@parsedfilename}% \StrSubstitute{\LWR@parsedfilename}{//}{/}[\LWR@parsedfilename]% \LWR@traceinfo{LWR@parsedfilename is \LWR@parsedfilename}% - \LWR@ig@wpimagesizes{#1}{#2}{#3}{#4}% + \ifboolexpr{ + bool {FormatWP} or + bool {LWR@igkeepaspectratio} + }{\LWR@ig@useactualimagesize{#1}{#2}{#3}{#4}}{}% \LWR@traceinfo{LWR@includegraphicsb: about to create href}% \LWR@href{\LWR@parsedfilename}% {% start of href |