Is there a list of all the latex-like and TeXmacs command available in the program?

Usually the manuals just give the menu location and the keyboard shortcuts for various actions and command. But sometimes it’s more convenient to type the command (with \) than searching through the menus.

Similarly, the exact name of the commands is necessary to create custom keyboard shortcuts. For example, I was trying to create a shortcut for the “Show Hidden” command, but I don’t know how to access it.

Thanks.

There is no precompiled list. What I usually do is to perform a text search in the $TEXMACS_PATH/progs/ directory to find how certain operations are preformed in scheme and work out solutions from there. Also you have a search facility in the Help menu which will look in the documentations and in the source files (IIRC).

There is a list of all math symbols:

It could be find via Help -> Planet -> LaTeX in Mogan Editor.

We will make the i18n version soon. For now, the index is in Chinese.

An I think unofficial list is the one by N. Ratier: https://www.researchgate.net/publication/296637736_The_Comprehensive_TeXmacs_Symbol_List
May be also out of date but that depends on how much TeXmacs has changed between when the list was written and now.

Also for assigning keyboard shortcuts to menu items I wrote https://texmacs.github.io/notes/docs/menu-shortcuts.html, which describes a straightforward command. The posts in Paste from LaTeX via keyboard shortcuts explain what to do when it takes more work to reconstruct the command (more work or more knowledge or more guessing).

Thanks.

The math symbols are relatively easy to figure out since they’re mostly similar to LaTeX. It’s the other commands/macros (texmacs and/or scheme) that are challenging to figure out.

I think it would be beneficial to generate this list or perhaps updated the texmacs manuals, as some things are kinda confusing. For instance, I’m still a bit confused about what is a texmacs command (or macro) vs what is a scheme command, and what the difference between the two is. Though I’m still new at this, so perhaps it just takes some time with the software to figure out.

1 Like

I had not realized it. I spent a few minutes doing a few searches in the code. I think someone else can tell if this is in the way that I tell it or not—I think that primitives are defined in the C++ code, while macros built on top of primitives are defined in style files.

Perhaps the systematic way to list the macros is hinted at by the Scheme function editable-macro?, in progs/source/macro-widgets.scm, but I did not yet through the code to see if that is the case.

texmacs macros is a DSL defined in cpp, while scheme has access to some aspects of internal state, if needed bindings exist.

1 Like

as @sharkc points out the macro language is domain specific language (implemented in C++) and meant to allow the user to extend the typesetter with new constructs, e.g. theorems, coloured tables, etc… it is declarative in spirit. You declare how the new construct should be assembled via more primitive pieces. The scheme interpreter is a full language which can perform arbitrary computations and which can modify arbitrarily the document tree and other aspects of the program (like the UI) or interact with the external world. The \extern macro allow you to use scheme within a document. As such if you invoke Scheme to perform some task via \extern the typesetter has no clue of what is going on and cannot do anything else than reevaluate the macro every time the document changes. This may lead to some slowness, which is unavoidable. So it is better to use \extern macros only when nothing else works and maybe try to cache the result.

Aside this, scheme is used as an extension language for TeXmacs. The UI, all the converters and the file-system manager, are written in scheme so if you want to extend one of these you can write scheme code. For example, you can define or extend or modify biblliographic styles via scheme, it is not difficult and much nicer than program BibTeX styles. Also you can modify the menus, the toolbars, etc… via scheme.

1 Like

How up to date is the manual on this? I’m following the examples of the manual (ch. 11) so I can learn this in order to create my own styles, but I’m having a very hard time with it. Even the process of just typing the commands seems a bit confusing (hard to explain, but half the time I have no idea where the cursor is going or what it is doing).

For example, I am trying to replicate the “labeled theorem” example on pg. 89 of the manual, but can’t seem to get the command concat to stay on the page. As soon as I type it and hit enter, it disappears.

Is there a better way of working with these macros?

PS: I’ve read about the debate of editing source code vs. editing trees, and TeXmacs prefers the second. But right now it feels as though editing source code would be much easier.

