2

I have a table:

\begin{tabularx}{\textwidth}{|>{\color{white}}>{\columncolor[gray]{0}}l X | X | X | X |}
  \cline{1-2}
  Proposal Code           & \\
  \hline
  Short Description       & \multicolumn{4}{X}{} \\
  \hline
  \multirow{2}{*}{Spread} &   &   &   &   \\
  \cline{2-5}
                          &   &   &   &   \\
  \hline
\end{tabularx}

This creates a table with four rows:

  • A short row with two small cells. This works fine.
  • A long row with one small cell and one large cell.
  • Two long rows with five small cells apiece, with the first cell being a multirow.

The first row works fine. The second row doesn't have a right border despite the second and fifth columns having borders elsewhere. What gives?

1
  • Welcome to TeX.SE.
    – Mico
    Jan 15 at 5:03
1

There are two main issues with your code:

  • The four narrow columns are really of type X|, not X; note that each of these columns is associated with a vertical rule to the right. This explains why

    \multicolumn{4}{X}{}
    

    fails to draw a vertical line at its right-hand edge. What's needed is

  • However, this still isn't quite right, as any text in this "wide" column will occupy only the width of the first of the four columns. What's really needed, then, is

    \multicolumn{4}{>{\hsize=4\hsize}X|}{}
    

    That way, if and when you start providing text material for the combined cell, it'll occupy all four of the underlying narrow columns.

There's a further, relatively minor point: Instead of placing

\multirow{2}{*}{Spread}

in the third row, you should place

\multirow{-2}{*}{Spread}

in the fourth row.

I'd also replace >{\color{white}}>{\columncolor[gray]{0}} with >{\color{white}\columncolor[gray]{0}}.

The result:

enter image description here

\documentclass{article}
\usepackage{tabularx,multirow}
\usepackage[table]{xcolor}
\begin{document}
\noindent % <-- important
\begin{tabularx}{\textwidth}{ | >{\color{white}\columncolor[gray]{0}}l *{4}{X|} }
  \cline{1-2}
  Proposal Code            & \\
  \hline
  Short Description        & \multicolumn{4}{>{\hsize=4\hsize}X|}{bla bla bla bla bla bla bla} \\
  \hline
                           &   &   &   &   \\
  \hline
  \multirow{-2}{*}{Spread} &   &   &   &   \\
  \hline
\end{tabularx}
\end{document}
2
  • All of these suggestions worked perfectly, thank you! Jan 15 at 18:37
  • @asdfsdfwewrwe - You're most welcome.
    – Mico
    Jan 15 at 18:38

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.