0

I am trying to make a table that has multirow then multicolumn horizontally positioned side by side. I have found a lot of posts that show how to use both in the same table, but none discuss using both within the same rows or, rather, positioning them horizontally within the same space.

Here is the Latex code I am using:

\begin{table*}[ht]
\captionsetup{justification=centering}
\caption{\propose{Multirow and Multicolumn Positioned Horizontally}\label{table:2DSearchTasks}}
\centering
\begin{tabularx}{\textwidth}{|X|X|X|X|X|X|X|}
\hline
\multirow{2}{*}{This is 2-row multirow} & \multicolumn{6}{c|}{This is 6-column multicolumn} \\
\hline
  & Title 1 & Title 2 & Title 3 & 4. Title 4 & 5. Title 5 & 6. Title 6 \\
\hline
\end{tabularx}
\end{table*}

Which outputs the following table:

multirow multicolumn horizontally positioned latex table

As you can see, there is a horizontal line that goes through the multirow on the lefthand side of the table. How can I get rid of this?

Side question: How can I wrap the text of the multirow heading?

1 Answer 1

2

Use \multirow{2}{\hsize}{...} to get the size of the X column:

\documentclass{article}

\usepackage{multirow}
\usepackage{tabularx}


\begin{document}

\begin{table*}[ht]
\begin{tabularx}{\textwidth}{|X|X|X|X|X|X|X|}
\hline
\multirow{2}{\hsize}{This is 2-row multirow} & \multicolumn{6}{c|}{This is 6-column multicolumn} \\
%\hline
\cline{2-7}
  & Title 1 & Title 2 & Title 3 & 4. Title 4 & 5. Title 5 & 6. Title 6 \\
\hline
\end{tabularx}
\end{table*}

\end{document}

As @Bernhard just told me, one can also use = instead of \hsize:

\documentclass{article}

\usepackage{multirow}
\usepackage{tabularx}


\begin{document}

\begin{table*}[ht]
\begin{tabularx}{\textwidth}{|X|X|X|X|X|X|X|}
\hline
\multirow{2}{=}{This is 2-row multirow} & \multicolumn{6}{c|}{This is 6-column multicolumn} \\
%\hline
\cline{2-7}
  & Title 1 & Title 2 & Title 3 & 4. Title 4 & 5. Title 5 & 6. Title 6 \\
\hline
\end{tabularx}
\end{table*}

\end{document}

enter image description here

3
  • This is perfect! Thank you so much. Being a first-time contributor, just wondering how you got the latex to actually compile to display the table (I had inserted an image in my post of the table).
    – user187981
    May 1, 2019 at 13:59
  • @user187981 I also inserted the table as screenshot. If there is a way to automatically include the output, I have not found it yet.
    – user187977
    May 1, 2019 at 14:00
  • With the recent versions og \multirow, you can simply use \multirow{2}{=}{...}
    – Bernard
    May 1, 2019 at 14:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .