谁能帮我画这张表格?

谁能帮我画这张表格?

表格格式

绘制一个表格,其中的文字换行,单元格垂直和水平居中对齐。我在使用 \multirow 包进行文字换行时遇到了问题。

我的代码片段:

\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}

文本重叠

如您所见,单元格文本重叠,不包含在一个单元格中。行高也不规则。

答案1

像这样:

在此处输入图片描述

  • 您的问题是由于单元格中的内容\multirow高于该单元格跨越的行高之和造成的。
  • 一种可能的解决方法是在所有单元格中添加垂直空格,例如使用\makegapedcells或使用包并在表格文本中cellspace减少。linespread
  • 不幸的\makegapedcells是与列类型不兼容m,但可以使用 Ulrike Fisher 建议的 hack 来修复。
  • 由于您没有提供任何有关页面布局的信息,因此在下面的 MWE 中,页面边框为 20mm。如果您的页面边框较宽,那么下面 MWE 中建议的解决方案可能不会给出令人满意的结果。在这种情况下,我需要调整多行单元格中的单元格间隙和行数。
\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}

答案2

我提出此代码,主要基于、 和\Gape的命令。无需 minipage:makecelltabularx

\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} 

在此处输入图片描述

答案3

试试这个,我用过https://www.latex-tables.com/生成我的表格,我没有检查你的代码,只是为你制作了一个快速表格,希望这可以解决你的问题。

\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}

在此处输入图片描述

相关内容