
我在 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 產生不良 TikZ 程式碼,必須對其進行編輯。
要做的第一件事始終是刪除\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$}};
分別。