Is there a way to automatically convert instances of <= and >= to \leq and \geq ? I keep typing <= and >= by mistake.

  • 4
    If you're not using => in any other contexts, a simple find and replace in your editor would help. – Torbjørn T. Oct 10 '11 at 15:35
  • possible duplicate of unescaped macros – Aditya Oct 11 '11 at 2:57

It's doable, in principle.

{\catcode`<=\active \global\let<\perhapsless}

{\catcode`>=\active \global\let>\perhapsgreater}

Then $a<=b<c$ will resolve into the correct symbols.

But I wouldn't rely on such automatisms. Better doing a "search and replace" and accustom to write \leq and \geq (or, as I do, \le and \ge).

| improve this answer | |
  • Thanks =) Interesting solution (although not really pretty ;) – Clément Oct 10 '11 at 15:56
  • 3
    @Clément Just add it to the preamble and forget about it; however I don't recommend going this way. – egreg Oct 10 '11 at 16:05

IMHO, it is better to instruct your text editor to correct automatically all your favorite misprints on fly. For my favorite editor WinEdt I have coded several such rules. Here are two rules which convert << and ББ (ББ is << typed on Russian keybord) into right quote '«' and automatically add the left quote '»' after current word.



In current version 6.0 of WinEdt these rulles are to placed into Active Strings throug Options | Delimiters, Active Strings, Abbreviations... menu.

| improve this answer | |

Probably not what you want unless you're using it anyway, but siunitx does this (and <<, >> to $\ll$, $\gg$ respectively) automagically.

| improve this answer | |

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.