0

Using AUCTeX with LaTeX-math-mode enabled, if I type (say) ` a inside a mathematical environment, it inserts \alpha, as I want. But if I do it outside a mathematical environment, it inserts \alpha{}.

A minor point of curiosity is why it does this? I can't imagine why I would want this.

But my main question:

I would much prefer it to insert $\alpha$, or \(\alpha\) if you prefer. Is there an easy way to make it do this? Preferably one that doesn't involve going through all the Greek letters one by one. Or is there some reason why I shouldn't really want this?

I know that C-u ` a will do what I want, but I wondered whether there is some way of dispensing with the C-u since I have no use for the default behaviour of ` a.

2 Answers 2

1

A minor point of curiosity is why it does this? I can't imagine why I would want this.

A reason why one could want this, is that in the expression \alpha hello, the space will be used to indicate the end of the macro \alpha and thus there will be no space before the word hello.

I think this setting is stored in TeX-insert-braces and it can be further customized with TeX-insert-braces-alist.

I would much prefer it to insert $\alpha$, or (\alpha) if you prefer. Is there an easy way to make it do this? Preferably one that doesn't involve going through all the Greek letters one by one. Or is there some reason why I shouldn't really want this?

This works for me using company auto-completion and its company-auctex-symbols backend.

3
  • 1
    Thanks. Yes, that's probably why the braces are inserted, although you would need \alpha to mean something outside a mathematical environment, which it doesn't by default. It's not so much that I don't want the braces, but that I do want \alpha to be inserted inside dollar signs, so I don't think customizing TeX-insert-braces would do what I want. But thanks for the suggestion. I haven't used company-mode, but I don't think this would give me a two-key way of inserting $\alpha$, would it? Commented Aug 17, 2020 at 8:24
  • Unfortunately not. I type \alp and then choose \alpha from the list, actually pressing down-arrow and enter. I prefer this over Shift-^ for the backtick, then space (because the backtick is a dead key in my country's keyboard layout) and finally a. Maybe someone will come up with a solution. Commented Aug 17, 2020 at 9:38
  • Also, you are completely right. I always thought one could use \alpha for the greek letter α. Commented Aug 17, 2020 at 9:39
0

I recently discovered CDLaTeX, which does exactly what I wanted (and more).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.