# Align table-text in Lyx 1.6.9

I created a table with normal font text inside. After I select the text and go to Edit>>Text style>>Customized and select Larger, in the input the text looks aligned ok (it's right in the middle of the cell, as it is supposed to be), but when I do View>>PDF(xelatex), the text is no longer aligned (it is closer to the top of the cell than to the bottom, although in the source the option Align center is pressed). How can I make it display the table-text aligned in the output pdf?

-
Have you considered that some characters go below the baseline? If I make a single cell standard table containing the letters Iy, the distance from the top of the I to the line above, is the same as the bottom of the y to the line below. –  Torbjørn T. Nov 20 '11 at 21:18
The problem is that it looks aligned in the input text and unaligned in the output. I know that is the case for some characters, I don't disagree with you, but it is only diagonal to what I have asked :) –  chimil Dec 9 '11 at 11:15
I'm sorry, I tried, and I see the same behaviour. Not sure exactly why this happens, but I know there are issues with the standard table lines, and the text coming too close to the line above. Would you consider changing the style of the table to "Formal"? (In the settings for the tabular, go to the Borders tab, and select the Formal style here.) This makes LyX use booktabs, which makes the spacing better. –  Torbjørn T. Dec 9 '11 at 11:27
Thank you for the suggestion! –  chimil Dec 10 '11 at 17:12

The standard table setup in LaTeX does have some problems with the text coming too close to the \hline above it. The booktabs package aims to to fix this problem, as well as discouraging the use of vertical rules, to make tables look better. Read the manual for a more thorough discussion about the subject.

To use booktabs in LyX, all you have to do is go into the settings for the tabular (right click the table --> More --> Settings), and under the Borders tab, select the Formal style:

I would recommend using this for tables in general.

A hack to have better spacing with the default, is to add a \strut in the cell. Put the text marker in the cell and insert a TeX code box (ERT) by Ctrl + L or via the Insert menu. In this box, type \strut.

The images below show how this looks in LyX and in the PDF

compared to the default without \strut:

-
That seems to do the trick. –  chimil Dec 10 '11 at 17:13