1

I've drawn the following in geogebra:

enter image description here

I am trying to export it to latex, and it generates the following code

\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}

but it generates:

enter image description here

im not really sure what im doing wrong?

1
  • The second drawing command is \fill. Try changing that to \draw. Commented Oct 24, 2015 at 17:51

1 Answer 1

3

Apparently, geogebra does not know how to properly export to tikz. You should in any case submit a bug report to geogebra.

As Loop Space writes, you should replace the first command \fill by \draw. That doesn't really suffice, the output is pretty ugly. As a first fix, you could try to reduce the font size, so that the labels will not meet each other (option font=\scriptsize below). Also, the two labels "consume" and $\lambda \gamma^*_\pi(t)$ are very close. Should this really be one or two labels? Maybe you can fix this one in your geogebra file. Below, I decided to combine the two labels and align them with anchor=north (no west). I am not sure whether this is what you want.

Depending on how many images you want to convert to LaTeX, it would maybe be worth for you to learn more precisely about how to place labels with tikz. Otherwise, you can just play with the precise coordinates of the labels.

\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}

enter image description here

1
  • thanks for your answer, yes i had a problem combining those two labels in geogebra which only seems to let you write either under an equation environment or none at all, i suppose i shouldve used \text{ } Commented Oct 25, 2015 at 0:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .