为什么只有\beta
-\gamma
和\epsilon
-\eta
标签以同一位置为中心,而其他标签却不是?
\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}
答案1
这里有一个解决方案,但在下一个版本中,标记、填充和标签是三种不同的操作
\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}