
Es kommt selten vor, dass ich bei ChatGPT und Google nach einer Lösung für ein Problem suche und absolut nichts finde, das das Problem auch nur im Entferntesten erwähnt. Vielleicht bin ich einfach schrecklich im Suchen.
Im folgenden Code habe ich vier Miniseiten, die verschiedene Arten von Dreiecken anzeigen. Ich verwende tkx-euclide-Befehle in den gleichschenkligen und gleichseitigen Dreiecken (aber nicht in den ungleichseitigen). Beide Diagramme werden zentriert und vertikal verschoben. Ich möchte sie weder zentriert noch vertikal verschoben haben. Ich brauche also eine Lösung für das Problem. Ich denke, die \tkzLabelAngle-Befehle verursachen das Problem, aber ich brauche eine Möglichkeit, diesen Befehl ohne Positionierungsprobleme zu verwenden.
Danke
\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Scalene Triangle}}
\newline\newline
\begin{tikzpicture}
\draw (0,0) -- (1,2) -- (3,1.75) -- (0,0);
\end{tikzpicture}
\end{minipage}
\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Isosceles Triangle}}
\newline\newline
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (4,0);
\coordinate (C) at (2,1.5);
\draw (0,0) -- (4,0) -- (2,1.5) -- (0,0);
\tkzMarkSegment[color=black,pos=.5,mark=|](A,C)
\tkzMarkSegment[color=black,pos=.5,mark=|](B,C)
\tkzLabelAngle[pos=-0.33](C,A,B){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\end{tikzpicture}
\end{minipage}
\newline\newline
\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Equilateral Triangle}}
\newline\newline
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (3,0);
\coordinate (C) at (1.5,{1.5*sqrt(3)});
\draw (A) -- (B) -- (C) -- cycle;
\tkzLabelAngle[pos=-0.33](C,A,B){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\tkzLabelAngle[pos=-0.33](B,C,A){$\circ$}
\end{tikzpicture}
\end{minipage}
\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Right Triangle}}
\newline\newline
\begin{tikzpicture}
\end{tikzpicture}
\end{minipage}
Antwort1
Es ist besser, sie alle in einem einzigen Tikz-Bild mit unterschiedlichen Werten zu zeichnen scope
und sie mit unterschiedlichen shift
Werten zu platzieren. Ich glaube, der negative pos
Schlüsselwert könnte zu einem größeren Begrenzungsrahmen führen. Es ist besser, wenn möglich positive Werte zu verwenden.
\documentclass{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\draw (0,0) -- (1,2) -- (3,1.75) -- cycle;
\node at (1.5,2) [above=0.5cm] {\textsf{\textbf{Scalene Triangle}}};
\end{scope}
\begin{scope}[xshift=6cm]
\coordinate (A) at (0,0);
\coordinate (B) at (4,0);
\coordinate (C) at (2,1.5);
\draw (0,0) -- (4,0) -- (2,1.5) -- cycle;
\tkzMarkSegment[color=black,pos=.5,mark=|](A,C)
\tkzMarkSegment[color=black,pos=.5,mark=|](B,C)
\tkzLabelAngle[pos=-0.33](C,A,B){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\node at (C) [above=1cm] {\textsf{\textbf{Isosceles Triangle}}};
\end{scope}
\begin{scope}[yshift=-4cm]
\coordinate (A) at (0,0);
\coordinate (B) at (3,0);
\coordinate (C) at (1.5,{1.5*sqrt(3)});
\draw (A) -- (B) -- (C) -- cycle;
\tkzLabelAngle[pos=0.33](B,A,C){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\tkzLabelAngle[pos=0.33](A,C,B){$\circ$}
\node at (C) [above=0.5cm] {\textsf{\textbf{Equilateral Triangle}}};
\end{scope}
\begin{scope}[shift={(6.5cm,-4cm)}]
\coordinate (A) at (0,0);
\coordinate (B) at (3,0);
\coordinate (C) at (3,{1.5*sqrt(3)});
\draw (A) -- (B) -- (C) -- cycle;
\node at (1.5,{1.5*sqrt(3)}) [above=0.5cm] {\textsf{\textbf{Right Triangle}}};
\end{scope}
\end{tikzpicture}
\end{document}
##############################################################################
Hier ist ein Beispiel, das zeigt, dass ein negativer
pos
Wert den Begrenzungsrahmen vergrößert. Dieselbe Zeichnung, aber der negativepos
Wert bewirkt, dass der untere linke und obere Winkel einen größeren Begrenzungsrahmen haben.
\documentclass{report}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (3,0);
\coordinate (C) at (1.5,{1.5*sqrt(3)});
\draw (A) -- (B) -- (C) -- cycle;
\tkzLabelAngle[pos=0.33](B,A,C){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\tkzLabelAngle[pos=0.33](A,C,B){$\circ$}
\draw (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (3,0);
\coordinate (C) at (1.5,{1.5*sqrt(3)});
\draw (A) -- (B) -- (C) -- cycle;
\tkzLabelAngle[pos=-0.33](C,A,B){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\tkzLabelAngle[pos=-0.33](B,C,A){$\circ$}
\draw (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}
\end{document}
Verwenden Sie
minipage
mit positivempos
Wert und\noindent
für die erste Zeile. Entsprach die Ausgabe Ihren Erwartungen? Ich verwende diereport
Dokumentklasse als Beispiel und zeige den Rahmen für die Seite.
\documentclass{report}
\usepackage{showframe}
\usepackage{tkz-euclide}
\begin{document}
\noindent\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Scalene Triangle}}
\newline\newline
\begin{tikzpicture}
\draw (0,0) -- (1,2) -- (3,1.75) -- (0,0);
\end{tikzpicture}
\end{minipage}
\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Isosceles Triangle}}
\newline\newline
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (4,0);
\coordinate (C) at (2,1.5);
\draw (0,0) -- (4,0) -- (2,1.5) -- (0,0);
\tkzMarkSegment[color=black,pos=.5,mark=|](A,C)
\tkzMarkSegment[color=black,pos=.5,mark=|](B,C)
\tkzLabelAngle[pos=0.33](B,A,C){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\end{tikzpicture}
\end{minipage}
\newline\newline
\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Equilateral Triangle}}
\newline\newline
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (3,0);
\coordinate (C) at (1.5,{1.5*sqrt(3)});
\draw (A) -- (B) -- (C) -- cycle;
\tkzLabelAngle[pos=0.33](B,A,C){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\tkzLabelAngle[pos=0.33](A,C,B){$\circ$}
\end{tikzpicture}
\end{minipage}
\begin{minipage}[t]{0.475\linewidth}
\textsf{\textbf{Right Triangle}}
\newline\newline
\begin{tikzpicture}
\end{tikzpicture}
\end{minipage}
\end{document}
Antwort2
- Erste Lösung. Sie arbeiten nicht speziell mit tkz-euclide. Sie mischen es mit TikZ und es ist nicht gut.
Sie verwenden keine negativen Werte, pos
weil, wie Tom sagt, Sie den Begrenzungsrahmen vergrößern.
Mit Clip können Sie die bbox steuern (siehe 2 )
\begin{tikzpicture}
\tkzDefPoints{0/0/A,3/0/B}
\tkzDefTriangle[equilateral](A,B)\tkzGetPoint{C}
\tkzDrawPolygon(A,B,C)
\tkzLabelAngle[pos=0.33](B,A,C){$\circ$}
\tkzLabelAngle[pos=0.33](C,B,A){$\circ$}
\tkzLabelAngle[pos=0.33](A,C,B){$\circ$}
\end{tikzpicture}
Sie können die bbox steuern mit
\tkzClipPolygon(A,B,C)
\begin{tikzpicture} \coordinate (A) at (0,0); \coordinate (B) at (3,0); \coordinate (C) at (1.5,{1.5*sqrt(3)}); \draw (A) -- (B) -- (C) -- cycle; \tkzClipPolygon(A,B,C) \tkzLabelAngle[pos=-0.33](C,A,B){$\circ$} \tkzLabelAngle[pos=0.33](C,B,A){$\circ$} \tkzLabelAngle[pos=-0.33](B,C,A){$\circ$} \end{tikzpicture}