如何使用 booktabs 来制作复杂的多列表格以保持一致的设计

如何使用 booktabs 来制作复杂的多列表格以保持一致的设计

我对 Latex 和 Booktabs 还不熟悉,但与“普通”表格相比,我更喜欢 Booktabs 的设计。因此,我想使用 Booktabs,并完成了一些简单的表格,例如人口统计概览。

但是,我需要创建一个包含多个多列的相当复杂的表格来比较多个作者的分组。表格应该如下所示(当然包括更多作者):

示例表。注意:A、B、C.. 不是相同的词,只是填补空白

然而,据我所知,书页标签的基本原则是尽可能少使用垂直线和水平线。然而,无论如何,这些线在这里都是需要用来划分界限的。

您是否仍会使用这么多行,尽管这与其他表相比被认为是不一致的,或者我应该因此而放弃 booktabs?

非常乐意听到您的意见。提前致谢!

编辑:MWE:

\documentclass{article}

\usepackage{booktabs}
\usepackage{multirow}
\usepackage{lscape}
\usepackage{adjustbox}

\begin{document}

\begin{landscape}
\begin{table}[]
\adjustbox{max width=\linewidth}{%
\begin{tabular}{@{}lcccccc@{}}
\toprule
 & \multicolumn{2}{l}{\textbf{A1}} & \multicolumn{2}{l}{\textbf{A2}} & \multicolumn{2}{l}{A3} \\ \midrule
\multirow{12}{*}{\begin{tabular}[c]{@{}l@{}}Production\\ planning\end{tabular}} & Sales   planning & \multirow{3}{*}{} & \multirow{3}{*}{Program planning} & Sales forecast & \multirow{3}{*}{Primary Requirements   Planning} & \multirow{3}{*}{Production program planning} \\ \cmidrule(lr){2-2} \cmidrule(lr){5-5}
 & \multirow{2}{*}{Production   program planning} &  &  & \multirow{2}{*}{Rough-cut scheduling} &  &  \\
 &  &  &  &  &  &  \\ \cmidrule(l){2-7} 
 & \multirow{4}{*}{Inventory   planning} & \multirow{3}{*}{Production requirements   planning} & \multirow{4}{*}{Material management} & Bill of material   explosion & \multirow{4}{*}{Material Requirements   Planning} & Bill of material   explosion \\ \cmidrule(lr){5-5} \cmidrule(l){7-7} 
 &  &  &  & \multirow{2}{*}{Inventory   reconciliation} &  & Gross requirements   planning \\ \cmidrule(l){7-7} 
 &  &  &  &  &  & Net requirements planning \\ \cmidrule(lr){3-3} \cmidrule(lr){5-5} \cmidrule(l){7-7} 
 &  & Procurement type allocation &  & Lot size calculation &  & Lot Size calculation \\ \cmidrule(l){2-7} 
 & \multirow{5}{*}{Production planning} & Work preparation & \multirow{5}{*}{Time management} & \multirow{2}{*}{Scheduling} & \multirow{2}{*}{Rough-cut scheduling} &  \\ \cmidrule(lr){3-3}
 &  & Production order scheduling &  &  &  &  \\ \cmidrule(lr){3-3} \cmidrule(l){5-7} 
 &  & Lot Size calculation &  & \multirow{3}{*}{Capacity planning} & \multirow{3}{*}{Capacity alignment} & \multirow{3}{*}{Detailed scheduling} \\ \cmidrule(lr){3-3}
 &  & \multirow{2}{*}{Capacity planning} &  &  &  &  \\
 &  &  &  &  &  &  \\ \midrule
\multirow{5}{*}{\begin{tabular}[c]{@{}l@{}}Production\\ control\end{tabular}} & \multirow{5}{*}{Production control} & Sequencing & \multirow{5}{*}{Sequencing} & \multirow{3}{*}{Order release} & \multirow{3}{*}{Shop-floor control} & Sequencing \\ \cmidrule(lr){3-3} \cmidrule(l){7-7} 
 &  & \multirow{2}{*}{Order release} &  &  &  & \multirow{2}{*}{Order release} \\
 &  &  &  &  &  &  \\ \cmidrule(lr){3-3} \cmidrule(l){5-7} 
 &  & Order monitoring &  & \multirow{2}{*}{Order monitoring} & \multirow{2}{*}{Order monitoring} &  \\ \cmidrule(lr){3-3}
 &  & Resource monitoring &  &  &  & \\ \bottomrule
\end{tabular}%
}
\end{table}
\end{landscape}

\end{document}

输出: 在此处输入图片描述

答案1

以下是基于圆角矩形的建议替代布局的代码:

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs}
\usepackage{nicematrix}
\usepackage{geometry}
\usepackage{pdflscape}

