pgf icon indicating copy to clipboard operation
pgf copied to clipboard

Improve Euclid tutorial to use veclen(\p1) instead of veclen(\x1,\y1)?

Open user202729 opened this issue 1 year ago • 4 comments

Brief outline of the proposed feature

As mentioned in the title. I think this could clean up the code.

Usage example

No response

### Tasks

user202729 avatar Apr 24 '24 21:04 user202729

One benefit of veclen(\x1,\y1) than veclen(\p1): the former indicates that veclen takes two arguments.

muzimuzhi avatar Apr 24 '24 22:04 muzimuzhi

That's true, but also worth mentioning that the user could do that.

It's a bit tricky though. Everything is done through macro expansion, so a function that "takes" coordinate argument actually just take two consecutive number arguments.

user202729 avatar Apr 25 '24 05:04 user202729

a coordinate does not expand to two numbers, hence in that sense it is not a data structure. In the case of node, holds the name and then chooses by default the center anchor for convenience. Expanding \p1 does not seem to me a huge time saver here.

ilayn avatar Apr 25 '24 10:04 ilayn

Currently the Euclid tutorial introduces \p1 as "\p<digit> yields the same as \x<digit>,\y<digit>". We could add some words like

"So practically veclen(\p1) is the same as veclen(\x1, \y1), but Euclid prefers the latter form to inform himself that veclen() takes two arguments."

https://github.com/pgf-tikz/pgf/blob/913d955f9a2f6693b0154311f0cdc94d68a45e84/doc/generic/pgf/pgfmanual-en-tutorial-Euclid.tex#L243-L262

muzimuzhi avatar Apr 25 '24 14:04 muzimuzhi