On Wed, Nov 23, 2005 at 08:57:45PM -0500, David Soukal wrote:
> Hello,
> 
> I am still consistently working on my thesis, spreading the awarness of 
> LyX's greatness along the way... :) yet I've run into another little 
> problem that I was unable to solve easily with at-hands documentation.
> 
> I am trying to report some data in tables and I have come across the 
> following obstacles that I don't know how to solve:
> 
> 1) is it possible to have a table with individual cells within a column 
> aligned differently?
> 
Yes, with a small trick.  Set the column to left aligned.
When you want a right-aligned cell, insert a hfill before the
text.  The hfill will push cell contents to the right.
You'll find it somehwere under the insert menu.

This trick also allow right-aligned cells in a centered column.

Unfortunately, you can't create a left-aligned cell in a right-aligned
column as easy, because a trailing hfill is ignored.  Fix this by having a
protected blank (insert menu again) after the trailing hfill.

If you need to force a *centered* cell, you should do:
protected_blank hfill  celltext hfill protected blank

The reason for the leading protected blank is to get proper
centering - protected blanks have a width so only a trailing one
won't do.

If you should need a justified cell, use hfills instead of spaces between
words.  I cannot imagine the need for this though.

> 2) while 1) may sound strange, I'd like to have, for example, a column 
> with numbers centered while the header of the column is aligned, say, 
> flushed left.

Sure you don't want the header centered too, when all the content is?

> 
> 3) another practical, related, problem is the decimal-aligned columns 
> created using the dcolumn package. When I use the d{} alignment for a 
> column (bless Extended Features manual :), the numbers withing the 
> column are indeed aligned on the "." but the header text of the column 
> is in italics font (easily fixable, yet awkward, with \textrm{}) and it 
> is aligned so that the last letter is right aligned with the decimal 
> point of the rest of the column. I would like to have the numbers 
> aligned on the decimal point, while the header text being, say, centered.
> 
Read Extended.lyx again:
"Setting the multicolumn attribute for a single cell makes it insensitive to 
the decimal alignment which comes in handy as well."

Just tried it - the cell is now centered and no unusual font either.


> Is this possible at all? I realize I could perhaps solve 1) & 2) with 
> another nested table (an HTML hell :) but I'm not so sure with 3).
> 
> Thanks for any hints & pointer!
> 

If you need to do something really awkward in a table cell, insert a
minipage there.  You can put just about anything in a minipage,
including all sorts of alignments, multiple lines, and so on.

Helge Hafting

Reply via email to