3

Why only \beta-\gamma and \epsilon-\eta labels are centered around the same position and the other labels not?

enter image description here

\PassOptionsToPackage{table, dvipsnames, svgnames, x11names}{xcolor}
\documentclass [a4paper,10pt]{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{pstricks-add}
\usepackage{tikz}
\usepackage{tkz-euclide}
\usepackage{pgfplots}
\usetikzlibrary{calc, intersections, plotmarks, matrix, quotes, angles, mindmap, arrows, folding, shapes, trees, hobby, backgrounds, positioning}
\usetkzobj{all}
\usepackage{tikz-qtree}
\tikzset{edge from parent/.append style={very thick}}
\usepgflibrary{fpu}
\usepgflibrary{shapes.geometric}


\begin{document}

\begin{tikzpicture}
\tkzDefPoint(-4,-3){A} \tkzDefPoint(4,-1){B} \tkzDefPoint(-4,2){C} \tkzDefPoint(4,2){D}  \tkzDefPoint(-1,-4){E}
\tkzDefPoint(1,4){F}
\tkzDrawLine[end=$r$](A,B) \tkzDrawLine[end=$s$](C,D) \tkzDrawLine[end=$t$](E,F)
\tkzInterLL(A,B)(E,F) \tkzGetPoint{G} \tkzInterLL(C,D)(E,F) \tkzGetPoint{H}
{A,B,C,D,E,F,G,H}
\tkzMarkAngles[size=1cm, color=red, fill=purple, fill opacity=0.1](H,G,A E,G,B) 
\tkzLabelAngle(H,G,A){$\varepsilon$} \tkzLabelAngle[below](E,G,B){$\eta$}
\tkzMarkAngles[size=1cm, color=Green, fill=Green, fill opacity=0.1](B,G,F A,G,E) 
\tkzLabelAngle[above](B,G,F){$\zeta$} \tkzLabelAngle[below](A,G,E){$\theta$}
\tkzMarkAngles[size=1cm, color=orange, fill=Gold, fill opacity=0.1](C,H,G D,H,F) 
\tkzLabelAngle(C,H,G){$\gamma$} \tkzLabelAngle[above](D,H,F){$\beta$}
\tkzMarkAngles[size=1cm, color=blue, fill=blue, fill opacity=0.1](F,H,C G,H,D)
\tkzLabelAngle[left](F,H,C){$\alpha$} \tkzLabelAngle[below](G,H,D){$\delta$}
\end{tikzpicture}

\end{document}
2
  • bad and good news. Bad it's a bug and the good one : no problem with the new version. You can find a solution here tex.stackexchange.com/questions/151667/…. The update version is not finished but perhaps I will put the beta on my site in several days. Commented Apr 19, 2016 at 18:14
  • About your code : no need to load Tikz, euclide loads tikz then it's preferable to use some styles to simplify your code in tkzMarkAngles Commented Apr 19, 2016 at 18:19

1 Answer 1

3

here a solution but in the next version mark , fill and label are three different operations

\PassOptionsToPackage{table, dvipsnames, svgnames, x11names}{xcolor}
\documentclass [a4paper,10pt]{book}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
%\usepackage{pstricks-add} ? are you sure ??
\usepackage{tkz-euclide}
\usepackage{pgfplots}
\usetikzlibrary{calc, intersections, plotmarks, matrix, quotes, angles, mindmap, arrows, folding, shapes, trees, hobby, backgrounds, positioning}
\usetkzobj{all}
\usepackage{tikz-qtree}
\tikzset{edge from parent/.append style={very thick}}
\usepgflibrary{fpu}
\usepgflibrary{shapes.geometric}

\makeatletter
%<--------------------------------------------------------------------------–>
% thanks karu : http://tex.stackexchange.com/questions/151667/tkzgetangle-strange-behavior/196224#196224  \tkzGetAngle strange behavior
% defines \tkz@FirstAngle and \tkz@SecondAngle sens  trigo
%<--------------------------------------------------------------------------–>
 \def\tkzNormalizeAngle(#1,#2){%
 \begingroup
   \pgfmathparse{#1}\xdef\tkz@FirstAngle{\pgfmathresult}%
   \pgfmathparse{#2}\xdef\tkz@SecondAngle{\pgfmathresult}%
   \pgfmathgreaterthan{\tkz@FirstAngle}{0}
   \ifdim\pgfmathresult pt=1 pt\relax%
     \pgfmathgreaterthan{\tkz@FirstAngle}{\tkz@SecondAngle}
     \ifdim\pgfmathresult pt=1 pt\relax%
       \pgfmathsubtract{\tkz@FirstAngle}{360}
       \xdef\tkz@FirstAngle{\pgfmathresult}%
     \fi
   \else
     \pgfmathgreaterthan{\tkz@FirstAngle}{\tkz@SecondAngle}
     \ifdim\pgfmathresult pt=1 pt\relax%
            \pgfmathadd{\tkz@SecondAngle}{360}
            \xdef\tkz@SecondAngle{\pgfmathresult}%
     \fi
   \fi
 \endgroup
 }  

%<------------------------- Label on angle -------------------------------–>
\pgfkeys{/tkzlabelangle/.cd,
        dist/.store in                  = \labeldist, 
        angle/.store in                 = \labelangle, 
        dist                            = 1,
        angle                           = {},
  /tkzlabelangle/.search also={/tikz}   
}


\def\tkzLabelAngle{\pgfutil@ifnextchar[{\tkz@LabelAngle}{\tkz@LabelAngle[]}}
\def\tkz@LabelAngle[#1](#2,#3,#4)#5{%2016 added normalize from karu's code
\begingroup
  \pgfqkeys{/tkzlabelangle}{#1}
  \let\labelAngle\labelangle
  \ifx\tkzutil@empty\labelangle% no value so calc angle of bisector
        \tkzFindSlopeAngle(#3,#2)\tkzGetAngle{tkz@dirOne}
        \tkzFindSlopeAngle(#3,#4)\tkzGetAngle{tkz@dirTwo}
        \tkzNormalizeAngle(\tkz@dirOne,\tkz@dirTwo)
        \FPeval\labelAngle{(\tkz@FirstAngle +\tkz@SecondAngle)/2}
  \fi
  \path (#3) --+(\labelAngle:\labeldist) node[#1] {#5};
\endgroup
}

\makeatother


\begin{document}

\begin{tikzpicture}[markstyle/.style={size=1cm, draw=#1, fill=#1!50, fill opacity=0.1}]


\tkzDefPoint(-4,-3){A} \tkzDefPoint(4,-1){B} \tkzDefPoint(-4,2){C} \tkzDefPoint(4,2){D}  \tkzDefPoint(-1,-4){E}
\tkzDefPoint(1,4){F}
\tkzDrawLine[end=$r$](A,B) \tkzDrawLine[end=$s$](C,D) \tkzDrawLine[end=$t$](E,F)
\tkzInterLL(A,B)(E,F) \tkzGetPoint{G} \tkzInterLL(C,D)(E,F) \tkzGetPoint{H}
{A,B,C,D,E,F,G,H}

\tkzMarkAngles[markstyle={red}](H,G,A E,G,B) 
\tkzLabelAngle(H,G,A){$\varepsilon$} 
\tkzLabelAngle[below](E,G,B){$\eta$}
\tkzMarkAngles[markstyle={green}](B,G,F A,G,E) 
\tkzLabelAngle[above](B,G,F){$\zeta$} 
\tkzLabelAngle[below](A,G,E){$\theta$}
\tkzMarkAngles[markstyle={orange}](C,H,G D,H,F) 
\tkzLabelAngle(C,H,G){$\gamma$} 
\tkzLabelAngle[above](D,H,F){$\beta$}
\tkzMarkAngles[markstyle={blue}](F,H,C G,H,D)
\tkzLabelAngle[left](F,H,C){$\alpha$} 
\tkzLabelAngle[below](G,H,D){$\delta$}
\end{tikzpicture}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .