I'ld like to make -> a shortcut for \rightarrow. Is that possible with Plain TeX or has it to do with the loaded font?

  • 2
    Short answer: This is not possible. Longer answer: You can do it, but either you break everything relying on the use of - (including dimension computation) or you re-create the font tables, which is quite complicated and makes your document not portable. But I'm not an expert on fonts in LaTeX. And very likely this is easily doable in LuaLaTeX.
    – yo'
    Commented Oct 30, 2013 at 13:53
  • 2
    Another question is what do you wan to use it for? I've used -> as a separator in macros, that is quite useful. As in \def\test #1 -> #2\par{#1 $\rightarrow$ #2\par} or similar.
    – daleif
    Commented Oct 30, 2013 at 13:55
  • @daleif the aim is to lighten source writing, especially when \Leftrightarrow are common (and write sources with the obvious <=>). Also I haven't seen anywhere how ligatures are defined so I'm curious of the user is allowed to. But maybe the most convenient way is to redefine the arrows with shorter names (for example \to and \ot for left/right arrows, \tto and \ott for the double arrows) Commented Oct 30, 2013 at 16:05
  • 2
    Well, \to actually exists. Defining \ot doesn't sound sooo bad. Then \implies and \iff exist, and you can define \impliedby. IMHO that makes the code quite readable ;)
    – yo'
    Commented Oct 30, 2013 at 17:15
  • 1
    Apart from amsmath and other LaTeX packages for the symbols themselves, this is already done in How could LaTeX replace the tokens <= by the command \leq?, isn’t it? Commented Oct 30, 2013 at 20:08

2 Answers 2


Make - math active and assign it a suitable definition.


$A->B$ and $a-b$


enter image description here

Then avoid doing it.

You might enjoy using UTF-8 characters for this:

% <E2> is one of the prefixes for three byte UTF-8 sequences
%% similar definition to the above should be made for
%% other prefixes

% the following defines a single Unicode character



  • 1
    To this correct answer, I would add that it is very easy to type the → character if you can configure a compose key on your keyboard. (Otherwise you would probably have to rely on some kind of palette character to type the →.) Commented Oct 30, 2013 at 22:26
  • You define the macro \togr, which I think is a typo of \toarg. Commented Nov 1, 2013 at 10:12

A humble, faulty attempt, inspired by tohecz, and mainly based on my answer to Censoring Curse Words with Grawlixes:

The converter.lua file:

symbols = { "%-%>", "%=%>", "%<%-", "%<%=" }
replacements = { ["%-%>"] = "\\rightarrow ", ["%=%>"] = "\\Rightarrow ", ["%<%-"] = "\\leftarrow ", ["%<%="] = "\\Leftarrow " }

function replace(line)
    for _, element in pairs(symbols) do
        if string.find(line, element) then
           return string.gsub(line, element, replacements[element])
    return line, 0

function converter(line)
    occurrences = 0
        line, occurrences = replace(line)
    until occurrences == 0
    return line

callback.register('process_input_buffer', converter)

Then, in the main TeX file:


Hello world, $A -> B$, $A => B$, $B <- A$, $B <= A$.


Of course, this solution requires LuaTeX. :) The output:


I can point at least one problem:

  • Naive replacement algorithm, it's just based on pattern replacement. There might be parts of the text where things will break terribly.

An improvement of this code might be a good exercise for the reader. :)

  • 1
    Well, but that's not your mistake. Of course, how can LuaTeX know what $n<-1$ is supposed to mean? :)
    – yo'
    Commented Oct 30, 2013 at 17:13
  • @tohecz: awwww ♥ Commented Oct 30, 2013 at 17:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .