0

I'm facing trouble with multirow, when I used multirow in the last column of the table, the text becomes very close to the top margin and the text is not justified, while in other columns and rows text height is okay. I also used makecell[t] and pbox both of them help to justify text however text height remains an issue also they both worked without multirow, so I wanted to use multirow and normal text height not close to the top margin, can you please help here. I'm sharing code and an image.

\documentclass[fleqn]{IEEEtran}
\begin{table*}[t]
\caption{ }
\renewcommand{\arraystretch}{1.5}
\setlength{\tabcolsep}{4.5pt}
\label{Table:1} %cXXX  {\linewidth} 
\begin{tabularx} {\textwidth} {|c|p{3cm}| p{5cm}|p{7.5cm}|}
\hline
 \multicolumn{1}{|c}{AAAAAA(s)}& \multicolumn{1}{c}{AAAAAAA(s)} %& \multicolumn{1}{c}{ Source(s)}
& \multicolumn{1}{c}{AAAAAAAA (s)} & \multicolumn{1}{c|}{AAAAA(s)}
          
\\
\hline
\& &\multirow{4}{7.5cm}{{}} \\ \cline{1-3} %\cline{4-5}



& & &  \\ \cline{1-3}


 & & &    \\\cline{1-3}
\& &  &   \\\cline{1-3}

\textit{Our work}&   & &   \\\hline
\end{tabularx}
\end{table*}
\end{document}

enter image description here

5
  • Please provide a compilable MWE that starts with \documentclass and ends with \end{document}. Otherwise we need to guess which packages you use. Also, I think your code has some issues, considering the appearance of \& twice. Oct 26, 2021 at 16:23
  • Did you try \multirow[t]{5}{7.5cm}{<your text here>}? Oct 26, 2021 at 16:37
  • @JasperHabicht, I added document class, and yes I tried it, it helps to adjust the height but then text remains unjustified, so meaning if I correct one thing the other creates a problem.
    – Shane
    Oct 26, 2021 at 16:54
  • You shouldn't use a tabularx environment if it has no X column.
    – Bernard
    Oct 26, 2021 at 16:55
  • Please prepare a complete and compilable minimal working example (MWE) that allows others to reproduce the output you get. If I take your code, add the missing packages, I get the following output which is quite different from what you show in your question. i.stack.imgur.com/gPsJY.png
    – leandriis
    Oct 26, 2021 at 17:55

1 Answer 1

4

Your MWE is not complete and contain errors, so I can only guess, what you like to have. Anyway, if you use tabularx table, at list one column should be of X type. For example, the last one:

\documentclass[fleqn]{IEEEtran}
\usepackage{multirow, tabularx}

%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\begin{document}
\begin{table*}[t]
\caption{ }
\renewcommand{\arraystretch}{1.5}
\setlength{\tabcolsep}{4.5pt}
\label{Table:1} %cXXX  {\linewidth}
\begin{tabularx}{\textwidth} {|c|p{3cm}| p{5cm}|X|}
    \hline
AAAAAA(s)   & AAAAAAA(s)    & AAAAAAAA (s)  & AAAAA(s)  \\
    \hline
            &               &               & \multirow{4}{=}{\lipsum[66]}                   
                                                        \\ \cline{1-3}
            &               &               &           \\ \cline{1-3}
            &               &               &           \\ \cline{1-3}
            &               &               &           \\ \cline{1-3}
\textit{Our work}
            &               &               &           \\
    \hline
\end{tabularx}
\end{table*}
\end{document}

Edit: Using it, your table will not protrude out of text borders, as you can see on mage below. It is also not clear, why you for column headers use multicolumn cells. They only overwrite column settings and make a mess with vertical lines.

enter image description here

Addendum: For exercise and fun you may investigate features of the tabularray packages. Using it, the code of above table can be:

\documentclass[fleqn]{IEEEtran}
\usepackage{tabularray}

%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\begin{document}
    \begin{table*}[t]
    \caption{ }
    \label{Table:1}
\begin{tblr}{hlines, vlines,            % lines in table
             colspec= {c Q[j,wd=3cm] Q[j,wd=5cm] X[j]},
             rowsep=3pt,                % vertical space between rows borders
                                        % and (heigher) contents in it
             row{1} = {font=\bfseries}, % text in the first row is boldface
             vspan = even               % height of rows spanned by multi row cell
                                        % is evenly distributed
             }  % table preamble, defaine its layout
AAAAAA(s)   & AAAAAAA(s)    & AAAAAAAA (s)  & AAAAA(s)  \\
            &               &               & \SetCell[r=5]{j} \lipsum[1] % define multi row cell
                                                        \\
            &               &               &           \\
            &               &               &           \\
            &               &               &           \\
\textit{Our work}
            & short text    & \lipsum[1][1] &           \\
\end{tblr}
\end{table*}
\end{document}

For more information please read package's dpcumentation.

enter image description here

2
  • As for why the OP uses multicolumn cells in the table header, I think, that they want to omit the vertical lines in the header. But this is only my guess ... Oct 26, 2021 at 20:34
  • @JasperHabicht, probably you are right, but to me is nonlogical why they then should be in the table body ...
    – Zarko
    Oct 26, 2021 at 21:31

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.