[Top][All Lists]

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

Re: LaTeX-Fill-Paragraph and inline images

From: David Kastrup
Subject: Re: LaTeX-Fill-Paragraph and inline images
Date: 10 Feb 2003 21:38:07 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"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.
> >>      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,

Take a look at the respective sections in the Emacs Lisp manual.

David Kastrup, Kriemhildstr. 15, 44793 Bochum

reply via email to

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