Geogebra 的 LaTeX 代码无法编译

Geogebra 的 LaTeX 代码无法编译

我需要从 Geogebra 导出图表,编译返回以下错误:

(/usr/local/texlive/2022/texmf-dist/tex/latex/jknapltx/ursfs.fd)
./ggb.tex:29: Missing number, treated as zero.
<to be read again> 
                   n
l.29 \end{axis}

只要我评论以 \draw 开头的两行,编译就可以正常工作。

你能帮助我了解如何解决这个问题吗?

多谢!

\documentclass[10pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{zzttff}{rgb}{0.6,0.2,1}
\definecolor{ffvvqq}{rgb}{1,0.3333333333333333,0}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-10.400000000000004,
xmax=11.24,
ymin=-8.730000000000004,
ymax=6.370000000000003,
xtick={-10,-9,...,11},
ytick={-8,-7,...,6},]
\clip(-10.4,-8.73) rectangle (11.24,6.37);
%\draw[line width=2pt,color=ffvvqq,smooth,samples=100,domain=-10.400000000000004:11.24] plot(\x,{2*((\x)-1)^(1/(3))+1});
%\draw[line width=2pt,color=zzttff,smooth,samples=100,domain=-10.400000000000004:11.24] plot(\x,{((\x))^(1/(3))});
\begin{scriptsize}
\draw[color=ffvvqq] (-10.16,-3.24) node {$g$};
\draw[color=zzttff] (-10.16,-1.94) node {$f$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}

答案1

如果您不想深入编码,有一个快速的解决方法:

立方根

\documentclass[border=3.14pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{zzttff}{rgb}{0.6,0.2,1}
\definecolor{ffvvqq}{rgb}{1,0.3333333333333333,0}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-10.5,
xmax=11.5,
ymin=-8.5,
ymax=6.5,
xtick={-10,-9,...,11},
ytick={-8,-7,...,6},]
\clip(-10,-8) rectangle (11,6);

\draw[line width=2pt,color=ffvvqq,smooth,samples=500,domain=-10:1] plot(\x,{-2*(abs((\x)-1))^(1/(3))+1}) coordinate (a);
\draw[line width=2pt,color=ffvvqq,smooth,samples=500,domain=11:1] plot(\x,{2*(abs((\x)-1))^(1/(3))+1}) coordinate(b);
\draw[line width=2pt,color=ffvvqq](a)--(b);

\draw[line width=2pt,color=zzttff,smooth,samples=500,domain=-10:0] plot(\x,{-(abs(\x))^(1/(3))}) coordinate (a);
\draw[line width=2pt,color=zzttff,smooth,samples=500,domain=11:0] plot(\x,{(abs(\x))^(1/(3))})  coordinate(b);
\draw[line width=2pt,color=zzttff](a)--(b);

\begin{scriptsize}
\draw[color=ffvvqq] (-10.16,-3.24) node {$g$};
\draw[color=zzttff] (-10.16,-1.94) node {$f$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}

相关内容