line breaks in variable width table columns
This came up in the users list, but boils down to a feature request: It would be nice if LyX could interpret a Ctrl-Enter in a variable-width table cell as insert the content in a \shortstack with a line-break at this place. On 2010-01-28, Guenter Milde wrote: On 2010-01-27, Uwe Stöhr wrote: Vincent schrieb: I have to set the table column widths [...], and then, possibly, Ctrl+Enter will make the new line anyway. Yes, you have to set a column width :). Don't ask me why. This is LaTeX. There is no other way because otherwise the width cannot be calculated at which the line break should occur. But this is a technical restriction. A fixed witdth is required for automatic line wrapping. With manual line-breaks the column width can be calculated from the maximal line length. However, LaTeX does not allow manual line-breaks in a table cell. A workaround is to use the \shortstack macro (currently as ERT). This would lead to e.g. the following LaTeX source: \begin{tabular}{|c|p{3cm}|} \hline \shortstack{not so\\short\\stack} fixed\\ width\tabularnewline \hline \end{tabular} The vertical alignment needs some improvement, but generally this works. Günter
line breaks in variable width table columns
This came up in the users list, but boils down to a feature request: It would be nice if LyX could interpret a Ctrl-Enter in a variable-width table cell as "insert the content in a \shortstack with a line-break at this place". On 2010-01-28, Guenter Milde wrote: > On 2010-01-27, Uwe Stöhr wrote: >> Vincent schrieb: I have to "set" the table column widths [...], and then, possibly, Ctrl+Enter will make the new line anyway. >>> Yes, you have to set a column width :). Don't ask me why. >> This is LaTeX. There is no other way because otherwise the width cannot >> be calculated at which the line break should occur. > But this is a technical restriction. A fixed witdth is required for > automatic line wrapping. With manual line-breaks the column width can be > calculated from the maximal line length. > However, LaTeX does not allow manual line-breaks in a table cell. > A workaround is to use the \shortstack macro (currently as ERT). > This would lead to e.g. the following LaTeX source: > \begin{tabular}{|c|p{3cm}|} > \hline > \shortstack{not so\\short\\stack} & fixed\\ > width\tabularnewline > \hline > \end{tabular} > The vertical alignment needs some improvement, but generally this works. Günter