From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: Re: LaTeX-Fill-Paragraph and inline images Date: 10 Feb 2003 21:38:07 +0100 Organization: T-Online Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: <843cmxjvr7.fsf@lucy.is.informatik.uni-duisburg.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1044909726 31155 80.91.224.249 (10 Feb 2003 20:42:06 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 10 Feb 2003 20:42:06 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18iKkc-00086B-00 for ; Mon, 10 Feb 2003 21:42:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18iKjA-0007Eh-06 for gnu-help-gnu-emacs@m.gmane.org; Mon, 10 Feb 2003 15:40:32 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.stueberl.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 54 Original-X-Trace: news.t-online.com 1044909487 01 962 jvsfETlTWAaKC 030210 20:38:07 Original-X-Complaints-To: abuse@t-online.com X-Sender: 520018396234-0001@t-dialin.net X-Face: 2FEFf>]>q>2iw=B6,xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN;i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-Xref: shelby.stanford.edu gnu.emacs.help:110034 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:6539 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:6539 "Felix E. Klee" writes: > David Kastrup wrote: > >> What are overlays? The problem occurs because LaTeX-Fill-Paragraph > >> formats text according to the underlying source code, it doesn't know > >> about the inline images. An formatting algorithm that might work > >> would be something like this: > >> > >> 1. Go to the beginning of a paragraph. > >> 2. Remove all newlines from that paragraph > >> 3. Set the variable LINE_WIDTH to 0. > >> 4. Add the width of the next visible entity (single character, inline > >> image, ...) to LINE_WIDTH. > >> 5. If LINE_WIDTH > MAX_LINE_WIDTH then > >> a) In the paragraph add a newline before the last entity > >> processed. b) Go back one entity. > >> c) Continue at step 3 unless we're finished with formatting the > >> paragraph. > >> else > >> Continue at step 4. > > > > If things were that easy... The intent of the formatting from AUCTeX > > is to make the source more readable. Are those images part of the > > source? Debatable. But it may not be a good idea to break things > > like text math across lines when it can be reasonably avoided, anyway. > > > > Your "algorithm" also more or less seems to imply using "entities". > > AUCTeX not only formats, it also indents. Should it be looking > > inside of "entities" for that purpose? And so on... > > The algorithm should not format the source of the entities. It should > only format what is visible to the user after he has applied > preview-latex. Why? The purpose of AUCTeX's formatting is not to make the source ugly when one does not use preview-latex. One wants to have a reasonable look of the source also in that case. > > Of course, the current interaction (or rather its completely absence) > > of preview-latex and AUCTeX is not nice in that regard. Would you > > want to work on it? > > It would be interesting to try out the algorithm on plain text documents > that are displayed with a variable width font. Do you know how to get > the width in pixels of an "entity". char-width, string-width, and more complicated commands (like compute-motion) come to mind. Probably quite different with XEmacs, though. Take a look at the respective sections in the Emacs Lisp manual. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum