On Thu, Feb 03, 2011 at 12:01:55PM +0100, Jürgen Spitzmüller wrote: > Enrico Forestieri wrote: > > > Too late IMHO. You had ample time to propose this patch. > > > > Well, it depends on whether it is a big or small change, right? > > Yes, of course. This strikes me rather a large feature addition at this stage > of the development. It needs testing and some discussion (e.g., I wonder why > we add support for tabular* but not for tabularx).
Isn't this a discussion? I would say it is a great, rather than large, feature addition. > I don't doubt the usefulness of this feature. I attach here some notes made in the 1.4 era on how to achieve the same effect in LyX (tables-1.4.lyx) and how it is possible to do it with the patch by Edwin (tables-2.0.lyx). Note that without his patch I would have to adjust the "latex argument" for each column in the table, while now I have simply to add a new column and nothing else. Not mentioning the need of using strange ERT for tweaking things. Great patch Edwin! -- Enrico
#LyX 1.4.2 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="@{}p{0.25\textwidth}@{}"> <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 ~ Columns\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 ``Table Settings'' 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 ``Table Settings'' dialog \begin_inset Foot status collapsed \begin_layout Standard Be sure to press the Enter key to commit any change you make in the ``Table Settings'' 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 ``Table Settings'' 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="c@{}"> <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 ``Table Settings'' 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
#LyX 2.0.0svn created this file. For more info see http://www.lyx.org/ \lyxformat 411 \begin_document \begin_header \textclass article \begin_preamble \end_preamble \options a4paper \use_default_options false \maintain_unincluded_children false \language english \inputencoding auto \fontencoding global \font_roman default \font_sans default \font_typewriter default \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 \font_tt_scale 100 \graphics default \default_output_format default \output_sync 0 \bibtex_command default \index_command default \paperfontsize default \spacing single \use_hyperref false \papersize default \use_geometry false \use_amsmath 0 \use_esint 0 \use_mhchem 0 \use_mathdots 1 \cite_engine basic \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false \use_refstyle 0 \index Index \shortcut idx \color #008000 \end_index \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \paragraph_indentation default \quotes_language english \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \html_math_output 0 \html_be_strict false \end_header \begin_body \begin_layout Standard \begin_inset Float table placement th wide false sideways false status open \begin_layout Plain Layout \begin_inset Caption \begin_layout Plain Layout \align block Sample table \end_layout \end_inset \end_layout \begin_layout Plain Layout \begin_inset Tabular <lyxtabular version="3" rows="4" columns="4"> <features tabularvalignment="middle" tabularwidth="100text%"> <column alignment="left" valignment="top" width="0pt"> <column alignment="center" valignment="top" width="0pt"> <column alignment="center" valignment="top" width="0pt"> <column alignment="center" valignment="top" width="0pt"> <row> <cell alignment="left" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 1 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 4 \end_layout \end_inset </cell> </row> <row> <cell alignment="left" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout Row 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 2,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 2,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 2,4 \end_layout \end_inset </cell> </row> <row> <cell alignment="left" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout Row 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout 3,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout 3,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout 3,4 \end_layout \end_inset </cell> </row> <row> <cell alignment="left" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout Row 4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 4,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 4,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 4,4 \end_layout \end_inset </cell> </row> </lyxtabular> \end_inset \begin_inset VSpace smallskip \end_inset \end_layout \begin_layout Plain Layout \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 \begin_inset space ~ \end_inset & \begin_inset space ~ \end_inset Columns\SpecialChar \menuseparator Add Row \family default . \end_layout \end_inset \begin_inset Float table placement th wide false sideways false status open \begin_layout Plain Layout \begin_inset Caption \begin_layout Plain Layout \align block Sample table \end_layout \end_inset \end_layout \begin_layout Plain Layout \begin_inset Tabular <lyxtabular version="3" rows="4" columns="5"> <features tabularvalignment="middle" tabularwidth="100text%"> <column alignment="left" valignment="top" width="0pt"> <column alignment="center" valignment="top" width="0pt"> <column alignment="center" valignment="top" width="0pt"> <column alignment="center" valignment="top" width="0pt"> <column alignment="center" valignment="top" width="0pt"> <row> <cell alignment="left" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 1 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \emph on Column 5 \end_layout \end_inset </cell> </row> <row> <cell alignment="left" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout Row 2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 2,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 2,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 2,4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 2,5 \end_layout \end_inset </cell> </row> <row> <cell alignment="left" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout Row 3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout 3,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout 3,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout 3,4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" usebox="none"> \begin_inset Text \begin_layout Plain Layout 3,5 \end_layout \end_inset </cell> </row> <row> <cell alignment="left" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout Row 4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 4,2 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 4,3 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 4,4 \end_layout \end_inset </cell> <cell alignment="center" valignment="top" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout 4,5 \end_layout \end_inset </cell> </row> </lyxtabular> \end_inset \begin_inset VSpace smallskip \end_inset \end_layout \begin_layout Plain Layout \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 \begin_inset space ~ \end_inset & \begin_inset space ~ \end_inset Columns\SpecialChar \menuseparator Add Row \family default . \end_layout \end_inset \end_layout \end_body \end_document