An unexpected behavior importing from latex

I just found that a behavior in importing from latex is not expected.

(define from "latex-snippet")
(define to "texmacs-stree")
(convert "$a b$" "latex-snippet" "texmacs-stree")

The code means that importing math formula $a b$ from latex to texmacs. The result has an extra * in between. The result is (math "a*b"), what I really want is (math "a b"). Anyone knows how to change this behavior?

I do not know if it is possible to modify the latex->texmacs converter in the sense you ask for (that is, giving a different output for a given input), so perhaps the way to get to the expression you desire is to remove the asterisk with an additional function.
If you want a more authoritative answer, perhaps asking on the mailing list could give you that, since Joris van der Hoeven reads that only :slight_smile:
Said this, (math "a*b") is the output that I would expect from that input, but maybe you know that already.

Which is impossible … when I wrote I had not thought that you would need to distinguish between asterisk that have been placed between factors and other asterisks and in particular that you cannot distinguish between the conversion of "$a b$" and of "$a*b$".

Edit: I have to correct this too. The conversion of "$a*b$" is (math "a<ast>b"). So perhaps the only asterisks one gets out of the LaTeX->TeXmacs conversion are the ones generated by empty spaces, and that would make it possible to eliminate them with a function. On the other hand, this is not a general solution for customization of the conversion.

It is quite strange though that (math "a*b") exporting to latex is $ab$. I guess this behavior affects nothing.

I do not know where to find the statement in an authoritative source (perhaps the TeXbook), but I guess that $ab$ and $a b$ are identical in TeX.

1 Like

In TeX ab is the same as a b. Single roman letters are considered separated variables with implicit multiplication, that is why TeXmacs insert * to preserve semantics.@susoren What is the problem you are trying to solve?