I have just started writing some macros for TeXmacs. I have two basic questions
- What is a good way to write them so that they are easy to read?
For example: I have not yet understood what is the way to write a macro in multiple lines. I have tried to do it manually in a text editor, and the resulting macro is not accepted by TeXmacs. I haven’t either figured out how to indicate a continuation line.
In general, I find it difficult to learn the behaviour of the macro editor: sometimes a variable (let us call it var) gets inserted as <value|var> and I did not understand in which cases and pressing return in the middle of an already-written macro sometimes inserts the command <document| (did not check precisely and did not understand what it means).
Is there any documentation on this? Till now I did not find it.
- What is the return value of a TeXmacs macro? At first I assumed it must be the last expression which gives an output evaluated inside the macro, after some experiments it seems likely that all the “typesettable” results of the macro are considered its return value.
This second question arose from my attempts to calculate a value using a macro, store it in a variable, use the variable as input for another macro.
If my questions indicate that I have not understood the principles of macros in TeXmacs, it is so
I need a bit of time to adapt to functional programming. If I can edit macros with ease (see question 1) ) it will be quicker