2

Today I wrote something with quite a few indices and I think it's a bit annoying to always have to write the underscore. It really has a big impact on the typing speed. Therefore I was wondering if I could somehow tell LaTeX:

If you are in math mode and there is some kind of letter, if this letter ends with an i or j this is a subscript.

For example, by typing $Ai$ I want this to look like $A_i$ and $\omegaij$ should become $\omega_{i,j}$. Of course this would limit me in my choice of variables, but it would be worth it and maybe one could even define an escape for this.

I can't believe this hasn't already be done somewhere. I was looking for packages, but I didn't find anything like this. Do you know any package or how to implement this myself?

closed as too broad by egreg, Stefan Pinnow, Raaja, Phelype Oleinik, siracusa Aug 15 at 4:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 6
    instead of wasting time to implement this, better train your typing speed. An underscore is only one char and not slower to type than a or f or z. – Ulrike Fischer Jul 15 at 16:12
  • 3
    This kind of thing should be done with an editor (like EMACS or VIm) rather than LaTeX. – Toothrot Jul 15 at 16:38
  • 1
    If the problem is that _ is hard to reach on your local keyboard layout you could use a more easily typed character. – David Carlisle Jul 15 at 18:33
  • or change the layout – Toothrot Jul 16 at 10:12
  • Thanks for your answers. How would I do this with an editor? Do you mean something like defining an autocompletion? Also, changing the layout might be worth thinking about too. German keyboards don't go well with typical latex commands... – Kaldena Jul 17 at 12:19
3

You could define a new command with a frequent subscript, for instance, in the preamble you can add:

\newcommand{\uij}{_{i,j}}

and use this in the document:

$\omega\uij$

This is an answer, however, as @Toothrot and @Ulrike Fischer said, there are other options.

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