MagicMuscleMan / tikzscale

The tikzscale LaTeX package provides an interface similar to includegraphics for tikzpictures. It allows scaling of TikZ images and PGFPlots to a provided width or height without changing the text size.
7 stars 3 forks source link

Error when both width and height are specified without pgfplots package loaded #7

Open user202729 opened 8 months ago

user202729 commented 8 months ago

if tikz package is loaded without pgfplots package, and both width and height are specified in \includegraphics command, an error happens:

./a.tex:6: Undefined control sequence.
\tikzscale@preparePlot code ->\pgfplotsset
                                           {every axis/.append style={width=...

An example document:

\documentclass{article}
\usepackage{tikz}
\usepackage{tikzscale}
\begin{document}
\includegraphics[width=3cm, height=3cm]{image.tikz}
\end{document}

Where image.tikz contains:

\begin{tikzpicture}
\draw (0, 0) -- (1, 2);
\end{tikzpicture}

I think the desirable behavior here would be that the image is resized so that the width is at most 3cm and the height is at most 3cm, whichever is smaller.


Apart from that, do you have any plan to support inline tikzpicture environments?


Also, I think it's undesirable for the package to implicitly handle in addition relative import, that feels like the job of a separate package to me. The import package already handles that.STPH-FP