summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tikzscale
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-09 23:40:05 +0000
committerKarl Berry <karl@freefriends.org>2013-01-09 23:40:05 +0000
commitc242f8a8127120acd43052ff3e4ad624363886ad (patch)
tree78e9777149ea985f2a7d1218600c9a216256e8c9 /Master/texmf-dist/tex/latex/tikzscale
parentf2e0420b7971a75478867c2c5facd4988612638a (diff)
tikzscale (9jan13)
git-svn-id: svn://tug.org/texlive/trunk@28778 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/tikzscale')
-rw-r--r--Master/texmf-dist/tex/latex/tikzscale/tikzscale.sty35
1 files changed, 24 insertions, 11 deletions
diff --git a/Master/texmf-dist/tex/latex/tikzscale/tikzscale.sty b/Master/texmf-dist/tex/latex/tikzscale/tikzscale.sty
index 7937de6b1f5..517f35a8634 100644
--- a/Master/texmf-dist/tex/latex/tikzscale/tikzscale.sty
+++ b/Master/texmf-dist/tex/latex/tikzscale/tikzscale.sty
@@ -13,7 +13,7 @@
%% ----------------------------------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tikzscale}[2013/01/02 v0.2 tikzscale LaTeX package]
+\ProvidesPackage{tikzscale}[2013/01/09 v0.2.1 tikzscale LaTeX package]
\RequirePackage{graphicx}
\RequirePackage{etoolbox}
\RequirePackage{pgfkeys}
@@ -72,6 +72,9 @@
\edef\tikzscale@eforcsvlist{#2}%
\expandafter\forcsvlist\expandafter{\expandafter#1\expandafter}\expandafter{\tikzscale@eforcsvlist}%
}
+\def\tikzscale@trim#1{%
+\ignorespaces#1\unskip
+}%
\NewDocumentCommand{\elseif}{mm}{%
\ifboolexpr{#1}{%
#2%
@@ -120,8 +123,17 @@
\LetLtxMacro{\tikzscale@oldincludegraphics}{\includegraphics}%
\LetLtxMacro{\includegraphics}{\tikzscale@includegraphics}%
\NewDocumentCommand{\tikzscale@patchTikzpicture}{}{%
-\pretocmd{\tikzpicture}{\LetLtxMacro{\includegraphics}{\tikzscale@oldincludegraphics}}{}{\PackageError{tikzscale}{Patching tikzpicture failed}}%
-\apptocmd{\endtikzpicture}{\LetLtxMacro{\includegraphics}{\tikzscale@includegraphics}}{}{\PackageError{tikzscale}{Patching endtikzpicture failed}}%
+\pretocmd{\tikzpicture}{%
+\LetLtxMacro{\includegraphics}{\tikzscale@oldincludegraphics}%
+}{}{\PackageError{tikzscale}{Patching tikzpicture failed}}%
+\apptocmd{\endtikzpicture}{%
+\LetLtxMacro{\includegraphics}{\tikzscale@includegraphics}%
+}{}{\PackageError{tikzscale}{Patching endtikzpicture failed}}%
+\apptocmd{\tikzpicture}{%
+\ifdef{\tikzscale@restoreEndLineChar}{%
+\tikzscale@restoreEndLineChar
+}{}%
+}{}{\PackageError{tikzscale}{Patching tikzpicture failed}}%
}%
\tikzscale@patchTikzpicture
\ifExternalizationLoaded{%
@@ -154,9 +166,9 @@
\ifcsdef{tikzscale@testTikzFile}{%
\tikzscale@includetikz[#1]{\tikzscale@fileName}%
}{%
+\tikzscale@restoreEndLineChar
\tikzscale@oldincludegraphics[#1]{\tikzscale@fileName}%
}%
-\tikzscale@restoreEndLineChar
\endgroup
}%
\NewDocumentCommand{\tikzscale@findExactFileName}{mm}{%
@@ -208,7 +220,7 @@ axisratio/.value required
}
\NewDocumentCommand{\tikzscale@includetikzUnexternalized}{O{}m}{%
\elseif{test {\ifundef{\requestedWidth}} and test {\ifundef{\requestedHeight}} and test {\ifundef{\requestedAxisRatio}}}{%
-\input{#2}%
+\tikzscale@trim{\input{#2}}%
}{test {\ifdef{\requestedWidth}} and test {\ifdef{\requestedHeight}}}{%
\tikzscale@resizePlotTo{#2}%
}{test {\ifdef{\requestedAxisRatio}}}{%
@@ -231,7 +243,7 @@ axisratio/.value required
\IfFileExists{\tikzscale@externalizationName.dpth}{%
\tikzscale@checkRequestedSizeChanges
}{}%
-\input{#1}%
+\tikzscale@trim{\input{#1}}%
}
\NewDocumentCommand{\tikzscale@checkRequestedSizeChanges}{}{%
\ifdef{\requestedWidth}{%
@@ -260,6 +272,7 @@ axisratio/.value required
\undef{\tikzscale@oldAxisRatio}%
}{%
\tikzset{external/remake next}%
+\PackageWarning{tikzscale}{Regenerate \tikzscale@externalizationName \MessageBreak because of no external axis ratio}%
}%
}{}%
}
@@ -273,10 +286,10 @@ axisratio/.value required
\tikzscale@prepareTikzpicture
\elseif{test {\ifdef{\requestedWidth}} and test {\ifundef{\requestedHeight}}}{%
\def\requestedSize{\requestedWidth}%
-\tikzscale@scaleTikzpictureTo{\wd}{\input{#1}}{#1}%
+\tikzscale@scaleTikzpictureTo{\wd}{\tikzscale@trim{\input{#1}}}{#1}%
}{test {\ifundef{\requestedWidth}} and test {\ifdef{\requestedHeight}}}{%
\def\requestedSize{\requestedHeight}%
-\tikzscale@scaleTikzpictureTo{\ht}{\input{#1}}{#1}%
+\tikzscale@scaleTikzpictureTo{\ht}{\tikzscale@trim{\input{#1}}}{#1}%
}{%
\tikzscale@invalidKeyError{#1}%
}%
@@ -290,12 +303,12 @@ axisratio/.value required
\let\requestedSize\requestedWidth
\def\tikzscale@width{\requestedWidth}%
\pgfmathsetmacro{\tikzscale@height}{\requestedWidth / \requestedAxisRatio}%
-\tikzscale@resizePlotWithAxesRatioTo{\wd}{\tikzscale@width}{\input{#1}}{#1}%
+\tikzscale@resizePlotWithAxesRatioTo{\wd}{\tikzscale@width}{\tikzscale@trim{\input{#1}}}{#1}%
}{test {\ifundef{\requestedWidth}} and test {\ifdef{\requestedHeight}}}{%
\let\requestedSize\requestedHeight
\def\tikzscale@height{\requestedHeight}%
\pgfmathsetmacro{\tikzscale@width}{\requestedHeight * \requestedAxisRatio}%
-\tikzscale@resizePlotWithAxesRatioTo{\ht}{\tikzscale@height}{\input{#1}}{#1}%
+\tikzscale@resizePlotWithAxesRatioTo{\ht}{\tikzscale@height}{\tikzscale@trim{\input{#1}}}{#1}%
}{%
\tikzscale@invalidKeyError{#1}%
}%
@@ -333,7 +346,7 @@ axisratio/.value required
}
\NewDocumentCommand{\tikzscale@resizePlotTo}{m}{%
\def\fileName{#1}%
-\def\content{\input{#1}}%
+\def\content{\tikzscale@trim{\input{#1}}}%
\tikzscale@preparePlot
\def\tikzscale@width{\requestedWidth}%
\def\tikzscale@height{\requestedHeight}%