diff --git a/doc/generic/pgf/CHANGELOG.md b/doc/generic/pgf/CHANGELOG.md index 38c2280f7..661c2a9a7 100644 --- a/doc/generic/pgf/CHANGELOG.md +++ b/doc/generic/pgf/CHANGELOG.md @@ -20,6 +20,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Resolve missing `gnuplot` plots in manual #1238 - Treat varargs for `min` and `max` in `luamath` pgf-tikz/pgfplots#492 #1359 - Fixed support for the `\tikz` command in the `dvisvgm4ht` driver for TeX4ht +- Support of `name prefix`/`name suffix` for pics `angle` and `right angle` (allows nesting it in other pics), + side-effect: any coordinates are now possibly not just coordinates/nodes #1363 ### Changed diff --git a/doc/generic/pgf/pgfmanual-en-library-angles.tex b/doc/generic/pgf/pgfmanual-en-library-angles.tex index e210cb2d7..ea9eb91c9 100644 --- a/doc/generic/pgf/pgfmanual-en-library-angles.tex +++ b/doc/generic/pgf/pgfmanual-en-library-angles.tex @@ -33,10 +33,6 @@ \section{Angle Library} \end{codeexample} \end{key} - The three points \meta{A}, \meta{B}, and \meta{C} \emph{must} be the names - of nodes or coordinates; you cannot use direct coordinates like ``|(1,1)|'' - here. - You can leave out the three points, in this case the text |A--B--C| is used; so in the above examples we could just have written |{angle}| in the first pic. diff --git a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex index 2d6abbd2e..c1c2f2fcf 100644 --- a/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex +++ b/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibraryangles.code.tex @@ -30,7 +30,7 @@ }% \def\tikz@lib@angle@background#1--#2--#3\pgf@stop{% - \path [name prefix ..] [pic actions, draw=none] (#2.center) + \path [name prefix ..] [pic actions, draw=none] (#2) -- ++(\tikz@start@angle@temp:\tikz@lib@angle@rad pt) arc [start angle=\tikz@start@angle@temp, end angle=\tikz@end@angle@temp, radius=\tikz@lib@angle@rad pt] -- cycle; @@ -38,19 +38,19 @@ \def\tikz@lib@angle@foreground#1--#2--#3\pgf@stop{% \path [name prefix ..] [pic actions, fill=none, shade=none] - ([shift={(\tikz@start@angle@temp:\tikz@lib@angle@rad pt)}]#2.center) + ([shift={(\tikz@start@angle@temp:\tikz@lib@angle@rad pt)}]#2) arc [start angle=\tikz@start@angle@temp, end angle=\tikz@end@angle@temp, radius=\tikz@lib@angle@rad pt]; \ifx\tikzpictext\relax\else% \def\pgf@temp{\node()[name prefix ..,at={([shift={({.5*\tikz@start@angle@temp+.5*\tikz@end@angle@temp}:\pgfkeysvalueof{/tikz/angle - eccentricity}*\tikz@lib@angle@rad pt)}]#2.center)}]} + eccentricity}*\tikz@lib@angle@rad pt)}]#2)}]} \expandafter\pgf@temp\expandafter[\tikzpictextoptions]{\tikzpictext};% \fi }% \def\tikz@lib@rightangle@background#1--#2--#3\pgf@stop{% - \path [name prefix ..] [pic actions, draw=none] (#2.center) + \path [name prefix ..] [pic actions, draw=none] (#2) -- ++(\tikz@start@angle@temp:\tikz@lib@angle@rad pt) -- ++(\tikz@end@angle@temp:\tikz@lib@angle@rad pt) -- ++(\tikz@start@angle@temp:-\tikz@lib@angle@rad pt) @@ -59,41 +59,44 @@ \def\tikz@lib@rightangle@foreground#1--#2--#3\pgf@stop{% \path [name prefix ..] [pic actions, fill=none, shade=none] - ([shift={(\tikz@start@angle@temp:\tikz@lib@angle@rad pt)}]#2.center) + ([shift={(\tikz@start@angle@temp:\tikz@lib@angle@rad pt)}]#2) -- ++(\tikz@end@angle@temp:\tikz@lib@angle@rad pt) -- ++(\tikz@start@angle@temp:-\tikz@lib@angle@rad pt); \ifx\tikzpictext\relax\else% \def\pgf@temp{\node()[name prefix ..,at={([shift={({.5*\tikz@start@angle@temp+.5*\tikz@end@angle@temp}:\pgfkeysvalueof{/tikz/angle - eccentricity}*1.4142136*\tikz@lib@angle@rad pt)}]#2.center)}]} + eccentricity}*1.4142136*\tikz@lib@angle@rad pt)}]#2)}]} \expandafter\pgf@temp\expandafter[\tikzpictextoptions]{\tikzpictext};% \fi }% \def\tikz@lib@angle@parse#1--#2--#3\pgf@stop{% % Compute radius: - \pgfmathsetmacro\tikz@lib@angle@rad{\pgfkeysvalueof{/tikz/angle radius}} - \ifdim\tikz@lib@angle@rad pt>0pt\else\def\tikz@lib@angle@rad{12}\fi% + \pgfmathsetmacro\tikz@lib@angle@rad{\pgfkeysvalueof{/tikz/angle radius}}% + \ifdim\tikz@lib@angle@rad pt>0pt\else\def\tikz@lib@angle@rad{12}\fi % Compute first coordinate: - \pgf@process{\pgfpointanchor{#2}{center}}% - \pgf@xa=\pgf@x% - \pgf@ya=\pgf@y% - \pgf@process{\pgfpointanchor{#1}{center}}% - \pgf@xb=\pgf@x% - \pgf@yb=\pgf@y% - \pgf@process{\pgfpointanchor{#3}{center}}% - \pgf@xc=\pgf@x% - \pgf@yc=\pgf@y% - \advance\pgf@xb by-\pgf@xa% - \advance\pgf@yb by-\pgf@ya% - \advance\pgf@xc by-\pgf@xa% - \advance\pgf@yc by-\pgf@ya% - \pgfmathsetmacro{\tikz@start@angle@temp}{atan2(\the\pgf@yb,\the\pgf@xb)} - \pgfmathsetmacro{\tikz@end@angle@temp}{atan2(\the\pgf@yc,\the\pgf@xc)} - \ifdim\tikz@end@angle@temp pt<\tikz@start@angle@temp pt% - \pgfmathsetmacro{\tikz@start@angle@temp}{\tikz@start@angle@temp-360}% - \fi% -}% + \tikz@scan@@absolute\pgf@process(#2)% + \pgf@xa=\pgf@x + \pgf@ya=\pgf@y + \tikz@scan@@absolute\pgf@process(#1)% + \pgf@xb=\pgf@x + \pgf@yb=\pgf@y + \tikz@scan@@absolute\pgf@process(#3)% + \pgf@xc=\pgf@x + \pgf@yc=\pgf@y + \advance\pgf@xb by-\pgf@xa + \advance\pgf@yb by-\pgf@ya + \advance\pgf@xc by-\pgf@xa + \advance\pgf@yc by-\pgf@ya + \pgfmathatantwo@{\pgf@sys@tonumber\pgf@yb}{\pgf@sys@tonumber\pgf@xb}% + \let\tikz@start@angle@temp\pgfmathresult + \pgfmathatantwo@{\pgf@sys@tonumber\pgf@yc}{\pgf@sys@tonumber\pgf@xc}% + \let\tikz@end@angle@temp\pgfmathresult + \ifdim\tikz@end@angle@temp pt<\tikz@start@angle@temp pt + \pgfmathsubtract@{\tikz@start@angle@temp}{360}% + \let\tikz@start@angle@temp\pgfmathresult + \fi +}