[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/cdlatex 90d785a94c 13/49: New option `cdlatex-sub-super-sc
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/cdlatex 90d785a94c 13/49: New option `cdlatex-sub-super-scripts-outside-math-mode'. |
Date: |
Mon, 11 Jul 2022 02:58:32 -0400 (EDT) |
branch: elpa/cdlatex
commit 90d785a94c0db7aa0043ea62f5807af3df155438
Author: Carsten Dominik <carsten.dominik@gmail.com>
Commit: GitHub <noreply@github.com>
New option `cdlatex-sub-super-scripts-outside-math-mode'.
Thanks to Benedikt Tissot for suggesting it.
---
cdlatex.el | 48 +++++++++++++++++++++++++++++-------------------
1 file changed, 29 insertions(+), 19 deletions(-)
diff --git a/cdlatex.el b/cdlatex.el
index 9c3a2d7d37..e2e6be1f8c 100644
--- a/cdlatex.el
+++ b/cdlatex.el
@@ -1,9 +1,9 @@
;;; cdlatex.el --- Fast input methods for LaTeX environments and math
-;; Copyright (c) 2010, 2011, 2012, 2014 Free Software Foundation, Inc.
+;; Copyright (c) 2010, 2011, 2012, 2014, 2019 Free Software Foundation, Inc.
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Keywords: tex
-;; Version: 4.7
+;; Version: 4.8
;;
;; This file is not part of GNU Emacs.
;;
@@ -551,6 +551,13 @@ letter, the parenthesis will be removed."
:group 'cdlatex-miscellaneous-configurations
:type '(boolean))
+(defcustom cdlatex-sub-super-scripts-outside-math-mode t
+ "*Non-nil means, inserting ^ or _ will add dollars outside math environment.
+So in text mode surrounding dollars and braces will be added with `_' and `^'.
+When nil, `_' and `^' will just self-insert."
+ :group 'cdlatex-miscellaneous-configurations
+ :type '(boolean))
+
(defcustom cdlatex-auto-help-delay 1.5
"Number of idle seconds before display of auto-help.
When executing cdlatex-math-symbol or cdlatex-math-modify, display
@@ -772,23 +779,26 @@ When not in LaTeX math environment, _{} and ^{} will have
dollars."
(if (cdlatex-number-of-backslashes-is-odd)
;; Quoted
(insert (event-basic-type last-command-event))
- ;; Check if we need to switch to math mode
- (if (not (texmathp)) (cdlatex-dollar))
- (if (string= (buffer-substring (max (point-min) (- (point) 2)) (point))
- (concat (char-to-string (event-basic-type last-command-event))
- "{"))
- ;; We are at the start of a sub/suberscript. Allow a__{b} and a^^{b}
- ;; This is an undocumented feature, please keep it in. It supports
- ;; a special notation which can be used for upright sub- and
- ;; superscripts.
- (progn
- (backward-char 1)
- (insert (event-basic-type last-command-event))
- (forward-char 1))
- ;; Insert the normal template.
- (insert (event-basic-type last-command-event))
- (insert "{}")
- (forward-char -1))))
+ ;; Check if we are in math mode, if not switch to or only add _ or ^
+ (if (and (not (texmathp))
+ (not cdlatex-sub-super-scripts-outside-math-mode))
+ (insert (event-basic-type last-command-event))
+ (if (not (texmathp)) (cdlatex-dollar))
+ (if (string= (buffer-substring (max (point-min) (- (point) 2)) (point))
+ (concat (char-to-string (event-basic-type
last-command-event))
+ "{"))
+ ;; We are at the start of a sub/suberscript. Allow a__{b} and a^^{b}
+ ;; This is an undocumented feature, please keep it in. It supports
+ ;; a special notation which can be used for upright sub- and
+ ;; superscripts.
+ (progn
+ (backward-char 1)
+ (insert (event-basic-type last-command-event))
+ (forward-char 1))
+ ;; Insert the normal template.
+ (insert (event-basic-type last-command-event))
+ (insert "{}")
+ (forward-char -1)))))
(defun cdlatex-lr-pair ()
"Insert a \\left-\\right pair of parens."
- [nongnu] elpa/cdlatex adf96bab0b 29/49: Switch to use `cl-lib', now correctly, (continued)
- [nongnu] elpa/cdlatex adf96bab0b 29/49: Switch to use `cl-lib', now correctly, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 6ae740fccd 34/49: Fixed a couple typos, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex f215b70c5c 33/49: Fix test and math flags for spl abbreviation, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 355614380c 48/49: * cdlatex.el: Fix typos and minor stylistic issues., ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 7791fa94d5 46/49: Bump version to 4.12, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex a15311a52d 45/49: * cdlatex.el (cdlatex-version): Remove variable, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 76e6d8e068 22/49: Add .gitignore, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 017735c611 23/49: Use spl as abbreviation for split, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 4e939a8386 28/49: reversing previous change for now, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 75c4e9c4e5 44/49: Added `text` macro in math mode, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 90d785a94c 13/49: New option `cdlatex-sub-super-scripts-outside-math-mode'.,
ELPA Syncer <=
- [nongnu] elpa/cdlatex 880723a514 17/49: New variable `cdlatex-use-dollar-to-ensure-math'., ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 4d21552480 36/49: Fix whitespace issues, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 07d45fb38e 41/49: Update .gitignore to ignore .elc and package files, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 720f9145d8 31/49: Fix bug when "*CDLaTeX Help*" buffer was read-only, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 573d0918d0 24/49: Make C-c { wrap the region if there is an active region, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 8e963c6853 35/49: Merge pull request #31 from aluaces/patch-1, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 0eb638546c 37/49: Fix checkdoc issues, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex d7bec27d31 42/49: Add .dir-locals.el to prevent whitespace issues, ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex ea52268926 47/49: * cdlatex.el: Fix typos and minor stylistic issues., ELPA Syncer, 2022/07/11
- [nongnu] elpa/cdlatex 4633ecf52d 11/49: modified README., ELPA Syncer, 2022/07/11