From: Reiner Steib <reinersteib+gmane@imap.cc>
To: Eli Zaretskii <eliz@gnu.org>
Cc: help-gnu-emacs@gnu.org, Mark Alford <alford@wuphys.wustl.edu>,
Stefan Monnier <monnier@iro.umontreal.ca>,
emacs-devel@gnu.org
Subject: Re: tex mode sub- and super-scripts
Date: Sun, 01 Jul 2007 10:43:23 +0200 [thread overview]
Message-ID: <v9y7i05xas.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <u1wfsn7as.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 01 Jul 2007 06:15:23 +0300")
[ I'd suggest to move this discussion to <emacs-devel@gnu.org>.
Summary: In Emacs TeX-mode (textmodes/tex-mode.el), there's no
option to suppress the raise/lowering of superscripts and
subscripts. In AUCTeX, we used tex-mode.el's code, but added
options to turn off this feature.
%%%%%%%%%%
$a_0 = a_{f}^{2} + b_{\alpha}$
\bye
%%%%%%%%%%
]
On Sun, Jul 01 2007, Eli Zaretskii wrote:
>> Date: Sat, 30 Jun 2007 21:02:56 -0500 (CDT)
>> From: Mark Alford <alford@wuphys.wustl.edu>
>>
>> Eli Zaretskii <eliz@gnu.org> wrote:
>> > You should be able to customize the two faces `subscript' and
>> > `superscript' defined by tex-mode.
>>
>> I can control their size but not their raising/lowering.
[...]
> It seems to be explicit code, see tex-font-lock-suscript. [...]
>
> I suggest to submit a bug report asking for this feature to be
> customizable.
I'd be willing to port AUCTeX's customization options ([1], code
written by me) to tex-mode.el. Any objections? Stefan?
(If it's okay to install this patch, should it go to the Emacs 22
branch?)
--8<---------------cut here---------------start------------->8---
--- tex-mode.el 20 May 2007 15:18:56 +0200 1.186
+++ tex-mode.el 01 Jul 2007 10:38:31 +0200
@@ -243,6 +243,21 @@
:options '("''" "\">" "\"'" ">>" "»")
:group 'tex)
+(defcustom tex-fontify-script t
+ "If non-nil, fontify subscript and superscript strings."
+ :type 'boolean
+ :group 'tex)
+(put 'tex-fontify-script 'safe-local-variable 'booleanp)
+
+(defcustom tex-font-script-display '((raise -0.3) . (raise 0.3))
+ "Display specification for subscript and superscript content.
+The car is used for subscript, the cdr is used for superscripts."
+ :group 'tex
+ :type '(cons (choice (sexp :tag "Subscript form")
+ (const :tag "No lowering" nil))
+ (choice (sexp :tag "Superscript form")
+ (const :tag "No raising" nil))))
+
(defvar tex-last-temp-file nil
"Latest temporary file generated by \\[tex-region] and \\[tex-buffer].
Deleted when the \\[tex-region] or \\[tex-buffer] is next run, or when the
@@ -593,13 +608,14 @@
(setq pos (1- pos) odd (not odd)))
odd))
(if (eq (char-after pos) ?_)
- '(face subscript display (raise -0.3))
- '(face superscript display (raise +0.3)))))
+ '(face subscript display (car tex-font-script-display))
+ '(face superscript display (cdr tex-font-script-display)))))
(defun tex-font-lock-match-suscript (limit)
"Match subscript and superscript patterns up to LIMIT."
- (when (re-search-forward "[_^] *\\([^\n\\{}]\\|\
-\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t)
+ (when (and tex-fontify-script
+ (re-search-forward "[_^] *\\([^\n\\{}]\\|\
+\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t))
(when (match-end 3)
(let ((beg (match-beginning 3))
(end (save-restriction
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
[1] Cf.
http://mid.gmane.org/v93b09938i.fsf%40marauder.physik.uni-ulm.de
http://mid.gmane.org/v9hcop79f3.fsf%40marauder.physik.uni-ulm.de
,----[ <f1> v font-latex-fontify-script RET ]
| font-latex-fontify-script is a variable defined in `font-latex'.
| Its value is t
|
| This variable is safe as a file local variable if its value
| satisfies the predicate `TeX-booleanp'.
|
| Documentation:
| If non-nil, fontify subscript and superscript strings.
| This feature does not work in XEmacs.
|
| You can customize this variable.
`----
,----[ M-x customize-variable RET font-latex-script-display RET ]
| Font Latex Script Display: [Hide Value]
| Choice: [Value Menu] Subscript form: (raise -0.3)
| Choice: [Value Menu] Superscript form: (raise 0.3)
| [State]: STANDARD.
|
| Display specification for subscript and superscript content. [Hide Rest]
| The car is used for subscript, the cdr is used for superscripts.
| Parent groups: [Font Latex]
`----
,----[ M-x customize-variable RET font-latex-script-display RET ]
| font-latex-script-display: [Hide Value]
| Choice: [Value Menu] No lowering
| Choice: [Value Menu] No raising
| [State]: SET for current session only.
`----
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
next prev parent reply other threads:[~2007-07-01 8:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070630225915.BA9C05F435F@physsmtp.wustl.edu>
2007-07-01 2:02 ` tex mode sub- and super-scripts Mark Alford
2007-07-01 3:15 ` Eli Zaretskii
2007-07-01 8:43 ` Reiner Steib [this message]
[not found] <mailman.2828.1183170710.32220.help-gnu-emacs@gnu.org>
2007-07-12 19:48 ` Stefan Monnier
2007-06-30 2:30 Mark Alford
2007-06-30 8:55 ` Peter Dyballa
2007-06-30 9:29 ` Sebastian Meisel
2007-06-30 11:00 ` Peter Dyballa
2007-06-30 15:24 ` Reiner Steib
2007-06-30 9:54 ` Reiner Steib
2007-06-30 15:16 ` Mark Alford
2007-06-30 16:02 ` Peter Dyballa
2007-06-30 18:27 ` Eli Zaretskii
2007-06-30 11:13 ` Eli Zaretskii
[not found] ` <mailman.2836.1183193714.32220.help-gnu-emacs@gnu.org>
2007-07-01 8:40 ` David Kastrup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=v9y7i05xas.fsf@marauder.physik.uni-ulm.de \
--to=reinersteib+gmane@imap.cc \
--cc=Reiner.Steib@gmx.de \
--cc=alford@wuphys.wustl.edu \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=help-gnu-emacs@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).