# Is it possible to activate text mode automatically when typing more than one character inside equations?

Let’s say I want to type something like:

y = \frac{1}{| x |}, \quad x \text{ cannot be } 0

In the above example, I had to manually use the \text{} inside y = \frac{1}{| x |}, \quad x \text{ cannot be } 0.

If I simply type things out in TeXmacs, I get the following: y = \frac{1}{| x |}, \quad x \tmop{cannot} \tmop{be} 0.

I would like for TeXmacs to treat every consecutive set of characters as text instead of tmop by default. Can this be done?

First, tp avoid confusions, I would like to stress that TeXmacs is not a LaTeX editor. It has its self format and rendering engine.

The phenomenon that you encountered is due to the semantic incorrectness (cf. https://www.texmacs.org/joris/2011/magixalix2/magixalix2-abs.html) of what you typed, which is interpreted as something like the composition of operations x, cannot, be, and 0, as \tmop indicates.

The semantically correct way is to put all this condituon into a text tag, and then put x and 0 in a nested math tag — this whole sentence is a text, and x and 0 are math formulae in this sentence.

I know that it’s semantically incorrect, but it’s way more convenient not to have to type \text every time I want to type a bunch of characters. 99.9% of the time when I type a bunch of characters consecutively, I want them to be text. It is possible to force this behaviour automatically?

I do not know if it is possible to have TeXmacs interpret consecutive characters as text (it may take quite a lot of programming with Scheme), but you can switch to text inside math by pressing the Alt+$key combination. TeXmacs is a structured editor. Convenience is a matter of use and subjective, by the same token another user could ask that TeXmacs should enter math mode automatically when one start typing some “math” (whatever this means). However defining in a reasonably good way what should be considered math or text it is not so trivial, and any half baked solution just add to noise. Maybe you should give a suggestion on how one could go to differentiate text and math. I find perfectly “symmetric” that you have to press “Cltr+$” to enter text mode inside math mode. Actually to structurally correctly enter the example you wrote I would have entered text mode after the comma and then entered math mode to type “x” and “0” within the text mode since this would give you the right spacing, i.e.

<\equation*>
y=<frac|x|<around*|\||x|\|>>,<space|2em><text|<math|x> cannot be <math|0>;>
</equation*>


Indeed, semantically “x” and “0” are part of the sentence “x cannot be 0” and not of the surrounding equation.