auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LaTeX-math-list: Binding on key sequences?


From: Arash Esbati
Subject: Re: LaTeX-math-list: Binding on key sequences?
Date: Wed, 14 Jul 2021 11:38:09 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50

Hi Keita,

Ikumi Keita <ikumi@ikumi.que.jp> writes:

>>>>>> Heiko Schröder <heikos@online.de> writes:
>>  I tried:
>
>
>> (setq LaTeX-math-list
>
>>      '((''g a''  ''alpha'' ''Greek Lowercase'' 945)))
>
>
>> with no success, as I expected.  Why was it possible to bind
>> ''varepsilon'' to a key sequence?
>
>> Isn't it possible for normal users?  ;-)
>
> The reason why this doesn't succeed is that the key <g> is already bound
> to command to insert "\gamma" and isn't a prefix key.

Reading this thread, I think the docstring of `LaTeX-math-list' doesn't
mention this possibility at all:

,----[ C-h v LaTeX-math-list RET ]
| LaTeX-math-list is a variable defined in ‘latex.el’.
| 
| Alist of your personal LaTeX math symbols.
| 
| Each entry should be a list with up to four elements, KEY, VALUE,
| MENU and CHARACTER.
| 
| KEY is the key (after ‘LaTeX-math-abbrev-prefix’) to be redefined
| in math minor mode.  If KEY is nil, the symbol has no associated
| keystroke (it is available in the menu, though).
| 
| [...]
`----

Adding "Key sequence" with a string as KEY is missing.

> Try this:
>
> (eval-after-load "latex"
>   '(progn
>      ;; Remove default <g> binding.
>      (setq LaTeX-math-default
>          (delq (assq ?g LaTeX-math-default) LaTeX-math-default))
>      ;; Clear and remake keymap.
>      (setq LaTeX-math-keymap (make-sparse-keymap))
>      (setq LaTeX-math-list
>          '(("g a" "alpha" "Greek Lowercase" 945)))
>      (LaTeX-math-initialize)
>      ;; Bind new keymap.
>      (define-key LaTeX-math-mode-map
>            (LaTeX-math-abbrev-prefix) LaTeX-math-keymap)))

I also think we should give users a key for personal key sequences
instead of replacing the predefined ones.  A list of keys used by
`LaTeX-math-default' is attached below.  'o' seems to be free in the
lowercase area.  What do you and others think?

--8<---------------cut here---------------start------------->8---
(defconst LaTeX-math-default
  '((?a "alpha" "Greek Lowercase" 945)
    (?b "beta" "Greek Lowercase" 946)
    (?c LaTeX-math-cal "Cal-whatever")
    (?d "delta" "Greek Lowercase" 948)
    (?e "epsilon" "Greek Lowercase" 1013)
    (?f "phi" "Greek Lowercase" 981)
    (?g "gamma" "Greek Lowercase" 947)
    (?h "eta" "Greek Lowercase" 951)
    (?i "in" "Relational" 8712)
    (?j "theta" "Greek Lowercase" 952)
    (?k "kappa" "Greek Lowercase" 954)
    (?l "lambda" "Greek Lowercase" 955)
    (?m "mu" "Greek Lowercase" 956)
    (?n "nu" "Greek Lowercase" 957)
    (?p "pi" "Greek Lowercase" 960)
    (?q "chi" "Greek Lowercase" 967)
    (?r "rho" "Greek Lowercase" 961)
    (?s "sigma" "Greek Lowercase" 963)
    (?t "tau" "Greek Lowercase" 964)
    (?u "upsilon" "Greek Lowercase" 965)
    ("v e" "varepsilon" "Greek Lowercase" 949)
    ("v f" "varphi" "Greek Lowercase" 966)
    ("v j" "vartheta" "Greek Lowercase" 977)
    ("v k" "varkappa" ("AMS" "Greek Lowercase") 1008)
    ("v p" "varpi" "Greek Lowercase" 982)
    ("v r" "varrho" "Greek Lowercase" 1009)
    ("v s" "varsigma" "Greek Lowercase" 962)
    ("v D" "varDelta" ("AMS" "Greek Uppercase") 120549)
    ("v F" "varPhi" ("AMS" "Greek Uppercase") 120567)
    ("v G" "varGamma" ("AMS" "Greek Uppercase") 120548)
    ("v J" "varTheta" ("AMS" "Greek Uppercase") 120553)
    ("v L" "varLambda" ("AMS" "Greek Uppercase") 120556)
    ("v P" "varPi" ("AMS" "Greek Uppercase") 120561)
    ("v S" "varSigma" ("AMS" "Greek Uppercase") 120564)
    ("v U" "varUpsilon" ("AMS" "Greek Uppercase") 120566)
    ("v W" "varOmega" ("AMS" "Greek Uppercase") 120570)
    ("v X" "varXi" ("AMS" "Greek Uppercase") 120559)
    ("v Y" "varPsi" ("AMS" "Greek Uppercase") 120569)
    (?w "omega" "Greek Lowercase" 969)
    (?x "xi" "Greek Lowercase" 958)
    (?y "psi" "Greek Lowercase" 968)
    (?z "zeta" "Greek Lowercase" 950)
    (?A "forall" "Misc Symbol" 8704)
    (?D "Delta" "Greek Uppercase" 916)
    (?E "exists" "Misc Symbol" 8707)
    (?F "Phi" "Greek Uppercase" 934)
    (?G "Gamma" "Greek Uppercase" 915)
    (?I "infty" "Misc Symbol" 8734)
    (?J "Theta" "Greek Uppercase" 920)
    (?L "Lambda" "Greek Uppercase" 923)
    (?N "nabla" "Misc Symbol" 8711)
    (?P "Pi" "Greek Uppercase" 928)
    (?S "Sigma" "Greek Uppercase" 931)
    (?U "Upsilon" "Greek Uppercase" 978)
    (?W "Omega" "Greek Uppercase" 937)
    (?X "Xi" "Greek Uppercase" 926)
    (?Y "Psi" "Greek Uppercase" 936)

    (?& "wedge" "Binary Op" 8743)
    (?* "times" "Binary Op" 215)
    (?+ "cup" "Binary Op" 8746)
    (?- "cap" "Binary Op" 8745)
    (?. "cdot" "Binary Op" 8901)
    (?/ "not" "Misc Symbol" 824)
    (?0 "emptyset" "Misc Symbol" 8709)
    (?: "colon" "Punctuation" 58)
    (?< "leq" "Relational" 8804)
    (?> "geq" "Relational" 8805)
    (?\( "langle" "Delimiters" 10216)
    (?\) "rangle" "Delimiters" 10217)
    (?\[ "subseteq" "Relational" 8838)
    (?\\ "setminus" "Binary Op" 8726)
    (?\] "supseteq" "Relational" 8839)
    (?\{ "subset" "Relational" 8834)
    (?\} "supset" "Relational" 8835)
    (?^ "hat" "Accents" 770)
    (?| "vee" "Binary Op" 8744)
    (?~ "tilde" "Accents" 771)
    (?\C-^ "sup" "Log-like")
    (?\C-_ "inf" "Log-like")
    (?\C-b "leftarrow" "Arrows" 8592)
    (?\C-c "cos" "Log-like")
    (?\C-d "det" "Log-like")
    (?\C-e "exp" "Log-like")
    (?\C-f "rightarrow" "Arrows" 8594)
    (?\C-l "lim" "Log-like")
    (?\C-n "downarrow" "Arrows" 8595)
    (?\C-p "uparrow" "Arrows" 8593)
    (?\C-s "sin" "Log-like")
    (?\C-t "tan" "Log-like"))
  "Alist of LaTeX math symbols.

Each entry should be a list with upto four elements, KEY, VALUE,
MENU and CHARACTER, see `LaTeX-math-list' for details.")
--8<---------------cut here---------------end--------------->8---

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]