ENG/GER : Tikz Export text wrong position / Text bei Tikz Export an falscher Stelle

David shared this question 4 years ago
Needs Answer

English : Hello, I am using Geogebra to create figures for my economics thesis. ( Mainly because they look much more sharp and nice). The problem is that text, which is added for explanation is shifting after exporting to tikz and including in a tex document. ( In the pictures below you can see that "price" and "insurancesuppy" have shifted and changed positions) In Geogebra however, they were exactly where I have placed them. What am I doing wrong? Any suggestions ?

Deutsch : Hallo, ich benutze Geogebra um kleine Skizzen/Abbildungen für meine Masterarbeit zu erstellen ( Hauptsächlich, weil es viel schöner und schärfer aussieht). Das Problem ist nun, dass Text, welcher etwa zur Beschreibung der Achsen hinzugefügt wurde, sich beim Exportieren nach Tikz und Einfügen in ein Latex Dokument verschiebt ( Im den Bildern unten sieht man, dass sich "Preis" und "Insurancesupply" verschoben habe. In Geogebra jedoch, ist der Text genau an der Stelle wo er positioniert wurde. Was mache ich falsch ?


Bild in Geogebra :

687eb0912aa5b91ffd78bba7afa87695

Export nach Tikz

7a2e555b66992346cf268ad0fa6f8b32


Bild in Latex mit falschen Positionen / Picture in Latex with wrong position of text


4ce52d77c354983764d71c614445ef83

**********

Tikz Code

  1. \documentclass[10pt]{article}

    \usepackage{pgf,tikz}

    \usepackage{mathrsfs}

    \usetikzlibrary{arrows}

    \pagestyle{empty}

    \begin{document}

    \definecolor{wwffqq}{rgb}{0.4,1.,0.}

    \definecolor{ffzzqq}{rgb}{1.,0.6,0.}

    \definecolor{qqqqff}{rgb}{0.,0.,1.}

    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]

    \draw[->,color=black] (-1.,0.) -- (10.5,0.);

    \foreach \x in {-1.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}

    \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};

    \draw[->,color=black] (0.,-1.) -- (0.,5.5);

    \foreach \y in {-1.,1.,2.,3.,4.,5.}

    \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};

    \draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};

    \clip(-1.,-1.) rectangle (10.5,5.5);

    \draw [color=ffzzqq,domain=-1.:10.5] plot(\x,{(--57.8224-3.88*\x)/16.28});

    \draw [color=wwffqq,domain=-1.:10.5] plot(\x,{(--22.7264--5.04*\x)/14.48});

    \draw (5.56,4.42) node[anchor=north west] {Insurancesuppy};

    \draw (-1.,5.14) node[anchor=north west] {Price};

    \draw (9.04,-0.44) node[anchor=north west] {Quantity};

    \draw (5.06,1.68) node[anchor=north west] {Insurancedemand};

    \begin{scriptsize}

    \draw [fill=qqqqff] (-2.72,4.2) circle (2.5pt);

    \draw[color=qqqqff] (-2.58,4.57) node {$A$};

    \draw [fill=qqqqff] (13.56,0.32) circle (2.5pt);

    \draw[color=qqqqff] (13.7,0.69) node {$B$};

    \draw[color=ffzzqq] (-4.52,4.49) node {$f$};

    \draw [fill=qqqqff] (-3.36,0.4) circle (2.5pt);

    \draw[color=qqqqff] (-3.22,0.77) node {$C$};

    \draw [fill=qqqqff] (11.12,5.44) circle (2.5pt);

    \draw[color=qqqqff] (11.26,5.81) node {$D$};

    \draw[color=wwffqq] (-4.52,0.35) node {$g$};

    \end{scriptsize}

    \end{tikzpicture}

    \end{document}

Latex Code

  1. \documentclass[10pt]{article}

    \usepackage{pgf,tikz}

    \usepackage{mathrsfs}

    \usetikzlibrary{arrows}

    \pagestyle{empty}

    \begin{document}

    \definecolor{wwffqq}{rgb}{0.4,1.,0.}

    \definecolor{ffzzqq}{rgb}{1.,0.6,0.}

    \definecolor{qqqqff}{rgb}{0.,0.,1.}

    \begin{figure}

    \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]

    \draw[->,color=black] (-1.,0.) -- (10.5,0.);

    \foreach \x in {-1.,1.,2.,3.,4.,5.,6.,7.,8.,9.,10.}

    \draw[shift={(\x,0)},color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $\x$};

    \draw[->,color=black] (0.,-1.) -- (0.,5.5);

    \foreach \y in {-1.,1.,2.,3.,4.,5.}

    \draw[shift={(0,\y)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\y$};

    \draw[color=black] (0pt,-10pt) node[right] {\footnotesize $0$};

    \clip(-1.,-1.) rectangle (10.5,5.5);

    \draw [color=ffzzqq,domain=-1.:10.5] plot(\x,{(--57.8224-3.88*\x)/16.28});

    \draw [color=wwffqq,domain=-1.:10.5] plot(\x,{(--22.7264--5.04*\x)/14.48});

    \draw (5.56,4.42) node[anchor=north west] {Insurancesuppy};

    \draw (-1.,5.14) node[anchor=north west] {Price};

    \draw (9.04,-0.44) node[anchor=north west] {Quantity};

    \draw (5.06,1.68) node[anchor=north west] {Insurancedemand};

    \begin{scriptsize}

    \draw [fill=qqqqff] (-2.72,4.2) circle (2.5pt);

    \draw[color=qqqqff] (-2.58,4.57) node {$A$};

    \draw [fill=qqqqff] (13.56,0.32) circle (2.5pt);

    \draw[color=qqqqff] (13.7,0.69) node {$B$};

    \draw[color=ffzzqq] (-4.52,4.49) node {$f$};

    \draw [fill=qqqqff] (-3.36,0.4) circle (2.5pt);

    \draw[color=qqqqff] (-3.22,0.77) node {$C$};

    \draw [fill=qqqqff] (11.12,5.44) circle (2.5pt);

    \draw[color=qqqqff] (11.26,5.81) node {$D$};

    \draw[color=wwffqq] (-4.52,0.35) node {$g$};

    \end{scriptsize}

    \end{tikzpicture}

    \caption{Versicherungsnachfrage und Angebot}

    \end{figure}

    \end{document}

Comments (3)

photo
1

What change in the TikZ code would be needed?

photo
1

Hello Michael Borchers,

thank you for your reply. The problem isn't with the figure above. The problem, more generally speaking is, that if figures get more complex, the shifting of text become a big annoyance. Is there a malfunction of the exporting capability of geogebra ? See the example below.

Everything is fine in Geogebra ( yayyy) :

af761cab61e63eaf0e9123054f67e8a7

This is how it looks in Latex : " Efficient Frontier", "Expected Return" and "Market Portfolio" have shifted.d5a808f57052ab7a1ec5800c32db1156

PS. The problem doesn't occur, when I export to .png.

photo
1

It's more like "not fully implemented" than "malfunction". We don't have anyone taking care of the TikZ code right now so it's hard for us to make improvements

photo
© 2021 International GeoGebra Institute