6

How do I decouple the paragraph alignment of rows within a column in LyX? I would like my top row to be aligned in the centre, and all subsequent (content) rows to be aligned left.

However, whenever I try to align any of them, the alignment for the entire column will change. Is there a workaround this?

7

You have to active a "multi-column" mode for the entry. This is done by inserting your cursor in the cell you want to set in a different alignment and clicking on the "set multi-column" button in the tabular toolbar (second from the right):

enter image description here

You can then select any of the alignment options to update it for that specific cell. The eventual code will resemble:

% Preview body

\begin{tabular}{|c|c|c|}
\hline 
First column & \multicolumn{1}{l|}{Second column} & Last column\tabularnewline
\hline 
\hline 
A & B & C\tabularnewline
\hline 
A lengthy entry & Another lengthy entry & Yet another lengthy entry\tabularnewline
\hline 
\end{tabular}

enter image description here

The important thing to note in the code is the use of \multicolumn{1}{<align>}{<stuff>}, which resets the alignment to <align>, based on your selection.


You can also revert back to the LaTeX way of doing things. As such, use an ERT:

enter image description here

enter image description here

% Preview body

\begin{tabular}{|c|c|c|}
\hline 
First column & Second column & Last column\tabularnewline
\hline 
\hline 
A & B & C\tabularnewline
\hline 
A lengthy entry & Another lengthy entry & Yet another lengthy entry\tabularnewline
\hline 
\end{tabular}

\bigskip

\begin{tabular}{|c|c|c|}
\hline 
First column & \multicolumn{1}{l|}{Second column} & Last column\tabularnewline
\hline 
\hline 
A & B & C\tabularnewline
\hline 
A lengthy entry & Another lengthy entry & Yet another lengthy entry\tabularnewline
\hline 
\end{tabular}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.