help-gnu-emacs
[Top][All Lists]
Advanced

[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: 09 Feb 2003 17:37:32 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Felix E. Klee" <felix.klee@inka.de> writes:

> Kai Gro├čjohann wrote:
> >> Therefore, I'm looking for a LaTeX-Fill-Paragraph replacement that
> >> breaks lines correctly when inline images are used. Instead of
> >> specifying a fill column the user would specify the desired width of
> >> paragraphs in pixels or centimeters. This might also be interesting
> >> when using variable width fonts instead of fixed width fonts.
> > 
> > Does this problem come from using images, or from using overlays?  I
> > think it's probably the overlays, but I'm not sure.
> 
> 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...

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?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum


reply via email to

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