Paul Rubin wrote: > I suspect I'm doomed to disappointment here, but is there a way to get LyX > to treat a table as tabular* rather than just tabular environment? I know I > can do it in ERT, but I was hoping to exploit the table editor and layout > features in the GUI but get it typeset as tabular*. > > Alternatively, is there a slick way in LyX to get a table to stretch from > margin to margin (width of table = textwidth)? I can do it with tabular* by > inserting some "stretch" along with the alignment for one of the columns. I > could probably do it by creating an extra row that spanned all columns and > putting a zero-height rule in there, but that would screw up the vertical > size of the table.
Paul, I am afraid LyX does not support the tabular* environment. However there is way to obtain what you are looking for. Please have a look at the attached .lyx file -- Enrico
#LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/ \lyxformat 245 \begin_document \begin_header \textclass article \begin_preamble \end_preamble \options a4paper \language english \inputencoding auto \fontscheme default \graphics default \paperfontsize default \spacing single \papersize default \use_geometry false \use_amsmath 0 \cite_engine basic \use_bibtopic false \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes true \end_header \begin_body \begin_layout Section TABLES \end_layout \begin_layout Standard As LyX does not support the LaTeX \family typewriter tabular* \family default environment, to get a full page width table it is necessary to appropriately set the width of the columns, as done in Table \begin_inset LatexCommand \ref{Tab1} \end_inset . \end_layout \begin_layout Standard \begin_inset Float table placement th wide false sideways false status open \begin_layout Caption \align block \begin_inset LatexCommand \label{Tab1} \end_inset Sample table \end_layout \begin_layout Standard \begin_inset Tabular <lyxtabular version="3" rows="4" columns="4"> <features> <column alignment="left" valignment="top" width="0" special="@{}p{0.25\textwidth}"> <column alignment="center" valignment="top" width="0" special="@{}p{0.25\textwidth}"> <column alignment="center" valignment="top" width="0" special="@{}p{0.25\textwidth}"> <column alignment="center" valignment="top" width="0" special="@[EMAIL PROTECTED]"> <row topline="true"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \emph on Column 1 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset \emph on Column 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset \emph on Column 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset \emph on Column 4 \end_layout \end_inset </cell> </row> <row topline="true"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard Row 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 2,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 2,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 2,4 \end_layout \end_inset </cell> </row> <row> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard Row 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 3,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 3,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 3,4 \end_layout \end_inset </cell> </row> <row bottomline="true"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard Row 4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 4,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 4,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Standard \backslash hfil \end_layout \end_inset 4,4 \end_layout \end_inset </cell> </row> </lyxtabular> \end_inset \begin_inset VSpace smallskip \end_inset \end_layout \begin_layout Standard \paragraph_spacing other 0.8 \size footnotesize Table notes can be inserted beneath the table. If you'd like to insert more rows in this table, place the cursor on the row under which you want to insert another one and select from the menu \family sans Edit\SpecialChar \menuseparator Rows\InsetSpace ~ &\InsetSpace ~ Cols\SpecialChar \menuseparator Add Row \family default . \end_layout \end_inset \end_layout \begin_layout Standard If you click with the right mouse button inside the tabular block, the ``Edit Table'' dialog appears, whereas right-clicking the table caption brings up the ``Float Settings'' dialog, where you can choose the table placement. You can set a column width by first clicking on the column you want to work on, and then changing its \family typewriter p{width} \family default LaTeX argument in the ``Edit Table'' dialog \begin_inset Foot status collapsed \begin_layout Standard Be sure to press the Enter key to commit any change you make in the ``Edit Table'' dialog. \end_layout \end_inset . In Table\InsetSpace ~ \begin_inset LatexCommand \ref{Tab1} \end_inset the column width is specified as a percentage of the page (text) width, and for a 5-columns table the width specification would be \family typewriter p{0.2 \backslash textwidth} \family default . The construct \family typewriter @{} \family default was added to suppress the extra space LaTeX normally inserts between columns. This construct should be placed to the left of the \family typewriter p{...} \family default specification in all columns but the last, where it should also appear to its right. Note that to center a cell content, the \family typewriter \backslash hfil \family default LaTeX command should be used \begin_inset Foot status collapsed \begin_layout Standard LaTeX commands are entered in TeX mode by choosing \family sans \size small Insert\SpecialChar \menuseparator TeX \family default \size default \InsetSpace ~ \family sans \size small Code \family default \size default or clicking the TeX button in the toolbar. This creates a text box, and everything within it is passed straight to LaTeX. \end_layout \end_inset , whereas to right align it the \family typewriter \backslash hfill \family default command is necessary. The ``Horizontal alignment'' field in the ``Edit Table'' dialog has only a visual effect in LyX and does not affect the alignment in LaTeX (i.e., in the typeset result). \end_layout \begin_layout Standard \begin_inset Float table placement th wide false sideways false status open \begin_layout Caption \begin_inset LatexCommand \label{Tab2} \end_inset Another sample table \end_layout \begin_layout Standard \align center \begin_inset Tabular <lyxtabular version="3" rows="4" columns="5"> <features> <column alignment="left" valignment="top" width="0" special="@{}l"> <column alignment="center" valignment="top" width="0" special="c"> <column alignment="center" valignment="top" width="0" special="c"> <column alignment="center" valignment="top" width="0" special="c"> <column alignment="center" valignment="top" width="0" special="[EMAIL PROTECTED]"> <row topline="true"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \emph on Column 1 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \emph on Column 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard \emph on Column 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard \emph on Column 4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard \emph on Column 5 \end_layout \end_inset </cell> </row> <row topline="true"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard Row 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard 2,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard 2,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard 2,4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard 2,5 \end_layout \end_inset </cell> </row> <row> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard Row 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard 3,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard 3,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard 3,4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard 3,5 \end_layout \end_inset </cell> </row> <row bottomline="true"> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard Row 4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard 4,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Standard 4,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard 4,4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Standard 4,5 \end_layout \end_inset </cell> </row> </lyxtabular> \end_inset \begin_inset VSpace smallskip \end_inset \end_layout \begin_layout Standard \align center \begin_inset Box Frameless position "c" hor_pos "c" has_inner_box 1 inner_pos "c" use_parbox 1 width "77.7col%" special "none" height "1in" height_special "totalheight" status open \begin_layout Standard \paragraph_spacing other 0.8 \size footnotesize Note that, in this case, if you want table notes nicely lined up with table borders, you have to fiddle with the parbox width. \end_layout \end_inset \end_layout \end_inset \end_layout \begin_layout Standard If the table does not span the full page width, no fiddling with column widths will be necessary, and the column alignment can be directly specified in the ``Edit Table'' dialog by one single letter: \family typewriter l \family default for left, \family typewriter c \family default for center, and \family typewriter r \family default for right, as shown in Table \begin_inset LatexCommand \ref{Tab2} \end_inset , where \family typewriter @{} \family default was also used to get rid of the extra space in the left and rightmost columns. \end_layout \end_body \end_document
