从 geogebra 导出图形

从 geogebra 导出图形

我在 geogebra 中绘制了以下内容:

在此处输入图片描述

我尝试将其导出到 latex,它会生成以下代码

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=5.963052189663429cm,y=6.882465522871498cm]
\clip(3.689076390812617,1.8587708166080559) rectangle (5.3660699306871065,3.3117385019191485);
\fill(4.562096541660087,3.141936112320542) -- (3.864932244907646,2.1201049468877806) -- (5.203961300072035,2.1259431133816373) -- cycle;
\draw (4.562096541660087,3.141936112320542)-- (3.864932244907646,2.1201049468877806);
\draw (3.864932244907646,2.1201049468877806)-- (5.203961300072035,2.1259431133816373);
\draw (5.203961300072035,2.1259431133816373)-- (4.562096541660087,3.141936112320542);
\draw (4.6150499230079465,2.8338166788505954) node[anchor=north west] {$\widetilde{\pi}(t+1)$};
\draw [dash pattern=on 2pt off 2pt] (4.387584856780469,2.6190839429739308)-- (4.604490640656735,2.7694537510805857);
\draw (4.387584856780469,2.6190839429739308)-- (4.555579181100361,2.252693547941523);
\draw (4.555309695124377,2.2790859913603105) node[anchor=north west] {$\mu(t+1)$};
\draw (4.367554693204586,2.40710076539653) node[anchor=north west] {$\pi(t+1)$};
\draw (4.3056808857537465,2.6823325295744023) node[anchor=north west] {$\pi(t)$};
\draw [dash pattern=on 2pt off 2pt] (4.604490640656735,2.7694537510805857)-- (4.489052072597337,2.3977871019259576);
\draw (4.4251613415208855,2.7356720187561603) node[anchor=north west] {drift};
\draw (4.570244752095269,2.588455028614508) node[anchor=north west] {rebalance};
\draw (4.222471282630203,2.505245425490965) node[anchor=north west] {consume };
\draw (4.333417420128261,2.5372491190000197) node[anchor=north west] {$\lambda \gamma^*_\pi(t)$};
\begin{scriptsize}
\draw [fill=black] (4.387584856780469,2.6190839429739308) circle (0.5pt);
\draw [fill=black] (4.555579181100361,2.252693547941523) circle (0.5pt);
\draw [fill=black] (4.604490640656735,2.7694537510805857) circle (0.5pt);
\draw [fill=black] (4.489052072597337,2.3977871019259576) circle (0.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}

但它会产生:

在此处输入图片描述

我不太清楚我做错了什么?

答案1

显然,geogebra 不知道如何正确导出到tikz。无论如何,您都应该向 geogebra 提交错误报告。

\fill正如 Loop Space 所写,您应该用替换第一个命令\draw。这还不够,输出非常丑陋。作为第一个修复,您可以尝试减小字体大小,这样标签就不会互相接触(font=\scriptsize下面的选项)。此外,这两个标签“消耗”并且$\lambda \gamma^*_\pi(t)$非常接近。这真的应该是一个还是两个标签?也许您可以在 geogebra 文件中修复这个问题。下面,我决定合并这两个标签并将它们对齐anchor=north(否west)。我不确定这是否是您想要的。

根据您要转换为 LaTeX 的图像数量,您可能需要更精确地了解如何使用 放置标签tikz。否则,您只需使用标签的精确坐标即可。

\documentclass[10pt]{article}
\usepackage{pgf,tikz}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=5.963052189663429cm,y=6.882465522871498cm,font=\scriptsize]
\clip(3.689076390812617,1.8587708166080559) rectangle (5.3660699306871065,3.3117385019191485);
\draw(4.562096541660087,3.141936112320542) -- (3.864932244907646,2.1201049468877806) -- (5.203961300072035,2.1259431133816373) -- cycle;
\draw (4.562096541660087,3.141936112320542)-- (3.864932244907646,2.1201049468877806);
\draw (3.864932244907646,2.1201049468877806)-- (5.203961300072035,2.1259431133816373);
\draw (5.203961300072035,2.1259431133816373)-- (4.562096541660087,3.141936112320542);
\draw (4.6150499230079465,2.8338166788505954) node[anchor=north west] {$\widetilde{\pi}(t+1)$};
\draw [dash pattern=on 2pt off 2pt] (4.387584856780469,2.6190839429739308)-- (4.604490640656735,2.7694537510805857);
\draw (4.387584856780469,2.6190839429739308)-- (4.555579181100361,2.252693547941523);
\draw (4.555309695124377,2.2790859913603105) node[anchor=north west] {$\mu(t+1)$};
\draw (4.367554693204586,2.40710076539653) node[anchor=north west] {$\pi(t+1)$};
\draw (4.3056808857537465,2.6823325295744023) node[anchor=north west] {$\pi(t)$};
\draw [dash pattern=on 2pt off 2pt] (4.604490640656735,2.7694537510805857)-- (4.489052072597337,2.3977871019259576);
\draw (4.4251613415208855,2.7356720187561603) node[anchor=north west] {drift};
\draw (4.570244752095269,2.588455028614508) node[anchor=north west] {rebalance};
\draw (4.222471282630203,2.505245425490965) node[anchor=north] {consume  $\lambda \gamma^*_\pi(t)$};
%\draw (4.333417420128261,2.5372491190000197) node[anchor=north west] {consume $\lambda \gamma^*_\pi(t)$};
\begin{scriptsize}
\draw [fill=black] (4.387584856780469,2.6190839429739308) circle (0.5pt);
\draw [fill=black] (4.555579181100361,2.252693547941523) circle (0.5pt);
\draw [fill=black] (4.604490640656735,2.7694537510805857) circle (0.5pt);
\draw [fill=black] (4.489052072597337,2.3977871019259576) circle (0.5pt);
\end{scriptsize}
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容