LyX ⇒ Centering text in table cell ?!
Centering text in table cell ?!
Hi,
I'm having a problem centering a text in a table cell. Basically,
I have a three column table. The two end cells (1 and 3) in row 2 have
equations and the middle cell has an image. When I inserted the
image the two equations appeared in the bottom of the cell.
How can I place them in the middle of the cell ?
I'm attaching the table. The second row is the one that has a problem.
Thanks
I'm having a problem centering a text in a table cell. Basically,
I have a three column table. The two end cells (1 and 3) in row 2 have
equations and the middle cell has an image. When I inserted the
image the two equations appeared in the bottom of the cell.
How can I place them in the middle of the cell ?
I'm attaching the table. The second row is the one that has a problem.
Thanks
- Attachments
-
- Jpeg image
- Table.jpg (17.98 KiB) Viewed 17004 times
NEW: TikZ book now 40% off at Amazon.com for a short time.

Re: Centering text in table cell ?!
All you need to do is to set a fixed width for a column and select centered vertical alignment (Right Click in a cell > Settings > Vertical alignment in row).
I attached an example .lyx file.
I attached an example .lyx file.
- Attachments
-
- Example.zip
- (6.12 KiB) Downloaded 651 times
Last edited by meho_r on Tue Jun 15, 2010 2:53 pm, edited 1 time in total.
Re: Centering text in table cell ?!
Thanks,
I tried that but it's not working.
I set the column width to 2 inch but no mater what option I choose
for the vertical alignment (Top, Middle, Bottom) the text still
appears in the bottom. I tried deleting the cell content and re-write
the equation but the cursor is only active at the bottom.
I'm not sure if this has to do with using Lyx on a mac.
I tried that but it's not working.
I set the column width to 2 inch but no mater what option I choose
for the vertical alignment (Top, Middle, Bottom) the text still
appears in the bottom. I tried deleting the cell content and re-write
the equation but the cursor is only active at the bottom.
I'm not sure if this has to do with using Lyx on a mac.
Centering text in table cell ?!
Have you been looking at the output file (pdf or dvi), not in LyX itself (LyX doesn't show the change, but in pdf output it should be set right)?
BTW, you should use middle vertical alignment for all columns.
And, if everything else fails, you may add this code in LaTeX Argument field in Settings for every column:
BTW, you should use middle vertical alignment for all columns.
And, if everything else fails, you may add this code in LaTeX Argument field in Settings for every column:
Code: Select all
>{\centering}m{2in}
Re: Centering text in table cell ?!
Yes,
It's working now. I re-created the table and before putting
anything there I set the column width, and the vertical row
alignment to Middle.
A side question, in the other picture I'm attaching now, I created
a Subsection which I called "1. step function", I hit Enter and Lyx
switched to the "Standard" environment. After creating a vertical space,
I created a two-cell table. However, the table appeared on the same line
as the Subsection heading and it is shifted all the way to the right. The
cell widths are 1.5 inch. How do I get the table to appear in the next line
at the left. In other parts of the document it worked fine. I'm not sure what
I did different here.
It's working now. I re-created the table and before putting
anything there I set the column width, and the vertical row
alignment to Middle.
A side question, in the other picture I'm attaching now, I created
a Subsection which I called "1. step function", I hit Enter and Lyx
switched to the "Standard" environment. After creating a vertical space,
I created a two-cell table. However, the table appeared on the same line
as the Subsection heading and it is shifted all the way to the right. The
cell widths are 1.5 inch. How do I get the table to appear in the next line
at the left. In other parts of the document it worked fine. I'm not sure what
I did different here.
- Attachments
-
- Second attachment
- Table2.jpg (5.39 KiB) Viewed 16994 times
Re: Centering text in table cell ?!
Thanks for the example.
I just realized it was there.
I just realized it was there.
Re: Centering text in table cell ?!
It would help if you attach an example .lyx file with the problematic text as well as your .pdf output. Just put them in a .zip archive and attach them to your post.
Re: Centering text in table cell ?!
The archive is attached.
From the output you notice that row 2 of table 1 is not centered (I thought I solved it) . Also, the tables following subsections 1 and 3 are on the same line as the heading. But for subsection 2 the table is in an appropriate position.
From the output you notice that row 2 of table 1 is not centered (I thought I solved it) . Also, the tables following subsections 1 and 3 are on the same line as the heading. But for subsection 2 the table is in an appropriate position.
- Attachments
-
- Archive.zip
- Archive
- (98.04 KiB) Downloaded 369 times
Centering text in table cell ?!
1. You haven't set table settings correctly. You must set fixed column width for all columns and then set middle vertical alignment. In your table only the last column is set to fixed width.
2. The issue with subsection is caused by document class (article (AMS)). Normal article document class doesn't have this problem. However, puting \mbox{} (i.e. Ctrl+L > \mbox{}) after vertical space should put the table below the subsection.
Note: if you encounter more issues, please don't forget to provide images together with .lyx and .pdf files.
2. The issue with subsection is caused by document class (article (AMS)). Normal article document class doesn't have this problem. However, puting \mbox{} (i.e. Ctrl+L > \mbox{}) after vertical space should put the table below the subsection.
Note: if you encounter more issues, please don't forget to provide images together with .lyx and .pdf files.
Re: Centering text in table cell ?!
It's working now. I had to switch to "article" to get the \mbox trick to
work.
Thanks so much
work.
Thanks so much