\newcommand{\mybox}[2]{\Block[draw,rounded-corners=6pt]{#1-1}{#2}}

\begin{document}
\begin{landscape}
\centering
\NiceMatrixOptions{cell-space-limits = 1.5pt}
\footnotesize
\setlength{\tabcolsep}{2.15pt}
\begin{NiceTabular}{lwc{0pt} cc wc{0pt} cc wc{0pt} cc wc{0pt} cc wc{0pt} cc}
  && \Block[draw]{1-2}{Author1} &    
  && \Block[draw]{1-2}{Author2} &    
  && \Block[draw]{1-2}{Author3} &
  && \Block[draw]{1-2}{Author4} &    
  && \Block[draw]{1-2}{Author5} &\\
\\
\Block[draw]{12-1}{\rotate Production planning} 
  && \mybox{1}{Sales\\ Planning} &  
  && \mybox{2}{Program\\ planning} & \mybox{1}{Sales\\ forecast} 
  && \mybox{2}{Primary\\ requirements\\ planning} & \mybox{2}{Production\\ Program\\ Planning}
  && \mybox{2}{Program\\ planning} & \mybox{1}{Sales\\ forecast} 
  && \mybox{2}{Primary\\ requirements\\ planning} & \mybox{2}{Production\\ Program\\ Planning} \\ 

  && \mybox{1}{Production\\  program\\ planning} & 
  && & \mybox{1}{Rough-cut\\ scheduling} 
  && &    
  && & \mybox{1}{Rough-cut\\ scheduling} 
  && &    \\
\\
  && \mybox{4}{Inventory\\ planning} & \mybox{3}{Production\\ requirement\\ planning} 
  && \mybox{4}{Material\\management} & \mybox{1}{Bill of \\ material\\ explosion} 
  && \mybox{4}{Material \\ Requirements \\ Planning} & \mybox{1}{Bill of \\ material\\ explosion} 
  && \mybox{4}{Material\\management} & \mybox{1}{Bill of \\ material\\ explosion} 
  && \mybox{4}{Material \\ Requirements \\ Planning} & \mybox{1}{Bill of \\ material\\ explosion} \\
  
  && & 
  && & \mybox{2}{Inventory \\ reconciliation} 
  && & \mybox{1}{Gross \\ requirements\\ panning}
  && & \mybox{2}{Inventory \\ reconciliation} 
  && & \mybox{1}{Gross \\ requirements\\ panning}\\
  
  && & 
  && & 
  && & \mybox{1}{Net \\ requirements\\ panning}
  && & 
  && & \mybox{1}{Net \\ requirements\\ panning}\\
  
  && & \mybox{1}{Production\\ type\\ allocation} 
  && & \mybox{1}{Lot size \\ calculation} 
  &&  & \mybox{1}{Lot size \\ calculation} 
  && & \mybox{1}{Lot size \\ calculation} 
  &&  & \mybox{1}{Lot size \\ calculation} \\
\\
  && \mybox{4}{Production\\ planning} & \mybox{1}{Work\\ preparation} 
  && \mybox{4}{Time\\ management} & \mybox{2}{Scheduling} 
  && \mybox{2}{Rough-cut\\ scheduling} & 
  && \mybox{4}{Time\\ management} & \mybox{2}{Scheduling} 
  && \mybox{2}{Rough-cut\\ scheduling} & \\
  
  &&  & \mybox{1}{Production\\ order\\ scheduling} 
  &&  &  
  &&  & 
  &&  &  
  &&  & \\
  
  &&  & \mybox{1}{Lot Size \\ calculation} 
  &&  & \mybox{2}{Capacity\\ planning} 
  && \mybox{2}{Capacity\\ alignment} & \mybox{2}{Detailed\\ scheduling}
  &&  & \mybox{2}{Capacity\\ planning} 
  && \mybox{2}{Capacity\\ alignment} & \mybox{2}{Detailed\\ scheduling}\\
  
  &&  & \mybox{1}{Capacity\\ planning} 
  &&  &  
  &&  & 
  &&  &  
  &&  & \\
  
\\
\Block[draw]{4-1}{\rotate Production control} 
  && \mybox{4}{Production\\ control} & \mybox{1}{Sequencing} 
  && \mybox{4}{Sequencing} & \mybox{2}{Order\\ release} 
  && \mybox{2}{Shop-floor\\ control} & \mybox{1}{Sequencing}  
  && \mybox{4}{Sequencing} & \mybox{2}{Order\\ release} 
  && \mybox{2}{Shop-floor\\ control} & \mybox{1}{Sequencing}  \\
  
  &&  & \mybox{1}{Order\\ release} 
  &&  &  
  &&  & \mybox{1}{Order\\ release}
  &&  &  
  &&  & \mybox{1}{Order\\ release}\\
  
  &&  & \mybox{1}{Order\\ monitoring} 
  &&  & \mybox{2}{Order\\ monitoring} 
  && &\mybox{2}{Order\\ monitoring}  
  &&  & \mybox{2}{Order\\ monitoring} 
  && &\mybox{2}{Order\\ monitoring}  \\
  
  &&  & \mybox{1}{Resource\\ monitoring} 
  &&  &  
  &&  & 
  &&  &  
  &&  & \\
\end{NiceTabular}
\end{landscape}

\end{document}

相关内容