Helge Hafting <[EMAIL PROTECTED]> writes:

> 
> Jon Bendtsen wrote:
> >
> > On 23/04/2008, at 12.39, Helge Hafting wrote:
> >
> >> Jon Bendtsen wrote:
> >>> I dont want to spent time fixing the table width. I suggest 2 
> >>> possible options if the table is too wide.
> >>>
> >>> 1) scale font so all text can be there in one line
> >>> 2) break the text inside the table into multiple lines
> >> As you show - there are several ways of doing this. they look very 
> >> different, so
> >> clearly the computer cannot make the choice automatically. Different 
> >> people
> >> may want to do this differently, after all. When breaking text inside 
> >> the table,
> >> what columns would you want to do that with? Perhaps you want one of 
> >> them
> >> a little wider than the other because it is more important?  LyX 
> >> simply can't
> >> guess such things.
> >>
> >> You can change the font if you like. Or you can make a table column 
> >> fixed-width
> >> and then the text inside will break into lines automatically.
> >
> I ask because I have never seen a word processor that can do this fully
> automatic in a sane way. Of course, a word processor can limit
> the table to the available width when you just keep typing into the cells.
> 
> But how can it possibly decide how wide each columns should be, if you
> puts lots of text into several of them? Usually, only the writer can 
> know which
> columns are useful to limit and which should adapt to the exact width
> of the widest cell. And therefore, LyX and the latex typesetter doesn't 
> even try.
> 
> Helge Hafting
> 
> 

I think this is a sane default:
When the table becomes so wide that it would not fit the page (or the user set
width) then {
  avail_width <- calculate the available width (maybe user set);
  too_large_columns <- amount of table columns;
  max_width <- avail_width / too_large_columns;
  while next column width < max_width OR column width is user set {
    // don't want to make small columns wider
    too_large_columns--;
    avail_width <- avail_width - this column width;
    max_width <- avail_width / too_large_columns;
  }
  restrict columns that are wider than max_width to max_width;
}

Or do it like firefox handles tables (it is a bit different, but similar).


Rune

Reply via email to