我的问题是:该图形在 Geogebra 上看起来不错,但导出到 Tikz 代码并导入到 LaTex 后,它很丑陋,并且在点、线以及点或线的名称之间堆积了一些。
这是 Geogebra 上的图片:
以下是 MWE:
\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm,scale=0.5]
\draw (2,2)-- (0,-2);
\draw (0,-2)-- (8,-2);
\draw (8,-2)-- (10,2);
\draw (10,2)-- (2,2);
\draw (2,2)-- (2.94,0.52);
\draw (2.94,0.52)-- (0,-2);
\draw (2.94,0.52)-- (9.25,0.5);
\begin{scriptsize}
\fill [color=black] (2,2) circle (0.5pt);
\draw[color=black] (2.16,2.18) node {$A$};
\fill [color=black] (0,-2) circle (0.5pt);
\draw[color=black] (0,-2.24) node {$B$};
\fill [color=black] (8,-2) circle (0.5pt);
\draw[color=black] (8.1,-2.24) node {$C$};
\fill [color=black] (10,2) circle (0.5pt);
\draw[color=black] (10.16,2.18) node {$D$};
\fill [color=black] (2.94,0.52) circle (0.5pt);
\draw[color=black] (3.18,0.84) node {$X$};
\fill [color=black] (9.25,0.5) circle (0.5pt);
\draw[color=black] (9.4,0.36) node {$Y=Z$};
\end{scriptsize}
\end{tikzpicture}
\end{document}
那么,我该如何修复它?如何像在 Geogebra 中一样正确放置点的名称?
请帮我。
谢谢。
答案1
我认为您无法通过从 Geogebra 导出获得相同的输出。您必须手动编辑源。
我使用节点锚点将标签放在所需点旁边。请参阅17.5 定位节点在 TikZ 和 PGF 手册(版本 3.0.0)中。
\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm,scale=0.5]
\draw (2,2)-- (0,-2);
%\draw (0,-2)-- (8,-2);
\draw (8,-2)-- (10,2);
\draw (10,2)-- (2,2);
\draw (2,2)-- (2.94,0.5);
\draw (2.94,0.5)-- (0,-2);
\draw (2.94,0.5)-- (9.25,0.5);
\begin{scriptsize}
\fill [color=black] (2,2) circle (0.5pt);
\fill [color=black] (0,-2) circle (0.5pt);
\fill [color=black] (8,-2) circle (0.5pt);
\fill [color=black] (10,2) circle (0.5pt);
\fill [color=black] (2.94,0.5) circle (0.5pt);
\fill [color=black] (9.25,0.5) circle (0.5pt);
\draw[color=black, anchor=south] (2,2) node {$A$};
\draw[color=black, anchor=north] (0,-2) node {$B$};
\draw[color=black, anchor=north] (8,-2) node {$C$};
\draw[color=black, anchor=south] (10,2) node {$D$};
\draw[color=black, anchor=south west] (2.94,0.5) node {$X$};
\draw[color=black, anchor=west] (9.25,0.5) node {$Y=Z$};
\draw (0,-2) -- node[above] {h.3a} ++(8,0);
\end{scriptsize}
\end{tikzpicture}
\end{document}