TransWikia.com

Why doesn't a code from an answer compile?

TeX - LaTeX Asked on April 15, 2021

There was a good answer about naming angles here: https://tex.stackexchange.com/a/55555/227339

I try to run it on my computer, but I get these errors:

enter image description here

As I understood, the problem is that name path=circle inside the scope is local, so I need to use name path global instead.

And yes, this code compiles and runs:

documentclass{standalone}
usepackage{tikz}
usetikzlibrary{calc,intersections} 

newcommandmarkangle[6][red]{% [color] {X} {origin} {Y} {mark} {radius}
  % filled circle: red by default
  begin{scope}
    path[clip] (#2) -- (#3) -- (#4);
    fill[color=#1,fill opacity=0.5,draw=#1,name path global=circle]
    (#3) circle (#6mm);
  end{scope}
  % middle calculation
  path[name path=line one] (#3) -- (#2);
  path[name path=line two] (#3) -- (#4);
  path[%
  name intersections={of=line one and circle, by={inter one}},
  name intersections={of=line two and circle, by={inter two}}
  ] (inter one) -- (inter two) coordinate[pos=.5] (middle);
  % bissectrice definition
  path[%
  name path=bissectrice
  ] (#3) -- (barycentric cs:#3=-1,middle=1.2);
  % put mark
  path[
  name intersections={of=bissectrice and circle, by={middleArc}}
  ] (#3) -- (middleArc) node[pos=1.3] {#5};
  }

begin{document}
begin{tikzpicture}
coordinate[label=below left:$A$] (A) at (0,0);
coordinate[label=below right:$B$] (B) at (2,0);
coordinate[label=above:$C$] (C) at (5,5);

draw[thick] (B) -- (A) -- (C) -- cycle;

markangle{A}{B}{C}{$beta$}{5}
markangle[blue]{B}{A}{C}{$alpha$}{6}
markangle[green]{B}{C}{A}{$gamma$}{12}
end{tikzpicture}

end{document}

But if I’m right, name math global forces me to use unique path names through the entire document. That is really inconvenient inside large projects.

Then I remember: the original code from the answer doesn’t have "global" option! It means, it can be compiled, but why do I get errors?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP