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.

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.

  • 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? – Jeremy Rickard Aug 17 '20 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. – Philipp Imhof Aug 17 '20 at 9:38
  • Also, you are completely right. I always thought one could use \alpha for the greek letter α. – Philipp Imhof Aug 17 '20 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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