2

Table fotmat

Draw a table with the following text wraps and center vertical and horizontal alignment for the cell. I am having problem in text wrapping using \multirow package.

A snippet of my code:

\newcolumntype{L}{>{\centering\arraybackslash}m{0.73in}}
\newcolumntype{M}{>{\centering\arraybackslash}m{1.5in}}
\begin{table}[!ht]
    \begin{center}
    \setlength\cellspacetoplimit{12pt}
    \setlength\cellspacebottomlimit{12pt}
    \resizebox{\textwidth}{!}{
\begin{tabular}{|L|M|M|M|M|}
\hline
\textbf{Scenario} & \textbf{Description} & \textbf{Delivery of Motors} & \textbf{Productive Reservoir} & \textbf{Non-Productive Reservoir} \\
\hline
1 & Basic two system & Both get delivered equally. & Few get detached into  reservoir due to provision of movement. & Almost all the others are reattached within the given time, as a result no leakage has occurred.\\
\hline
2 & Parallel with no movement & Without the provision of movement, faster are hindered due to crowding. &   Almost all the one are waiting in the reservoirs due to crowding. & The leakage might occur depending on the influx rate and crowding.\\ 
\hline 
3 & 90\% staggering at the initial segment & A smaller level allows very few numbers of ones to move out of the system. & \multirow{3}{*}{\begin{minipage}{1.5in}When staggering occurs in the initial segment, most of the  wait in the reservoirs.\end{minipage}}& \multirow{3}{*}{\begin{minipage}{1.5in}Due to heavy crowding of influx in the initial segment, most of the within their given lifetime, and are out of the system.\end{minipage}} \\ [5pt]
\cline{1-3}
4 & 95 \% staggering at the initial segment  &  \multirow{2}{*}{\begin{minipage}{1.5in}
 Almost no one cross the 95\% barrier and thus move out via the lines.
 \\As ones in middle track never experience congestion, so they move freely in a single line only. \end{minipage}} & ~ & ~  \\  
\cline{1-2}
5 & 100\% staggering at the initial segment of & ~ & ~ & ~ \\ 
\hline
6 & 90\% staggering at the later segment & \multirow{3}{*}{\begin{minipage}{1.5in}As the staggering is at the later end, the output affected. Only a few numbers, who has overcome gets output within their lifetime.\end{minipage}}& \multirow{3}{*}{\begin{minipage}{1.5in}The starts to occur beyond the point only.\end{minipage}} & \multirow{3}{\linewidth}{\begin{minipage}{1.5in}As the staggering is at the later end, which were moving in those staggered tracks. As a result, both the one are gradually moved out from the point.\end{minipage}} \\ 
\cline{1-2}
7 & 95\% staggering at the later segment  & ~ & ~ & ~ \\ 
\cline{1-2}
8 & 100\% staggering at the later segment & ~ & ~ & ~ \\ 
\hline
\end{tabular}
    }
\end{center}
\caption{\label{tab:one}A detailed analysis of different scenarios simulated with parametric values as discussed in Simulation I}
\end{table}

Overlapped text

As you can see the cells text are overlapping and not contained in one cell. Also row heights are irregular.

6
  • 3
    Welcome to TeX SX! Could you please post a complete code of what you've tried, so we have a starting point? – Bernard Jul 27 '20 at 9:34
  • 1
    I have uploaded the code can you please check it – Soumyadeep Chandra Jul 27 '20 at 19:11
  • 1
    Please, give a fully compilable code. – AndréC Jul 27 '20 at 20:12
  • 1
    Please prepare a complete minimal working example (MWE) and add it to your question. Which documentclass do you use? If you happen to use the geometry package please also include teh corresponding settings into your MWE. Regarding the table itself: Don't use resizebox in order to mak sure a table fits into the textwidth. You will only end up with inconsistent font sizes throughtout the document. Instead you could use tabularx. – leandriis Jul 27 '20 at 20:15
  • Instwad of \multirow{3}{*}{\begin{minipage}{1.5in}...\end{minipage}} you can use \multirow{3}{=}{...}. The = makes sure the multirow cell is as wide as the column it is used in. – leandriis Jul 27 '20 at 20:16
3

Like this:

