
Visual Macros in TeXmacs [video] - amichail
https://twitter.com/gnu_texmacs/status/1251554336842407938
======
quietbritishjim
Very nice, but not a stitch on LyX's math editor [1]. Especially good are its
user-defined math macros (scroll down to point 6 in [1], or look at this video
[2]); you can even define different versions for the output and for editing.
Entering macros (both built-in and user-defined) and positioning your cursor
in the arguments can be done with keyboard or mouse.

Unfortunately LyX tends to get dismissed a lot because long-term LaTeX users
naively assume that it's just for beginners. Ironically I think you need to be
a fairly advanced LaTeX user to start with before you can use it effectively.

[1] [https://www.lyx.org/VisualTour](https://www.lyx.org/VisualTour)

[2]
[https://www.youtube.com/watch?v=68Gys4rp3u4](https://www.youtube.com/watch?v=68Gys4rp3u4)

~~~
watersb
I played with LyX a long time ago, when exploring options for editing XML
documents.

The way it presents the structure of the document was great.

------
JadeNB
It's not obvious to me what "TeXmacs's macro arguments can be edited visually"
_means_ at a glance. It seems to mean: after defining a macro, in this case a
commutative diagram, you can paste the 'skeleton' of a macro, and fill in
arguments in the skeleton rather than having to write out the invocation of
the macro. Here, each argument appears several times in the commutative
diagram, and the diagram remains 'consistent'; changing an entry in one place
changes all of the other entries that the macro defines to be the same. That's
pretty neat as an effect, although not something I think I've ever wanted.

On the other hand, the process of _defining_ the macro looks hideously
painful, with a separate mouse hunt-and-click just to insert a macro argument.
I understand the argument for structured text editing, but does it have to be
mouse-driven? That is, do I have to use a mouse to insert macro argument A, or
can I just type A within the macro definition, or is there possibly some
middle ground where I can just type A, but pre- or post-pend some modifier
key? (I've never used TeXmacs, though I've always been interested to give it a
try ever since I realised it _wasn 't_ just "emacs + TeX"; I'm too wedded to
the vim system.)

~~~
mgubi
I did the video, and I was lazy: you can type Ctrl+arrow (as indicated in the
tooltip) to insert more placeholders, no need to use the mouse. and then
references are inserted with \A, etc.. Anyway you can define VIM modal
keybindings ;) [http://forum.texmacs.cn/t/a-very-tiny-vim-in-
texmacs/176/7](http://forum.texmacs.cn/t/a-very-tiny-vim-in-texmacs/176/7)

~~~
JadeNB
vim emulation is always dangerous, because it falls so easily into an uncanny
valley—it lulls you into feeling comfortable, and then is _more_ jarring when
you hit a bump than if you knew all along you were in a different editing
paradigm. Anyway, thanks!

(Also, to be clear, I wasn't criticising the use of the mouse, just hoping
that it wasn't the only way.)

------
alhirzel
This reminds me a lot of JetBrains MPS and their projectional editing
features.
[https://www.youtube.com/watch?v=iN2PflvXUqQ](https://www.youtube.com/watch?v=iN2PflvXUqQ)

~~~
mgubi
I didn't knew MPS but indeed seems quite similar. Both are structured editors,
in the sense that you never work with "text" but with some projection of the
underlying tree structure. For example you can ask TeXmacs to show you a
representation where every node tree is explicit (which look very much HTML,
but where you cannot have an open environment tag without the corresponding
closing tag).

