jonschz / tikz-nfold

Triple, quadruple, and n-fold paths and arrows with TikZ
LaTeX Project Public License v1.3c
11 stars 1 forks source link

Default scaling for `double distance` #3

Closed varkor closed 1 year ago

varkor commented 1 year ago

At the moment, double distance is the default regardless of the nfold=n parameter. In practice, it usually makes the most sense to scale the arrows so that the distance between the lines is constant. It would be nice if nfold would automatically set double distance proportionally to the number of lines.

jonschz commented 1 year ago

Thank you for the opinion. I am not sure what would be the expected behaviour here - so far, I made sure that nfold matches /tikz/double as closely as possible. What is your opinion on a second key, like scaling nfold=5?

varkor commented 1 year ago

Since Rightarrow increases the width of the arrow over an ordinary arrow, I'd expect nfold=n to increase the width of the arrow too (especially because for high n, the arrows look very crowded without increasing the distance). But from a usability perspective, having an option to enable scaling would be fine too – it still means the user doesn't have to manually calculate the appropriate distance themselves. So whichever option you feel is more appropriate :)

jonschz commented 1 year ago

I have added a key /tikz/scaling nfold in the current pre-relase:

\begin{tikzcd}
a \ar[r, Mapsto, bend left, scaling nfold=3] &
b \ar[d, Rightarrow, nfold, "\alpha", "\beta"’] \\
c \ar[r, Mapsfrom, scaling nfold=4, "\gamma" near end] &
d
\end{tikzcd}

grafik

Feel free to test this pre-release.

Making this scaling behaviour global for the key /pgf/nfold would be quite messy and require lots of changes to the rendering pipeline which likely would not be stable. Furthermore, giving different scaling behaviour to the keys /tikz/nfold and /pgf/nfold would be quite unexpected to me. However, I am open to suggestions for better names for either of these keys.

varkor commented 1 year ago

I finally got around to testing this, and it works perfectly. Thanks for the addition!