samcarter / tikzducks

A latex package to draw cute rubber ducks with TikZ
https://ctan.org/pkg/tikzducks
LaTeX Project Public License v1.3c
169 stars 13 forks source link

Scale scales y and x shift #36

Closed JoniBue1 closed 5 months ago

JoniBue1 commented 5 months ago

Hello there, I don't know if it is wanted like this but the scale option scales also the x and y shift. I've got a MWE :

\documentclass{minimal}
\usepackage{tikzducks}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \duck[scale=0.4, xshift=30pt]
        \duck[scale=2, xshift=30pt]
    \end{tikzpicture}
\end{document}

When you comile this you can see, that the big duck is shifted from the little one, as it should be at the same shift. grafik

samcarter commented 5 months ago

Thanks for the report!

This is the typical TikZ behaviour:

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \draw[scale=0.4, xshift=30pt] circle [radius=3mm];
        \draw[scale=2, xshift=30pt] circle [radius=3mm];
    \end{tikzpicture}
\end{document}

document-1

... so I consider this status by design.

If you want to shift them by the same amount, you could use

\documentclass{standalone}
\usepackage{tikzducks}
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}
        \duck[xshift=30pt,scale=0.4]
        \duck[xshift=30pt,scale=2]
    \end{tikzpicture}
\end{document}

document-1

muzimuzhi commented 5 months ago

Coordinate transformations in TikZ are applied incrementally, thus the order matters.

Rather, all you can do is to “add” another transformation to the current matrix. https://tikz.dev/tikz-transformations#sec-25.3