I'm using tabularx to break the content of a column at the document margin (cf. Linebreak in table cell at document margin). But when I use \multicolumn
in such a table, the instruction to break the text in that column is ignored. How can I enforce it?
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\newlength{\mylength}
\setlength{\mylength}{\linewidth}
\addtolength{\mylength}{-\parindent}
\hrule
\begin{tabularx}{\mylength}{lX}
Lorem ipsum dolor sit amet, consectetuer & adipiscing elit. Ut purus elit, vestibulum ut, placerat ac\\
\multicolumn{2}{l}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac}\\
\end{tabularx}
\hrule
\end{document}
In response to Mico's question:
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\newlength{\mylength}
\setlength{\mylength}{\linewidth}
\addtolength{\mylength}{-\parindent}
\hrule
\begin{tabularx}{\mylength}{llX}
Lorem ipsum dolor & sit amet, consectetuer & adipiscing elit. Ut purus elit\\
\end{tabularx}
\hrule
\begin{tabularx}{\mylength}{llX}
Lorem ipsum dolor & sit amet, consectetuer & adipiscing elit. Ut purus elit\\
Lorem ipsum dolor sit & \multicolumn{2}{p{\mylength}}{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit}\\
\end{tabularx}
\hrule
\end{document}
\multicol
statement isl
, which is not set up to allow line breaks. Use\multicol{2}{p{\mlength}}{...}
instead.\hrule
. And correct me if I'm wrong, but using{p{\mylength}}
would also not be applicable in a table where only some of the columns are multicolumns.elit,
); I trust your actual document has "real" text... Regarding your second comment: Could you post an actual example? I don't see why thep
column type couldn't be applied in such a more general setup.elit,
thing (although I thought LaTeX would push the word into the next line rather than extend it into the margin?). I've posted an actual example above now. Note that the second table also messes up the line breaking in the first row, for some reason ...