Sketches and plots in Texmacs

Perhaps either of these two syntaxes will be fine

https://www.gnu.org/software/guile/manual/html_node/SRFI_002d105.html
https://sourceforge.net/p/readable/wiki/Scheme-tutorial/

Maybe Metapict could be interesting here:

https://docs.racket-lang.org/metapict/index.html


3 Likes

I am interested. I will be able to work on this sometime soon I hope.
A thing that would be good in general, I think, would be having a way to use Racket code in TeXmacs.
My current “feeling” about this: difficult. On the other hand, having different, incompatible implementations hurts Scheme IMO: there are nice packages in one of the implementations, and one needs to rewrite and maintain them to have their functionality in another implementation.

How are you seeing the development of sketches and plots in Texmacs ?
Do you think a bridge is possible between for example the scheme/Racket code and the graphical sketch editor ?
Or do you (for the moment at least) think more of a plugin like the graph plugin which can interpret code to draw sketches ?

A plugin is easier, that is maybe the first step: text files that TeXmacs can use to build a drawing.

For the “bridge” I have only a vague idea of what you mean, I write it here, let me know if I am understanding you right: using potentially sophisticated commands of the Racket code (the first example that I have in mind: “draw a line perpendicular to this one”) through the graphical editor.

Using text files one can also record “what one has in mind”, e.g. that line r is perpendicular to line s; with the graphical editor perhaps this is not possible.

Sorry for not being very clear: it is in fact the sad trust of my ranting :grinning:

The example you give may be indeed an application case. It makes me think of application like Geogebra.

Very often the existence of a GUI application for Tikz is asked in the Latex community. The bridge I mention was more in this direction: a GUI interface to create, modify sketches which are build according to “a lexicon and grammar”. The user will have the ability to create, modify his sketches using the GUI or using raw code. It’s often one way (GUI->Raw code via an export), I’m not even sure if it is technically possible to have both ways (GUI<->Raw code) without messing things up.

Some “attempts” have been initiated for Tikz, for example:
https://tikzit.github.io/
http://www.tikzedt.org/quicktour.html

Geogebra, Inkscape, Ipe can export to tikz/pgf but the opposite is not possible (at least on what I know).

The Texmacs graphical sketch editor is very very nice, although sometimes capricious or buggy for me but I am perhaps more to blame here because I do not know how to use it well. I think it does not have the possibility to define for example coordinates of points, translation vector, rotation angle, diameter of a circle, … as parameters of the figure.

Geogebra as done it but is clearly oriented to mathematical figures construction almost exclusively.
Don’t know if something similar could be achieved in Texmacs with an extension of the existing graphical editor or the build of a new interface perhaps using a new scheme package like the Metapict package mentioned above.

I’m sure I’m even less clear now, right ?!:grin:

The graphics editor needs some love. Indeed we could improve the way it handles groups of object and standard objects like rectangles and circles. This should be not much difficult. Another direction is to have a programmatic interface to encode conceptual constructions (like geogebra, MetaPost or TikZ in some way). This need careful thinking and it is nontrivial. I think a more realistic task is to try to have a way to use an external plugin to produce images which we can still edit inside TeXmacs, e.g. by adding text or modififying some features. Unless the needs are the interface are specified it is premature to implement anything in this direction. For the moment the TikZ plugin and the asymptote plugin are good enough to fill most needs. What are the things they are missing? It is worth to do a full implementation of a system like MetaPict in TeXmacs? To which purpose? What are the use cases?

The copy-paste of graphical objects does not work well in my opinion. I recall trying to get it to work and giving up (I hope that I recall well :slight_smile: l

I’m not a dev but regarding the user I am some possible enhancements regarding for example the already very useful Graph/Tikz plugin could be:

  • syntax highlighting
  • completion regarding the tikz lexicon/keywords
  • load of an external tikz picture file
  • tangle (i.e export) of the code written in the graph plugin to an external file (like org-mode can do for example)
  • use the same font as the Texmacs document
  • when editing the code an instant preview on the side could also be useful in order to not lose the common thread of the drawing code (in the current implementation you have the choice of editing the code or seeing the results but not both at the same time).

Regarding the graphical editor, as you said, " a programmatic interface to encode conceptual constructions" could be a very very interesting feature to have.