- Subject: Arrows in LaTeX4Jed
- From: Guido Gonzato <ggonza@xxxxxx>
- Date: Fri, 23 May 2003 14:28:47 +0200 (CEST)
Hello,
I have fixed the bug and added an alternative way to insert math arrows in
LaTeX4Jed. Instead of using Joerg's implementation, which is nice but
somewhat confusing ('->' becomes \rightarrow, but \leftarrow is given by
'-<'), I have written this code:
define latex_arrow ()
{
  % right arrows
  if (LAST_CHAR == '>') {
    if (blooking_at ("--")) {
      go_left (2);
      deln (2);
      insert ("{\\longrightarrow}");
      return;
    }
    if (blooking_at ("==")) {
      go_left (2);
      deln (2);
      insert ("{\\Longrightarrow}");
      return;
    }
    % left-right
    if (blooking_at ("<-")) {
      go_left (2);
      deln (2);
      insert ("{\\leftrightarrow}");
      return;
    }
    if (blooking_at ("<=")) {
      go_left (2);
      deln (2);
      insert ("{\\Leftrightarrow}");
      return;
    }
    if (blooking_at ("-")) {
      go_left (1);
      deln (1);
      insert ("{\\rightarrow}");
      return;
    }
    if (blooking_at ("=")) {
      go_left (1);
      deln (1);
      insert ("{\\Rightarrow}");
      return;
    }
    insert (">");
  }
  % simple left arrows
  if (LAST_CHAR == '-') {
    if (blooking_at ("<-")) { % '-' must be forced!
      go_left (2);
      deln (2);
      insert ("{\\longleftarrow}");
      return;
    }
    if (blooking_at ("<")) {
      go_left (1);
      deln (1);
      insert ("{\\leftarrow}");
      return;
    }
    insert ("-");
  }
  % double left arrows
  if (LAST_CHAR == '=') {
    if (blooking_at ("<=")) { % '=' must be forced!
      go_left (2);
      deln (2);
      insert ("{\\Longleftarrow}");
      return;
    }
    if (blooking_at ("<")) {
      go_left (1);
      deln (1);
      insert ("{\\Leftarrow}");
      return;
    }
    insert ("=");
  }    
}
...
definekey ("latex_arrow", ">", $1);
definekey ("latex_arrow", "-", $1);
definekey ("latex_arrow", "=", $1);
This function works in a hopefully more consistent manner:
->     \rightarrow
-->    \longrightarrow
=>     \Rightarrow
==>    \Longrightarrow
<->    \leftrightarrow
<=>    \Leftrightarrow
<-     \leftarrow
<--    \longleftarrow  (*)
<=     \Leftarrow
<==    \Longleftarrow  (*)
The two symbols marked by asterisk cannot by typed normally, because as
soon as you type, say, '<-', \leftarrow is inserted. To insert
\longleftarrow, you must type '<', `- (backquote minus), '-'. Similarly
for \Longleftarrow. Another way would be to use a prefix: ESC 1 <- would
insert \longleftarrow.
Which one would you suggest I implement?
Later,
      Guido =8-)
-- 
Guido Gonzato, Ph.D. <guido . gonzato at univr . it> - Linux System Manager
Universita' di Verona (Italy), Facolta' di Scienze MM. FF. NN.
Ca' Vignal II, Strada Le Grazie 15, 37134 Verona (Italy)
Tel. +39 045 8027990; Fax +39 045 8027928 --- Timeas hominem unius libri
--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.
  [2003 date index]
  [2003 thread index]
  
  [Thread Prev] [Thread Next]
      
  [Date Prev] [Date Next]