Math & SciencetikZ | Faulty Code Export by GeoGebra

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
daniel2718
Posts: 4
Joined: Tue Apr 10, 2012 11:32 pm

tikZ | Faulty Code Export by GeoGebra

Post by daniel2718 »

The problem is rather self-explanatory, I guess... the tikzpicture environment in the following TeX code is ended by \end{document}. The code is a result of export by GeoGebra. I searched for this problem, and the only similar one I could find was one in which a person was using the babel spanish package. I omitted the "\draw" commands and it compiled without error (as eglucon did in the aforementioned post). Stefan said that ">" is used with the babel package, and fixed eglucon's problem with "\shorthandoff{>}" within the tikzpicture environment. However, my only packages are pgf and tikz, and "\shorthandoff{>}" doesn't fix it in this case.

Code: Select all

\documentclass[12pt]{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows}
\begin{document}
\definecolor{ffqqqq}{rgb}{1,0,0}
\definecolor{qqqqqq}{rgb}{0,0,0}
\definecolor{ffqqqq}{rgb}{1,0,0}
\definecolor{qqwuqq}{rgb}{0,0.392156862745098,0}
\definecolor{qqqqqq}{rgb}{0,0,0}
\definecolor{qqqqff}{rgb}{0,0,1}
\definecolor{qqqqqq}{rgb}{0,0,0}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw[->,color=qqqqqq] (-3.5,0) -- (0.5,0);
\foreach \x in {-3,-2,-1}
\draw[shift={(\x,0)},color=qqqqqq] (0pt,-2pt);
\draw[->,color=qqqqqq] (0,-0.5) -- (0,4.3);
\foreach \y in {,1,2,3,4}
\draw[shift={(0,\y)},color=qqqqqq] (2pt,0pt) -- (-2pt,0pt);
\clip(-3.5,-0.5) rectangle (0.5,4.3);
\draw [line width=2pt,color=qqqqqq] (-1.5,1.5) circle (1cm);
\draw [line width=1.2pt,dash pattern=on 2pt off 2pt,color=ffqqqq,domain=-3.5:0.5] plot(\x,{(--3.081680820604948--0.557836036894137*\x)/0.829951176842496});
\draw [line width=1.6pt,dotted,color=qqqqqq] (-1.5,1.5)-- (-0.653539247128977,0.96754888125855);
\draw [color=ffqqqq](-1.620708173716304,2.958081198573539) node[anchor=north west] {λ};
\begin{scriptsize}
\fill [color=qqqqff] (-1.5,1.5) circle (1.5pt);
\draw[color=qqqqff] (-1.126566494829682,1.730312495462603) node {C = (h, k)};
\draw[color=qqqqqq] (-1.027738159052357,2.605274099978442) node {$O$};
\fill [color=qqwuqq] (-2.057836036894137,2.329951176842496) circle (1.5pt);
\draw[color=qqwuqq] (-1.917193181048277,2.619386383922246) node {P_T = (α,β)};
\draw[color=qqqqqq] (-1.225394830607006,1.194045705598057) node {$r$};
\end{scriptsize}
\end{tikzpicture}
\end{document}
Attachments
GEOGEBRA PGFTIKZ TEST.log
the resulting logfile
(21.46 KiB) Downloaded 370 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

tikZ | Faulty Code Export by GeoGebra

Post by Stefan Kottwitz »

Hi Daniel,

it's just a small problem: you need to enter the math mode in the node text in line 29, as you correctly did with the other nodes.

Code: Select all

\draw[color=qqwuqq] (-1.917193181048277,2.619386383922246) node {$P_T = (α,β)$};
The first error message was relevant:

Code: Select all

! Missing $ inserted.
The error

Code: Select all

! LaTeX Error: \begin{tikzpicture} on input line 12 ended by \end{document}
is the last one, and is only a consequence of the first one.

Btw. I would use (\alpha,\beta) instead of (α,β).

Stefan
LaTeX.org admin
daniel2718
Posts: 4
Joined: Tue Apr 10, 2012 11:32 pm

tikZ | Faulty Code Export by GeoGebra

Post by daniel2718 »

Thanks Stefan!

I've posted a bug report thread over at GeoGebra to address those issues (no $...$ around that point and use of the Greek letters instead of LaTeX code).
Post Reply