Preventing symbol concatenation in math equations

There are several automatic symbol concatenations in math mode, some of which interfere with my intention. How do I select the option I need (without concatenation):
For example, writing a quantum bra-ket expression |\psi\rangle=|0\rangle
After the equal sign, I type “|”, which results in “||”. If I want only a single “|”, I click the “TAB”, but this concatenates the equal sign with the vertical bar (a left double turnstile).
A possible solution is to leave the double “||”, add the “0” and the “rangle” (\rangle), and then go back and delete the unwanted “|”.
There must be a better way…

Also, if I want to write 1/\sqrt{2} as opposed to \frac{1}{\sqrt{2}}, when I write “1/\sqrt…”, TeXmacs combines “/\” to a \land symbol. Do I need to add spaces and delete them later?

Try CTRL+SPACE after the equal sign.
This shouldn’t create a new space but instead “detach” the previous typing.

2 Likes

I usually just to left arrow followed by a right arrow to insert some key typing which avoid “concatenation”. if you need more permanent solution, try to remove the keybinding which you do not use.

In fact ctrl-space too is not meant for that, but for selection (I found it in “Towards semantic mathematical editing” by @vdhoeven) . But it works :wink:

Thanks

I’ll add “Towards semantic mathematical editing” to the list of resources that (partially) cover the required help
Perhaps an AI agent could use these resources, as well as posts in this forum, to give relevant TeXmacs assistance

Typing | \psi \rangle = | 0 \rangle

To type | \psi \rangle = | 0 \rangle in TeXmacs 2.1.1, I would:

  • Create || by typing |.
  • Immediately type y TAB to get \psi.
  • Type > TAB TAB TAB TAB TAB TAB to automatically convert the second | into \rangle.
    ** Note: Alt-r > also works.

This should automatically result in | \psi \rangle which is an <around*> tag with | and \rangle as the opening and closing delimiter arguments surrounding the \psi. Type = and repeat the process for |0\rangle. Since you are not TABʼing the || after the =, the ⫤ glyph will not result.

In case you want a macro, here is one.
screen-20240616T164025 screen-20240616T164020

Typing 1/\sqrt2

To type 1/\sqrt2 the TeXmacs way, I would type: 1 / Alt-s 2

Alternatively, 1 / Meta-i l s q r t RET 2 also works which allows you to continue to use the \sqrt LaTeX expression via the Meta-i l shortcut mentioned as a more specific alternative to \ on page 31 of The Jolly Writer (“2.3.3 Hybrid commands and LaTeX emulation”).

I hope this helps.

2 Likes
2 Likes