enter image description here

  • Your problem is caused because the content in the \multirow cell is higher then sum of heights of rows spanned by this cell.
  • One possible work around is add vertical spaces in all cells, for example with use of the \makegapedcells or with use of cellspace package and reduce linespread in table text.
  • Unfortunately \makegapedcells is not compatible with m column types, but this can be fix with hack suggested by Ulrike Fisher.
  • Since you not provide any information about your page layout, in MWE below it has 20mm with page borders. In the case, that you have wider pages' borders, than may suggested solution in MWE below will not give satisfied result. In such a case I will need to tweak cell gapes and number of lines in in multi row cells.
\documentclass{article}
\usepackage[margin=20mm]{geometry}
\usepackage{siunitx}
\usepackage{ragged2e}
\usepackage{makecell, multirow, tabularx}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}{>{\RaggedRight}X}
%%--------------------------------------------------------------%
%%  patch of Ulrike Fisher (on my request)                      %
%   (http://tex.stackexchange.com/questions/319768/             %
%%--------------------------------------------------------------%
\makeatletter
\renewcommand\mcell@classz{\@classx
   \@tempcnta \count@
   \prepnext@tok
   \@addtopreamble{%\mcell@mstyle
      \ifcase\@chnum
         \hfil
         \mcell@agape{\d@llarbegin\insert@column\d@llarend}\hfil \or
         \hskip1sp
         \mcell@agape{\d@llarbegin\insert@column\d@llarend}\hfil \or
         \hfil\hskip1sp
         \mcell@agape{\d@llarbegin \insert@column\d@llarend}\or
         \mcell@agape{$\vcenter
         \@startpbox{\@nextchar}\insert@column\@endpbox$}\or
         \mcell@agape{\vtop
         \@startpbox{\@nextchar}\insert@column\@endpbox}\or
         \mcell@agape{\vbox
         \@startpbox{\@nextchar}\insert@column\@endpbox}%
      \fi
      \global\let\mcell@left\relax\global\let\mcell@right\relax
    }\prepnext@tok}
\makeatletter


\begin{document}
\begin{table}[!ht]
    \centering
    \renewcommand\tabularxcolumn[1]{m{#1}}
    \setcellgapes{11pt}
    \makegapedcells
    \setlength\tabcolsep{3pt}
    \small\linespread{0.84}\selectfont
\begin{tabularx}{\linewidth}{|c|L|L|L|L|}
    \hline
\thead{Sce-\\nario}    
        & \thead{Description}           & \thead{Delivery of Motors} 
        & \thead{Productive\\ Reservoir} & \thead{Non-Productive\\ Reservoir} \\
    \hline
1       & Basic two system              & Both get delivered equally.   
        & Few get detached into  reservoir due to provision of movement. 
                                        & Almost all the others are reattached within the given time, as a result no leakage has occurred.\\
    \hline
2       & Parallel with no movement     & Without the provision of movement, faster are hindered due to crowding. 
        &   Almost all the one are waiting in the reservoirs due to crowding. 
                                        & The leakage might occur depending on the influx rate and crowding.\\
    \hline
3       & \SI{90}{\%} staggering at the initial segment 
                                        & A smaller level allows very few numbers of ones to move out of the system. 
        & \multirow{9}{=}{When staggering occurs in the initial segment, 
                          most of the  wait in the reservoirs.}
                                        & \multirow{9}{=}{Due to heavy crowding of influx in the initial segment, 
                                                          most of the within their given lifetime, and are out of the system.} \\
    \cline{1-3}
4       & \SI{95}{\%} staggering at the initial segment  
                                        &   \multirow{8}{=}[1.2em]{
                                        Almost no one cross the \SI{95}{\%} barrier and thus move out via the lines.              
                                        As ones in middle track never experience congestion, so they move freely in               
                                        a single line only.} 
        & ~                                             &  \\
    \cline{1-2}
5       & \SI{100}{\%} staggering at the initial segment of 
                        & ~             & ~             & ~ \\
    \hline
6       & \SI{90}{\%} staggering at the later segment 
                                        & \multirow{10}{=}{As the staggering is at the later end, the output affected. 
                                                          Only a few numbers, who has overcome gets output within their lifetime.}
        & \multirow{10}{=}{The starts to occur beyond the point only.} 
                                        & \multirow{10}{=}{As the staggering is at the later end, which were moving in those staggered tracks. 
                                                          As a result, both the one are gradually moved out from the point.} \\
    \cline{1-2}
7       & \SI{95}{\%} staggering at the later segment  & ~ & ~ & ~ \\
        \cline{1-2}
8       & \SI{100}{\%} staggering at the later segment & ~ & ~ & ~ \\
    \hline
\end{tabularx}
    \end{table}
\end{document}
1
1

I propose this code, mainly based on the \Gape command from makecell, and tabularx. No minipage required:

\documentclass{article}
\usepackage{geometry}
\usepackage{ragged2e} 
\usepackage[table, svgnames]{xcolor}
\usepackage{adjustbox}
\usepackage{tabularx, multirow, makecell}
\renewcommand{\theadfont}{\small\bfseries}

\begin{document}

\begin{table}[!ht]
   \centering\small
\setlength{\tabcolsep}{3pt}
\setlength{\extrarowheight}{3pt}
\renewcommand{\tabularxcolumn}[1]{>{\arraybackslash\RaggedRight}m{#1}}
\begin{tabularx}{\linewidth}{|c|*{4}{X|}}
\hline
\thead{Scenario} & \thead{Description} & \thead{Delivery of Motors} & \thead{Productive\\ Reservoir} & \thead{Non-Productive\\ Reservoir} \\
\hline
1 & Basic two system & Both get delivered equally. & Few get detached into reservoir due to provision of movement. & Almost all the others are reattached within the given time, as a result no leakage has occurred.\\
\hline
2 & Parallel with no movement & Without the provision of movement, faster are hindered due to crowding. & Almost all the one are waiting in the reservoirs due to crowding. & The leakage might occur depending on the influx rate and crowding.\\[4.5ex]
\hline
3 & 90\,\% staggering at the initial segment & A smaller level allows very few numbers of ones to move out of the system. & \multirow{9}{=}{When staggering occurs in the initial segment, most of the wait in the reservoirs.}& \multirow{9}{=}{Due to heavy crowding of influx in the initial segment, most of the within their given lifetime, and are out of the system.} \\
\cline{1-3}
\Gape[6ex]{4} & \parbox{\hsize}{95 \,\% staggering at the initial segment} & & & \\%
\cline{1-2}
\Gape[6ex]{5} &\parbox{\hsize}{100\,\% staggering at the initial segment of }& \multirow{-5.8}{=}
{\RaggedRight%
 Almost no one cross the 95\,\% barrier and thus move out via the lines.
 \newline As ones in middle track never experience congestion, so they move freely in a single line only.}%
 & & \\
\hline
\Gape[3.4ex]{6 }& \parbox{\hsize}{90\,\% staggering at the later segment} & & & \\
\cline{1-2}
\Gape[3.4ex]{7 }& \parbox{\hsize}{95\,\% staggering at the later segment} & & & \\
\cline{1-2}
\Gape[3.4ex]{8} & \parbox{\hsize}{100\,\% staggering at the later segment}
& \multirow{-5.5}{=}{As the staggering is at the later end, the output affected. Only a few numbers, who has overcome gets output within their lifetime.}
& \multirow{-5.5}{=}{The starts to occur beyond the point only.}
& \multirow{-5.8}{=}{As the staggering is at the later end, which were moving in those staggered tracks. As a result, both the one are gradually moved out from the point.}\\
\hline
\end{tabularx}
\caption{\label{tab:one}A detailed analysis of different scenarios simulated with parametric values as discussed in Simulation I}
\end{table}

\end{document} 

enter image description here

1
0

Try this, I used https://www.latex-tables.com/ to generate my table, I didnt check ur code just made a quick table for you hope this can solve ur problem.

\documentclass[10pt]{article}
\usepackage{multirow}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|l|l|l|l|} 
\hline
www & UUUU & xxxxx             & yyyyyy            & zzzzz              \\ 
\hline
1   &      &                   &                   &                    \\ 
\hline
2   &      &                   &                   &                    \\ 
\hline
3   &      &                   & \multirow{3}{*}{} & \multirow{3}{*}{}  \\ 
\cline{1-3}
4   &      & \multirow{2}{*}{} &                   &                    \\ 
\cline{1-2}
5   &      &                   &                   &                    \\ 
\hline
6   &      & \multirow{3}{*}{} & \multirow{3}{*}{} & \multirow{3}{*}{}  \\ 
\cline{1-2}
7   &      &                   &                   &                    \\ 
\cline{1-2}
8   &      &                   &                   &                    \\
\hline
\end{tabular}
\end{table}
\end{document}

enter image description here

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.