The answer by Marmot to How can I use rotate inside a defined TikZ command? calls one use of scope in TikZ a quick and dirty fix. The fix works. But the answer suggests to avoid this use of scope in a TikZ command definition, and use newcommand instead.
To me as non-expert this particular use of scope does seem odd. It merely seems to re-iterate an argument that I had already declared, since TikZ was ignoring some (but not all) values of that argument until I re-iterated it. But that issue may not be to the point at all.
Are there general reasons to try to avoid using scope, in favor of newcommand?
\newcommandinstead of\def. There is a question on this site about the advantages/disadvantages. – TeXnician Jan 09 '18 at 12:39\newcommandvs.\defto define the command in the first place,scopeand\newcommanddo different things. So this entire question seems based on a misunderstanding. I can't explain why, but rotation of a line doesn't work when drawn between named coordinates, e.g. with\coordinate (a) at (0,0);\coordinate (b) at (1,0); \draw [rotate=30] (a) -- (b); \draw[blue,rotate=30] (0,0) -- (1,0);only the blue line is rotated. – Torbjørn T. Jan 09 '18 at 13:46\defand\newcommandare for the same purpose, but the latter is usually recommended because it checks for existing macros, and throws an error if you try to use a macro name that is already in use. You can use\newcommandto define the\linemacro (though the syntax would have to be slightly different) with ascopeenvironment in the definition. See https://tex.stackexchange.com/questions/655/what-is-the-difference-between-def-and-newcommand for\defvs.\newcommand. – Torbjørn T. Jan 09 '18 at 16:13scopehere and the use ofrotatein the previous question should not work because it does not make sense to rotate a line between two predefined coordinates(A)and(B). – Jan 09 '18 at 16:30