On 2010-01-27, Uwe Stöhr wrote:
> Vincent schrieb:

>>>I have to "set" the table column widths to
>>> make any command at all work, and then possibly, just 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|>{\centering}p{3cm}|}
  \hline 
  \shortstack{not so\\short\\stack} & fixed\\
  width\tabularnewline
  \hline
  \end{tabular}

The vertical alignment needs some improvement, but generally this works.
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".

Günter


Reply via email to