Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

*.dpth

*.log

*.md5

*.pdf

*.dep

*.aux

*.auxlock

test-tikzscale.synctex.gz

*.ins

*.sty

README.txt
26 changes: 26 additions & 0 deletions groupplot.tikz
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
\begin{tikzpicture}
\begin{groupplot}[
group style={
group size=2 by 2,
y descriptions at=edge left,
x descriptions at=edge bottom
},
xlabel=$x$,
ylabel=$y$
]

\nextgroupplot
\addplot {x^2 - x + 4};

\nextgroupplot
\addplot {x^2 - x + 4};

\nextgroupplot
\addplot {x^2 - x + 4};

\nextgroupplot
\addplot {x^2 - x + 4};

\end{groupplot}

\end{tikzpicture}
9 changes: 8 additions & 1 deletion test-tikzscale.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
\usepackage{pgfplots}
\usepackage{tikz-3dplot}
\usetikzlibrary{backgrounds}
\usepgfplotslibrary{groupplots}
\usepackage{currfile}
\usepackage{lmodern}
% Use the package subcaption to test the subfigure command
Expand Down Expand Up @@ -57,6 +58,12 @@
\includegraphics{pgfplots-test}%
\item Use pgfplots with given width and height\\%
\includegraphics[width=\linewidth,height=0.3\linewidth]{pgfplots-test}%
\item Use pgfplots with a 2x2 groupplot with a given total width\\%
\includegraphics[width=\linewidth]{groupplot}
\item Use pgfplots with a 2x2 groupplot with given total width and height\\%
\includegraphics[width=\linewidth,height=0.5\linewidth]{groupplot}
\item Use pgfplots with a 2x2 groupplot with given total width and axis ratio\\%
\includegraphics[width=\linewidth,axisratio=0.5]{groupplot}
\item Use includegraphics with only a node\\%
\includegraphics{testNode.tikz}%
% \item Use includegraphics with scaling only a node results in an error\\%
Expand Down Expand Up @@ -121,4 +128,4 @@
\end{subfigure}
\end{figure}

\end{document}
\end{document}
8 changes: 4 additions & 4 deletions tikzscale.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -1583,8 +1583,8 @@ and the derived files tikzscale.ins,
% \end{macrocode}
% Correct the dimension by the error. Use a global assignment, as each iteration in the loop is put into a separate group.
% \begin{macrocode}
\pgfmathsetglobalmacro{\tikzscale@width}{\tikzscale@width - \widthDifference}%
\pgfmathsetglobalmacro{\tikzscale@height}{\tikzscale@height - \heightDifference}%
\pgfmathsetglobalmacro{\tikzscale@width}{\requestedWidth / \wd\tikzscale@measuredSize * \tikzscale@width}%
\pgfmathsetglobalmacro{\tikzscale@height}{\requestedHeight / \ht\tikzscale@measuredSize * \tikzscale@height}%
}{%
\breakforeach
}%
Expand Down Expand Up @@ -1644,10 +1644,10 @@ and the derived files tikzscale.ins,
% \begin{macrocode}
\tikzscale@ifSizeDifference{\sizeDifference}{%
\tikzscale@ifIsWidth{#1}{%
\pgfmathsetglobalmacro{\tikzscale@width}{\tikzscale@width - \sizeDifference}%
\pgfmathsetglobalmacro{\tikzscale@width}{\requestedSize / \measuredSize * \tikzscale@width}%
\pgfmathsetglobalmacro{\tikzscale@height}{\tikzscale@width / \requestedAxisRatio}%
}{%
\pgfmathsetglobalmacro{\tikzscale@height}{\tikzscale@height - \sizeDifference}%
\pgfmathsetglobalmacro{\tikzscale@height}{\requestedSize / \measuredSize * \tikzscale@height}%
\pgfmathsetglobalmacro{\tikzscale@width}{\tikzscale@height * \requestedAxisRatio}%
}%
\tikzscale@ifSizeDifference{\sizeDifference-\tikzscale@oldSizeDifference}{%
Expand Down