On Wed, 24 Apr 2019, Gour wrote:
Hello,
I believe that using GeoGebra for drawing, exporting to TikZ is the most
approachable method for me to be able to create mathematic-related
material like exams for the children in the primary school, but need some
info how to adjust GeoGebra's TikZ output (suitable for LaTeX) for
ConTeXt?
You need to change \begin{tikzpicture} ... \end{tikpicture} to
\starttikzpicture ... \stoptikzpicture and any other \begin{...} ...
\end{...} pairs that occur in tikz (like \begin{axis}, \begin{scope}, etc)
to \start... \stop... pairs. There are a few other quirks which have
simple workarounds. I am not sure if they are documented anywhere.
If you are more comfortable using a visual tool like GeoGebra than writing
the tikz/metapost code by hand, then I'd say that simply process the
generate latex code through latex to generate standalone pdfs and include
them in your context document using \externalfigure[...].
There are benefits of using the tikz/metapost code in the tex document.
The main advantage is that your images and main text use the same fonts,
but that can be handled by using the same fonts in latex when generating
the image. The other advantages such as consistent look and feel across
multiple images go away when you copy-paste auto-generated code.
So, simply including the generated figures using \externalfigure[...] will
allow you to get productive right away. If and when you start noticing the
limitations of this approach, then you can learn metapost/tikz :-)
If you follow this route, then I would add
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\PreviewEnvironment{tikzpicture}
in the latex preamble. This will create standalone pages that are the same
size the tikzpicture, so that you don't have to crop manually.
Here is the simple example:
\documentclass[10pt]{article}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{zzttqq}{rgb}{0.6,0.2,0}
\definecolor{ududff}{rgb}{0.30196078431372547,0.30196078431372547,1}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]
\begin{axis}[
x=1cm,y=1cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-12.679999999999998,
xmax=12.679999999999998,
ymin=-13.470000000000002,
ymax=8.91,
xtick={-12,-11,...,12},
ytick={-13,-12,...,8},]
\clip(-12.68,-13.47) rectangle (12.68,8.91);
\fill[line width=2pt,color=zzttqq,fill=zzttqq,fill opacity=0.10000000149011612]
(-7.7,2.75) -- (0.88,2.57) -- (-3.04,-3.37) -- cycle;
\draw [line width=2pt,color=zzttqq] (-7.7,2.75)-- (0.88,2.57);
\draw [line width=2pt,color=zzttqq] (0.88,2.57)-- (-3.04,-3.37);
\draw [line width=2pt,color=zzttqq] (-3.04,-3.37)-- (-7.7,2.75);
\draw [line width=2pt,domain=-12.68:12.68] plot(\x,{(--25.3932-4.84*\x)/0.04});
\draw [line width=2pt,domain=-12.68:12.68] plot(\x,{(-13.78-3.92*\x)/5.94});
\draw [line width=2pt,domain=-12.68:12.68] plot(\x,{(--29.7366--8.58*\x)/0.18});
\begin{scriptsize}
\draw [fill=ududff] (-7.7,2.75) circle (2.5pt);
\draw[color=ududff] (-7.54,3.18) node {$A$};
\draw [fill=ududff] (0.88,2.57) circle (2.5pt);
\draw[color=ududff] (1.04,3) node {$B$};
\draw [fill=ududff] (-3.04,-3.37) circle (2.5pt);
\draw[color=ududff] (-2.88,-2.94) node {$C$};
\draw[color=zzttqq] (-3.34,2.58) node {$c$};
\draw[color=zzttqq] (-1.28,0.02) node {$a$};
\draw[color=zzttqq] (-5.04,0.12) node {$b$};
\draw [fill=ududff] (5.2,5.63) circle (2.5pt);
\draw[color=ududff] (5.36,6.06) node {$D$};
\draw [fill=ududff] (5.24,0.79) circle (2.5pt);
\draw[color=ududff] (5.4,1.22) node {$E$};
\draw[color=black] (4.92,8.82) node {$f$};
\draw [fill=ududff] (-2,-1) circle (2.5pt);
\draw[color=ududff] (-1.84,-0.56) node {$F$};
\draw[color=black] (-12.5,5.84) node {$g$};
\draw[color=black] (-3.04,8.82) node {$h$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}
How would such example be adjusted to be used with ConTeXt?
Sincerely,
Gour
--
As the embodied soul continuously passes, in this body,
from boyhood to youth to old age, the soul similarly passes
into another body at death. A sober person is not bewildered
by such a change.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________