4

I am using the multicolumn command to cover four columns in my table, but for some reason the text within the column is wrapping within a single column width leaving the remainder of the column empty. I can see that the column is still the width I'd like, since the right strut of the cell is where it is supposed to be. I think it may be related to my use of the tabularx environment, but I need it to allow the table to shift to fit the different possible cell values.

\documentclass{article}
\usepackage{fullpage}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[none]{hyphenat}
\usepackage{array}
\usepackage{bigstrut}
\begin{document}
\begin{center}
\begin{tabularx}{\textwidth}{|l|X|X|X|X|X|}
\hline
\textbf{Meeting Date:} & 2009/08/01 & \textbf{Type:} & Party & \textbf{Today's date:} & 2014/01/14 \bigstrut \tabularnewline 
\hline
\textbf{Meeting Location:} & \multicolumn{4}{X|}{This is the long string of text that I would like to break but when it has filled four columns rather than one.} & \bigstrut \tabularnewline
\hline 
\textbf{Current Weather:} & \multicolumn{5}{l|}{Cloudy and sunny} \bigstrut \tabularnewline
\hline 
\textbf{Sector:} & \multicolumn{5}{l|}{Food and Produce} \bigstrut \tabularnewline
\hline 
\end{tabularx}
\end{center}
\end{document}
2

The tabularx documentation clearly states:

Do not use \multicolumn entries which cross any X column.

You can substitute your

\multicolumn{4}{X|}{This is the long string...}

with

\multicolumn{4}{p{4in}|}{This is the long string...}

Complete code:

\documentclass{article}
\usepackage{fullpage}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{graphicx}
\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[none]{hyphenat}
\usepackage{array}
\usepackage{bigstrut}
\begin{document}
\begin{center}
\begin{tabularx}{\textwidth}{|l|X|X|X|X|X|}
\hline
\textbf{Meeting Date:} & 2009/08/01 & \textbf{Type:} & Party & \textbf{Today's date:} & 2014/01/14 \bigstrut \tabularnewline
\hline
\textbf{Meeting Location:} & \multicolumn{4}{p{4in}|}{This is the long string of text that I would like to break but when it has filled four columns rather than one.} & \bigstrut \tabularnewline
\hline
\textbf{Current Weather:} & \multicolumn{5}{l|}{Cloudy and sunny} \bigstrut \tabularnewline
\hline
\textbf{Sector:} & \multicolumn{5}{l|}{Food and Produce} \bigstrut \tabularnewline
\hline
\end{tabularx}
\end{center}
\end{document} 

Output:

enter image description here

| 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.