From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reiner Steib Newsgroups: gmane.emacs.help,gmane.emacs.devel Subject: Re: tex mode sub- and super-scripts Date: Sun, 01 Jul 2007 10:43:23 +0200 Message-ID: References: <20070630225915.BA9C05F435F@physsmtp.wustl.edu> Reply-To: Reiner Steib NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1183279484 21617 80.91.229.12 (1 Jul 2007 08:44:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 1 Jul 2007 08:44:44 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Mark Alford , Stefan Monnier , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jul 01 10:44:41 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I4v2u-0003ga-04 for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Jul 2007 10:44:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I4v2t-0007of-IC for geh-help-gnu-emacs@m.gmane.org; Sun, 01 Jul 2007 04:44:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I4v2e-0007oM-4D for help-gnu-emacs@gnu.org; Sun, 01 Jul 2007 04:44:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I4v2d-0007oA-CM for help-gnu-emacs@gnu.org; Sun, 01 Jul 2007 04:44:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I4v2d-0007o7-9o; Sun, 01 Jul 2007 04:44:23 -0400 Original-Received: from mail.uni-ulm.de ([134.60.1.11]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1I4v2b-0004ra-3E; Sun, 01 Jul 2007 04:44:21 -0400 Original-Received: from bridgekeeper.physik.uni-ulm.de (bridgekeeper.physik.uni-ulm.de [134.60.10.123]) by mail.uni-ulm.de (8.14.1/8.14.1) with ESMTP id l618iHnw014081; Sun, 1 Jul 2007 10:44:17 +0200 (MEST) Original-Received: from localhost (bridgekeeper.physik.uni-ulm.de [134.60.10.123]) by bridgekeeper.physik.uni-ulm.de (Postfix) with ESMTP id 3CC7412A9C; Sun, 1 Jul 2007 10:44:17 +0200 (CEST) X-Face: /U7=m^"/-Dn61mAl{g9e3>\G5Tp,oEX|V)g2I1hBk\ML; )7A?6cmB-y7y?'NA^J<=oz7syB =(McAwIHgLX!.B?R3X}98d@?>CrT094KLWh]WU4gDpnL/")MS(XoQTv`Oq225uL>+; CpPXo$N5e>N> $tPd-gbB^F{gQS#1ase]XO~D4p4M"3+F-7~u]dy3I?Pb8RO*H-EFeWDUf?Rf, d]pv\Jvh2Cht!A=im yKAS2Z%Ao^;}W/qzMvMm Mail-Followup-To: Mark Alford , In-Reply-To: (Eli Zaretskii's message of "Sun, 01 Jul 2007 06:15:23 +0300") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) X-DCC--Metrics: poseidon 104; Body=5 Fuz1=5 Fuz2=5 X-Virus-Scanned: by amavisd-new X-MIME-Autoconverted: from 8bit to quoted-printable by mail.uni-ulm.de id l618iHnw014081 X-detected-kernel: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:45402 gmane.emacs.devel:74092 Archived-At: [ I'd suggest to move this discussion to . 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 =3D 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 >>=20 >> Eli Zaretskii wrote: >> > You should be able to customize the two faces `subscript' and >> > `superscript' defined by tex-mode. >>=20 >> 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=09 @@ -243,6 +243,21 @@ :options '("''" "\">" "\"'" ">>" "=BB") :group 'tex) =20 +(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 t= he @@ -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))))) =20 (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 ,----[ v font-latex-fontify-script RET ] | font-latex-fontify-script is a variable defined in `font-latex'. | Its value is t |=20 | This variable is safe as a file local variable if its value | satisfies the predicate `TeX-booleanp'. |=20 | Documentation: | If non-nil, fontify subscript and superscript strings. | This feature does not work in XEmacs. |=20 | 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. |=20 | 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. `---- --=20 ,,, (o o) ---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/