我从 Geogebra 生成了以下代码,但不知为何它无法工作。我在 Overleaf 中收到大量错误消息,我感到有点不知所措。如果您能提供任何关于可能出错的信息,我将不胜感激。这是 Geogebra 编写的代码。首先我想确保它能正常工作,然后对代码进行一些调整,让它变得更好,但我没有这样做。
\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{ffqqqq}{rgb}{1.,0.,0.}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq,, xstep=1.0cm,ystep=1.0cm] (10.969178552918187,3.9448398510122127) grid (17.036551252400248,8.104667345732874);
\clip(10.969178552918187,3.9448398510122127) rectangle (17.036551252400248,8.104667345732874);
\fill[line width=2.4pt] (4.,8.) -- (5.,7.) -- (4.,6.) -- (5.,5.) -- (4.,4.) -- (6.,4.) -- (7.,3.) -- (8.,4.) -- (8.,8.) -- (7.,9.) -- (6.,8.) -- cycle;
\fill[line width=2.4pt] (12.,7.) -- (13.,8.) -- (15.,8.) -- (16.,7.) -- (16.,5.) -- (17.,4.) -- (11.,4.) -- (12.,5.) -- cycle;
\fill[line width=2.4pt,fill=black,fill opacity=0.10000000149011612] (5.,12.) -- (7.,13.) -- (8.,12.) -- (9.,12.) -- (9.,14.) -- (10.,15.) -- (9.,16.) -- (7.934442391472151,15.863351386094383) -- (6.934442391472151,14.863351386094383) -- (5.,16.) -- (5.,14.) -- (6.,13.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (12.,8.) -- (12.,7.) -- (13.,8.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (12.,5.) -- (12.,4.) -- (11.,4.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (16.,5.) -- (16.,4.) -- (17.,4.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (16.,7.) -- (16.,8.) -- (15.,8.) -- cycle;
\draw [line width=2.4pt] (4.,8.)-- (5.,7.);
\draw [line width=2.4pt] (5.,7.)-- (4.,6.);
\draw [line width=2.4pt] (4.,6.)-- (5.,5.);
\draw [line width=2.4pt] (5.,5.)-- (4.,4.);
\draw [line width=2.4pt] (4.,4.)-- (6.,4.);
\draw [line width=2.4pt] (6.,4.)-- (7.,3.);
\draw [line width=2.4pt] (7.,3.)-- (8.,4.);
\draw [line width=2.4pt] (8.,4.)-- (8.,8.);
\draw [line width=2.4pt] (8.,8.)-- (7.,9.);
\draw [line width=2.4pt] (7.,9.)-- (6.,8.);
\draw [line width=2.4pt] (6.,8.)-- (4.,8.);
\draw [line width=2.4pt] (12.,7.)-- (13.,8.);
\draw [line width=2.4pt] (13.,8.)-- (15.,8.);
\draw [line width=2.4pt] (15.,8.)-- (16.,7.);
\draw [line width=2.4pt] (16.,7.)-- (16.,5.);
\draw [line width=2.4pt] (16.,5.)-- (17.,4.);
\draw [line width=2.4pt] (17.,4.)-- (11.,4.);
\draw [line width=2.4pt] (11.,4.)-- (12.,5.);
\draw [line width=2.4pt] (12.,5.)-- (12.,7.);
\draw [line width=2.4pt] (5.,12.)-- (7.,13.);
\draw [line width=2.4pt] (7.,13.)-- (8.,12.);
\draw [line width=2.4pt] (8.,12.)-- (9.,12.);
\draw [line width=2.4pt] (9.,12.)-- (9.,14.);
\draw [line width=2.4pt] (9.,14.)-- (10.,15.);
\draw [line width=2.4pt] (10.,15.)-- (9.,16.);
\draw [line width=2.4pt] (9.,16.)-- (7.934442391472151,15.863351386094383);
\draw [line width=2.4pt] (7.934442391472151,15.863351386094383)-- (6.934442391472151,14.863351386094383);
\draw [line width=2.4pt] (6.934442391472151,14.863351386094383)-- (5.,16.);
\draw [line width=2.4pt] (5.,16.)-- (5.,14.);
\draw [line width=2.4pt] (5.,14.)-- (6.,13.);
\draw [line width=2.4pt] (6.,13.)-- (5.,12.);
\draw [line width=2.4pt,color=ffqqqq] (6.934442391472151,14.863351386094385)-- (9.,16.);
\draw [line width=2.4pt,color=ffqqqq] (5.,14.)-- (5.,12.);
\draw [line width=2.4pt,color=ffqqqq] (5.,12.)-- (8.,12.);
\draw [line width=2.4pt,color=ffqqqq] (9.,14.)-- (9.,16.);
\draw (6.912772183756885,16.412831099000936) node[anchor=north west] {\textbf{T_1}};
\draw (9.19952818223592,15.068356466729343) node[anchor=north west] {\textbf{T_2}};
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {\textbf{T_1}};
\draw (5.131630576901355,13.045898900235319) node[anchor=north west] {\textbf{T_2}};
\draw [line width=2.pt,color=ffqqqq] (6.,8.)-- (8.,8.);
\draw [line width=2.pt,color=ffqqqq] (6.,4.)-- (8.,4.);
\draw [line width=2.pt,color=ffqqqq] (4.,4.)-- (4.,8.);
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {\textbf{T_1}};
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {\textbf{T_1}};
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {\textbf{T_1}};
\draw (4.108910557481083,5.025016051298794) node[anchor=north west] {\textbf{T_1}};
\draw (4.143384266000868,7.116421034832386) node[anchor=north west] {\textbf{T_1}};
\draw (6.809351058197531,8.403439486237673) node[anchor=north west] {\textbf{T_1}};
\draw (6.809351058197531,3.6230852381608907) node[anchor=north west] {\textbf{T_1}};
\draw [line width=2.pt,color=ffqqqq] (12.,7.)-- (12.,8.);
\draw [line width=2.pt,color=ffqqqq] (12.,8.)-- (13.,8.);
\draw [line width=2.pt,color=ffqqqq] (12.,5.)-- (12.,4.);
\draw [line width=2.pt,color=ffqqqq] (16.,5.)-- (16.,4.);
\draw [line width=2.pt,color=ffqqqq] (15.,8.)-- (16.,8.);
\draw [line width=2.pt,color=ffqqqq] (16.,8.)-- (16.,7.);
\end{tikzpicture}
\end{document}
任何帮助都值得感激。谢谢。
答案1
下划线字符用于制作下标,但它仅在数学模式下有效。这就是您的代码抛出错误的原因missing $
。因此,按照 Ignasi 的建议更改T_1
为$T_1$
可以解决该问题。
但是,单单是这个改变就会让代码\textbf{$T_1$}
看起来有点奇怪,如果T
应该加粗,那么我会使用$\mathbf{T}_1$
。如果不需要,就只使用$T_1$
,不用\textbf{}
。
这些文本以及图表中大部分其他部分消失的原因是环境\clip
中的第二行指令tikzpicture
。如果删除该行,则会得到以下内容:
\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{ffqqqq}{rgb}{1.,0.,0.}
\definecolor{cqcqcq}{rgb}{0.7529411764705882,0.7529411764705882,0.7529411764705882}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [color=cqcqcq,, xstep=1.0cm,ystep=1.0cm] (10.969178552918187,3.9448398510122127) grid (17.036551252400248,8.104667345732874);
%\clip(10.969178552918187,3.9448398510122127) rectangle (17.036551252400248,8.104667345732874);
\fill[line width=2.4pt] (4.,8.) -- (5.,7.) -- (4.,6.) -- (5.,5.) -- (4.,4.) -- (6.,4.) -- (7.,3.) -- (8.,4.) -- (8.,8.) -- (7.,9.) -- (6.,8.) -- cycle;
\fill[line width=2.4pt] (12.,7.) -- (13.,8.) -- (15.,8.) -- (16.,7.) -- (16.,5.) -- (17.,4.) -- (11.,4.) -- (12.,5.) -- cycle;
\fill[line width=2.4pt,fill=black,fill opacity=0.10000000149011612] (5.,12.) -- (7.,13.) -- (8.,12.) -- (9.,12.) -- (9.,14.) -- (10.,15.) -- (9.,16.) -- (7.934442391472151,15.863351386094383) -- (6.934442391472151,14.863351386094383) -- (5.,16.) -- (5.,14.) -- (6.,13.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (12.,8.) -- (12.,7.) -- (13.,8.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (12.,5.) -- (12.,4.) -- (11.,4.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (16.,5.) -- (16.,4.) -- (17.,4.) -- cycle;
\fill[line width=2.pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612] (16.,7.) -- (16.,8.) -- (15.,8.) -- cycle;
\draw [line width=2.4pt] (4.,8.)-- (5.,7.);
\draw [line width=2.4pt] (5.,7.)-- (4.,6.);
\draw [line width=2.4pt] (4.,6.)-- (5.,5.);
\draw [line width=2.4pt] (5.,5.)-- (4.,4.);
\draw [line width=2.4pt] (4.,4.)-- (6.,4.);
\draw [line width=2.4pt] (6.,4.)-- (7.,3.);
\draw [line width=2.4pt] (7.,3.)-- (8.,4.);
\draw [line width=2.4pt] (8.,4.)-- (8.,8.);
\draw [line width=2.4pt] (8.,8.)-- (7.,9.);
\draw [line width=2.4pt] (7.,9.)-- (6.,8.);
\draw [line width=2.4pt] (6.,8.)-- (4.,8.);
\draw [line width=2.4pt] (12.,7.)-- (13.,8.);
\draw [line width=2.4pt] (13.,8.)-- (15.,8.);
\draw [line width=2.4pt] (15.,8.)-- (16.,7.);
\draw [line width=2.4pt] (16.,7.)-- (16.,5.);
\draw [line width=2.4pt] (16.,5.)-- (17.,4.);
\draw [line width=2.4pt] (17.,4.)-- (11.,4.);
\draw [line width=2.4pt] (11.,4.)-- (12.,5.);
\draw [line width=2.4pt] (12.,5.)-- (12.,7.);
\draw [line width=2.4pt] (5.,12.)-- (7.,13.);
\draw [line width=2.4pt] (7.,13.)-- (8.,12.);
\draw [line width=2.4pt] (8.,12.)-- (9.,12.);
\draw [line width=2.4pt] (9.,12.)-- (9.,14.);
\draw [line width=2.4pt] (9.,14.)-- (10.,15.);
\draw [line width=2.4pt] (10.,15.)-- (9.,16.);
\draw [line width=2.4pt] (9.,16.)-- (7.934442391472151,15.863351386094383);
\draw [line width=2.4pt] (7.934442391472151,15.863351386094383)-- (6.934442391472151,14.863351386094383);
\draw [line width=2.4pt] (6.934442391472151,14.863351386094383)-- (5.,16.);
\draw [line width=2.4pt] (5.,16.)-- (5.,14.);
\draw [line width=2.4pt] (5.,14.)-- (6.,13.);
\draw [line width=2.4pt] (6.,13.)-- (5.,12.);
\draw [line width=2.4pt,color=ffqqqq] (6.934442391472151,14.863351386094385)-- (9.,16.);
\draw [line width=2.4pt,color=ffqqqq] (5.,14.)-- (5.,12.);
\draw [line width=2.4pt,color=ffqqqq] (5.,12.)-- (8.,12.);
\draw [line width=2.4pt,color=ffqqqq] (9.,14.)-- (9.,16.);
\draw (6.912772183756885,16.412831099000936) node[anchor=north west] {$\mathbf{T}_1$};
\draw (9.19952818223592,15.068356466729343) node[anchor=north west] {$\mathbf{T}_2$};
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {$\mathbf{T}_1$};
\draw (5.131630576901355,13.045898900235319) node[anchor=north west] {$\mathbf{T}_2$};
\draw [line width=2.pt,color=ffqqqq] (6.,8.)-- (8.,8.);
\draw [line width=2.pt,color=ffqqqq] (6.,4.)-- (8.,4.);
\draw [line width=2.pt,color=ffqqqq] (4.,4.)-- (4.,8.);
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {$\mathbf{T}_1$};
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {$\mathbf{T}_1$};
\draw (6.614000043252086,12.390898438359413) node[anchor=north west] {$\mathbf{T}_1$};
\draw (4.108910557481083,5.025016051298794) node[anchor=north west] {$\mathbf{T}_1$};
\draw (4.143384266000868,7.116421034832386) node[anchor=north west] {$\mathbf{T}_1$};
\draw (6.809351058197531,8.403439486237673) node[anchor=north west] {$\mathbf{T}_1$};
\draw (6.809351058197531,3.6230852381608907) node[anchor=north west] {$\mathbf{T}_1$};
\draw [line width=2.pt,color=ffqqqq] (12.,7.)-- (12.,8.);
\draw [line width=2.pt,color=ffqqqq] (12.,8.)-- (13.,8.);
\draw [line width=2.pt,color=ffqqqq] (12.,5.)-- (12.,4.);
\draw [line width=2.pt,color=ffqqqq] (16.,5.)-- (16.,4.);
\draw [line width=2.pt,color=ffqqqq] (15.,8.)-- (16.,8.);
\draw [line width=2.pt,color=ffqqqq] (16.,8.)-- (16.,7.);
\end{tikzpicture}
\end{document}