[Tex/LaTex] Use tabularx in LyX instead of default tabular

lyxtables

I recently got into LyX and I’m getting along quite well.

The only thing that bothers me is that LyX’s table feature produces really sloppy-looking tables by default, i.e. double borders and stuff like that.

I would love to tell LyX to use the tabularx environment by default for the tables I enter via the GUI element, so I can get tables with 100% width matching the justified paragraphs. Concerning the borders, I would like to remove all of them but a \toprule above and beneath the first row of the table and a \bottomrule beneath the last row. These features are added by the ctable package which is included in my document preamble. Is there any way I can achieve these things without performing crazy stuff like regex?

Thanks in advance!

Best Answer

write into the preamble of your document (document->settings->preamble)

\usepackage{array}
\def\tabular{%
 \setlength\dimen@{\linewidth}%
   \edef\@halignto{to\the\dimen@}\@tabular}
\newcolumntype{C}{@{\extracolsep{\fill}}c}


then all tables are by default converted into tabular*. Choose for the first column the column type C or write alternetively the definition @{\extracolsep{\fill}}c for the first column via the tabular menu

Related Question