GeoGebra 的代码

GeoGebra 的代码

我在 GeoGebra 上制作了一个图片并将其代码导出到 Overleaf,然后进行编译,但它甚至没有显示 pdf 编译。以下是代码:

\documentclass[10pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{zzttqq}{rgb}{0.6,0.2,0.}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\clip(1.,-2.) rectangle (7.,2.5);
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (3.5529849861247715,1.6224751896453264) -- (2.1080515726119877,-0.9010704902924921) -- (6.208813302510944,-1.1452845883509906) -- cycle;
\draw [line width=2.pt,color=zzttqq] (3.5529849861247715,1.6224751896453264)-- (2.1080515726119877,-0.9010704902924921);
\draw [line width=2.pt,color=zzttqq] (2.1080515726119877,-0.9010704902924921)-- (6.208813302510944,-1.1452845883509906);
\draw [line width=2.pt,color=zzttqq] (6.208813302510944,-1.1452845883509906)-- (3.5529849861247715,1.6224751896453264);
\begin{scriptsize}
\draw [fill=ududff] (3.5529849861247715,1.6224751896453264) circle (2.5pt);
\draw[color=ududff] (4.16860802498057,1.8361625254465128) node {$$\scalebox{1.5} {x_2}$$};
\draw [fill=ududff] (2.1080515726119877,-0.9010704902924921) circle (2.5pt);
\draw[color=ududff] (2.2657731776081014,-1.0028263644835331) node {$$\scalebox{2}{x_1}$$};
\draw [fill=ududff] (6.208813302510944,-1.1452845883509906) circle (2.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}

答案1

Geogebra 生成不良 TiZ 代码,必须进行编辑。

首先要做的事情始终是删除\clip指令和scriptsize伪环境。

也是$$\scalebox{2}{x_2}$$错误的,应该修正。

最好将荒谬的精度降低到小数点后几位,并且标签的位置应该固定。

\documentclass[10pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\pagestyle{empty}

\begin{document}

\definecolor{zzttqq}{rgb}{0.6,0.2,0}
\definecolor{ududff}{rgb}{0.3,0.3,1}

\begin{tikzpicture}[line cap=round,line join=round]
\fill[
  line width=2pt,
  color=zzttqq,
  fill=zzttqq,
  fill opacity=0.1
] (3.55,1.62) -- (2.11,-0.9) -- (6.21,-1.15) -- cycle;
\draw [line width=2pt,color=zzttqq] (3.55,1.62)-- (2.11,-0.9);
\draw [line width=2pt,color=zzttqq] (2.11,-0.9)-- (6.21,-1.15);
\draw [line width=2pt,color=zzttqq] (6.21,-1.15)-- (3.55,1.62);
\draw [fill=ududff] (3.55,1.62) circle (2.5pt);
\draw[color=ududff] (3.55,1.9) node {$x_2$};
\draw [fill=ududff] (2.11,-0.9) circle (2.5pt);
\draw[color=ududff] (2.11,-1.2) node {$x_1$};
\draw [fill=ududff] (6.21,-1.15) circle (2.5pt);
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

这可能有点题外,但我不知道使用 GeoGebra 有什么好处。为顶点定义样式,然后只需使用一个命令即可绘制三角形(并填充它,并将顶点标记为节点)\draw

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}

\begin{document}

\definecolor{zzttqq}{rgb}{0.6,0.2,0}
\definecolor{ududff}{rgb}{0.3,0.3,1}

\tikzset{vertex/.style={circle, inner sep=1.7pt, outer sep=0, fill=ududff, draw=black, thin, label={[ududff]#1}}}

\begin{tikzpicture}
\draw [line width=2pt, color=zzttqq, fill=zzttqq!20] (3.55,1.62)node[vertex=above:$x_2$]{}
    -- (2.11,-0.9)node[vertex=below:$x_1$]{} -- (6.21,-1.15)node[vertex]{} -- cycle;
\end{tikzpicture}

\end{document}

答案3

线路有问题

\draw[color=ududff] (4.16860802498057,1.8361625254465128) node {$$\scalebox{1.5} {x_2}$$};

\draw[color=ududff] (2.2657731776081014,-1.0028263644835331) node {$$\scalebox{2}{x_1}$$};

替换为

\draw[color=ududff] (4.16860802498057,1.8361625254465128) node {\scalebox{1.5}{$x_2$}};

\draw[color=ududff] (2.2657731776081014,-1.0028263644835331) node {\scalebox{2}{$x_1$}};

分别。

相关内容