After a while at least a part of the typing feels natural, but not all of it. I agree that a manual page for typing source, together with some worked examples, would be good. Even after several years of use, I am not able to describe how to do it; if I were, I would write a blog post on the topic :wink:

Someone should try. Perhaps a video would be more appropriate.
I’m having trouble making a lot of the examples in the manual work, and I’m following it word for word.

Keys in TeXmacs do not corresponds to characters, but to commands. You have to understand what is going on, especially because sometime what is going on is not what you expect. :slight_smile: For example, “enter” activate the macro, so it is natural that concat disappear. I do no have particular problems creating style files, because TeXmacs open style file in “source mode” where the commands show in the dis active form. So I’m a bit puzzled about what you report. Maybe be sure to enter new macros only in style files or in the preamble of your document.

That is what I have been doing. Like I said, I’m just trying to follow the examples in the manual.

A bit before that example, in the manual page Help->Manual->Write your own style files it says

Another way to customize the rendering is to override some of the global rendering options. This is mainly interesting for controlling more precisely which tags have to be stretched across several lines and which tags have to be represented in a compact fashion. For instance, the concat tag can be used in order to concatenate content, as well as for specifying a block of sequential statements, or a combination of both.

concat tags are implicit tags which are put there by the typesetter to regourp other elements of the document. You do not have do to anything special to insert them, In the particular case of the \labeled-theorem you just enter the \surround tag and then fill its first slot with the three macros ignoring the \concat element. It will be implicitly inserted and you can choose Source->presentation->stretched to show it explicitly.

In my case the code is

<assign|labeled-theorem|
  <macro|id|body|
   <surround|<no-indent>
             <flag|<arg|id>|blue>
             <with|font-series|bold|Theorem. >
   |<right-flush>
   |<arg|body>>>>

It seems that the \flag tag cannot be used as in the example, since it accepts only two arguments. Probably something changed in the API lately.

Yeah, I figured that out after playing with it for a while. The manual should be updated to specify that very clearly. If it’s implicit, then why even include in so many examples…

Another example that’s giving me trouble is the meta-macro example that is after, “new-theorem.”

This is the example in the book:21%20AM

This is my implementation:
07%20AM

And this is the result when I apply it to the text.:
19%20AM

Not 100% sure, but I expect a Theorem with the value of text to appear. When I was typing this example, I was able to type the argument of the first <unquote easily as \name and it expanded to the variable name. However, for some reason, when trying to type the argument of the second unquote, \text, it kept expanding to <text> instead of the variable name. I had to manually Insert variable from the menu for that one, not sure if that worked well.

I’m not sure what you actually did to check. These macros are intended to be used either in other style files or in the preamble. The just define a new macro, so I do not expect anything to appear on screen. If you invoke it by

<new-theorem|bla|BLA>

then you will have a new macro \bla which take only one argument. You can invoke \bla from your document and it should work.
When you paste your code here it would be better to have a precise representation, as those provided by Paste->Past as TeXmacs or Paste->Past as TeXmacs scheme. So we are sure about what is going on.

Alright, I see.

Thanks for clarifying!

It may well be that with a bit of habit one forgets that typing source code in TeXmacs “feels” different from other apparently similar experiences at the beginning; and possibly when one is writing TeXmacs source code for the first time, they always take “the wrong choice”.
The first time that I tried to write a program in the macro system of TeXmacs (it was for automating labels I think) it was extenuating; at the time I did not know that a program is better written in Scheme—and I recall you then told me so, but now I am focusing on the experience of writing.

Yes, the coding process is counterintuitive for beginners, but I think it could be mitigated with an updated manual and tutorials. In my opinion, the current manual brushes off a lot of important concepts that are not obvious to beginners. Unless I missed an important section or something.

Editing scheme would be easier, but if I understand things correctly, changes in the layout and typesetting should be done in the TeXmaxs macro language. My goal for now is to modify elements of the “book” template to match an existing style that I did years ago in LaTeX.

I might try to write a mini-tutorial (it would be less than half a page I think), I do not think I am able to do a video though.

1 Like