2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/documents/GeoTopo/figures/topology-3.tex

86 lines
No EOL
2.5 KiB
TeX

\newenvironment{customlegend}[1][]{%
\begingroup
% inits/clears the lists (which might be populated from previous
% axes):
\csname pgfplots@init@cleared@structures\endcsname
\pgfplotsset{#1}%
}{%
% draws the legend:
\csname pgfplots@createlegend\endcsname
\endgroup
}%
% makes \addlegendimage available (typically only available within an
% axis environment):
\def\addlegendimage{\csname pgfplots@addlegendimage\endcsname}
%%--------------------------------
% definition to insert numbers
\pgfkeys{/pgfplots/number in legend/.style={%
/pgfplots/legend image code/.code={%
\node at (0.295,-0.0225){#1};
},%
},
}
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
\begin{tikzpicture}
\tkzSetUpPoint[shape=circle,size=10,color=black,fill=black]
\tkzDefPoints{0/0/A, 2/0/B, 3/0.5/C, 0/3/D, 2/3/E, 3/1.5/F, 2/2/G, 1/1.5/H}
\begin{pgfonlayer}{foreground}
%Get intersections
\tkzInterLL(B,H)(A,C) \tkzGetPoint{I}
\tkzInterLL(B,F)(A,C) \tkzGetPoint{J}
\tkzInterLL(A,G)(B,H) \tkzGetPoint{K}
\tkzInterLL(A,G)(H,F) \tkzGetPoint{L}
\tkzInterLL(C,G)(B,F) \tkzGetPoint{M}
\tkzInterLL(C,G)(H,F) \tkzGetPoint{N}
\tkzInterLL(G,D)(H,E) \tkzGetPoint{O}
\tkzDrawPoints[color=green,fill=green](A,C,G,D)
\tkzDrawPoints[color=blue,fill=blue](B,F,E,H)
\tkzDrawPoints[color=red,fill=red](I,J,K,L,M,N,O)
\end{pgfonlayer}
\tkzDrawPolygon[blue,very thick](H,E,F,B)
\tkzDrawSegment[blue,very thick](H,F)
\tkzDrawPolygon[green,very thick](A,D,G,C)
\tkzDrawSegment[green,very thick](A,G)
\tkzDrawSegments[red,very thick](I,M I,N I,L A,H H,D L,O N,E G,E)
% \tkzLabelPoint(A){A}
% \tkzLabelPoint(B){B}
% \tkzLabelPoint(C){C}
% \tkzLabelPoint(D){D}
% \tkzLabelPoint(E){E}
% \tkzLabelPoint(F){F}
% \tkzLabelPoint(G){G}
% \tkzLabelPoint(H){H}
% \tkzLabelPoint(I){I}
% \tkzLabelPoint(J){J}
% \tkzLabelPoint(K){K}
% \tkzLabelPoint(L){L}
% \tkzLabelPoint(M){M}
% \tkzLabelPoint(N){N}
% \tkzLabelPoint(O){O}
\begin{customlegend}[
legend entries={
$T_1$,
$T_2$,
$T$
},
legend style={at={(4.5,3.5)},font=\footnotesize}] % <= to define position and font legend
% the following are the "images" and numbers in the legend
\addlegendimage{blue,very thick}
\addlegendimage{green,very thick}
\addlegendimage{red,very thick}
\end{customlegend}
\end{tikzpicture}