0

I'm trying to export geogebra drawing to latex.

enter image description here

This produces following latex code:

\documentclass[10pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\begin{axis}[
x=1.0cm,y=1.0cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-1.0,
xmax=6.0,
ymin=-2.0,
ymax=6.0,
xtick={-1.0,0.0,...,6.0},
ytick={-2.0,-1.0,...,6.0},]
\clip(-1.,-2.) rectangle (6.,6.);
\draw [shift={(0.,0.)},line width=0.4pt]  plot[domain=0.:1.5707963267948966,variable=\t]({1.*5.*cos(\t r)+0.*5.*sin(\t r)},{0.*5.*cos(\t r)+1.*5.*sin(\t r)});
\draw [->,line width=0.4pt] (0.,0.) -- (4.419539299244726,2.3383054510545525);
\draw [line width=0.4pt] (4.419539299244726,-2.) -- (4.419539299244726,6.);
\draw [line width=0.4pt,domain=-1.:6.] plot(\x,{(--2.3383054510545525-0.*\x)/1.});
\draw [->,line width=0.4pt] (0.,0.) -- (4.419539299244726,0.);
\draw [->,line width=0.4pt] (0.,0.) -- (0.,2.3383054510545525);
\begin{scriptsize}
\draw [fill=black] (0.,0.) circle (2.0pt);
\draw[color=black] (0.11187609988355163,0.2529556851151442) node {$B$};
\draw [fill=black] (5.,0.) circle (2.5pt);
\draw[color=black] (5.111535372228054,0.2832566480422628) node {$C$};
\draw [fill=black] (0.,5.) circle (2.5pt);
\draw[color=black] (0.11187609988355163,5.282915531016838) node {$D$};
\draw[color=black] (3.6570890384551076,3.7678673846609056) node {$c$};
\draw [fill=black] (4.419539299244726,2.3383054510545525) circle (2.5pt);
\draw[color=black] (4.520666549132794,2.6164307934303976) node {$A$};
\draw[color=black] (2.2177931873256296,1.3437903504914148) node {$R$};
\draw[color=black] (4.21765689626343,6.267696826148193) node {$f$};
\draw[color=black] (-3.039424289957831,2.2376687568414146) node {$g$};
\draw [fill=black] (4.419539299244726,0.) circle (2.0pt);
\draw[color=black] (4.520666549132794,0.2529556851151442) node {$E$};
\draw[color=black] (2.248094152612566,0.19235375926090692) node {$u$};
\draw [fill=black] (0.,2.3383054510545525) circle (2.0pt);
\draw[color=black] (0.11187609988355163,2.586129830503279) node {$F$};
\draw[color=black] (-0.009327761264193851,1.2983389061007369) node {$v$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}

Which produces following:

enter image description here


Status:

  • It seems like the arc c has shifted horizontally 1, vertically 2 which are the x-Min & y-Min values (see red arrows in the first image).
  • And when x-Min, y-Min values both equal to 0, then arc c gets into correct position.
  • arc c is defined in geogebra as CircularArc(B, C, D)
  • I have no experience in either tikz or geogebra.
  • I just want to fix the core of this problem, So I can draw more simple graphics in geogebra and then import it to my latex.
  • Why does this happening.

Update: I've asked in geogebra's sub-reddit. Apparently, geogebra's LaTeX output has no maintainer currently.

Garid
  • 207

1 Answers1

1

I don't know much about Geogebra so I cant's say what could cause your problem. But, IMHO, this kind of pictures are simple enough to draw them directly in TikZ.

This is not a solution (for what you say I don't know if there is one), but an alternative, a workaround: invest some time in learn TikZ and briefly you'll can draw simple things (like this one), but in the long term you'll be able to draw more complex ones. It's a good tool to have at hand.

That said, your picture. I think the code is legible enough.

\documentclass[tikz,border=2mm]{standalone}

\begin{document} \begin{tikzpicture} % deimensions \def\xmin{-1} \def\xmax{6} \def\ymin{-2} \def\ymax{6} \def\r{5} % radius \def\xa{4.4} % A point, x coordinate \pgfmathsetmacro\ya{sqrt(\r\r-\xa\xa)} % A point, y coordinate % coordinates \coordinate (A) at (\xa,\ya); \coordinate (B) at (0,0); \coordinate (C) at (\r,0); \coordinate (D) at (0,\r); \coordinate (E) at (\xa,0); \coordinate (F) at (0,\ya); % grid and axes \draw[help lines,gray!30] (\xmin,\ymin) grid (\xmax,\ymax); \draw[thick,-latex] (\xmin,0) -- (\xmax,0); \draw[thick,-latex] (0,\ymin) -- (0,\ymax); % lines \draw (\xmin,\ya) -- (\xmax,\ya); \draw (\xa,\ymin) -- (\xa,\ymax); % arc \draw[thick,red] (C) arc (0:90:\r) node[midway,right] {$c$}; % vectors \draw[thick,-latex,blue] (B) -- (E) node[midway,below] {$\vec u$}; \draw[thick,-latex,blue] (B) -- (F) node[midway,left] {$\vec v$}; \draw[thick,-latex,blue] (B) -- (A) node[midway,above] {$R$}; % points \foreach\i in {A,B,C,D,E,F} \draw[fill=white] (\i) circle (0.5mm) node[above right] {$\i$}; \end{tikzpicture} \end{document}

enter image description here

Juan Castaño
  • 28,426
  • By the way, pgf also defines trigonometric functions. So the initial definition in @Juan perfect anwer (lines 11 and 12) could involve \def\aa{30} % angle in degrees and then \pgfmathsetmacro\xa{\r*cos(\aa)} and \pgfmathsetmacro\ya{\r*sin(\aa)}. Notice that cos and sin perform the computation but don't typeset anything, oppositely to usual \cos and \sin. – Jhor Mar 22 '23 at 08:24