需要有关 LATEX 表多行多列的帮助

需要有关 LATEX 表多行多列的帮助
\begin{table}[]
\resizebox{\textwidth}{!}{%
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
Ref &
  \multicolumn{1}{l|}{Manufacturers} &
  Model &
  DC Motor(Brushed) &
  AC Induction Motor &
  PM Brushed DC Motor &
  \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}PM-Sync Reluctance \\ Motor(PM-SynRM)\end{tabular}} &
  \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}Permanent Magnet Synchronous \\ Motor(PMSM)\end{tabular}} \\ \hline
 \multirow{2}{*}{} & \multicolumn{1}{c|}{\multirow{2}{*}{Toyota}} & Toyota Prius &  &  &\\ 
    \hhline{~~----}  & \multicolumn{2}{c}{} Toyota RAV4 &  &  & \\ \hline
  \multirow{2}{*}{} & \multicolumn{1}{c|}{\multirow{4}{*}{Tesla}} & Model S &  &  &\\
    \hhline{~~----}  & \multicolumn{2}{c}{} Model X &  &  & \\
    \hhline{~~----}  & \multicolumn{2}{c}{} Model 3 &  &  & \\
    \hhline{~~----}  & \multicolumn{2}{c}{} Model Y &  &  & \\ \hline
 & Nissan         &Nissan Leaf  &  &  &  &  &  \\ \hline
 & Porsche        &Porsche Taycon  &  &  &  &  &  \\ \hline
 & Audi           &Audi e-tron  &  &  &  &  &  \\ \hline
  \multirow{2}{*}{} & \multicolumn{1}{c|}{\multirow{2}{*}{BMW}} & BMW i3 &  &  &\\ 
    \hhline{~~----}  & \multicolumn{2}{c}{} BMW-Mini E &  &  & \\ \hline
 & General Motors &GM EV1  &  &  &  &  &  \\ \hline
 & Fiat Panda     &Fiat Panda Elettra  &  &  &  &  &  \\ \hline
  \multirow{2}{*}{} & \multicolumn{1}{c|}{\multirow{2}{*}{KIA}} & Soul EV &  &  &\\ 
    \hhline{~~----}  & \multicolumn{2}{c}{} Niro EV &  &  & \\ \hline
 & Ather Energy   &Ather 450X  &  &  &  &  &  \\ \hline
\end{tabular}%
}
\end{table}

这是我得到的输出这是我想要的实际表格

答案1

以下是一些替代方法:

在此处输入图片描述

就我个人而言,我建议使用没有垂直线且水平线较少的表格,例如以下表格:

在此处输入图片描述

\documentclass{ieeeaccess}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{makecell}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{calc}
\usepackage{rotating}
\usepackage{booktabs}
\begin{document}
\lipsum

\begin{table*}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|c|l|l|c|c|c|c|c|}
\hline
Ref &
  \thead{Manufacturers} &
  \thead{Model} &
  \thead{DC Motor\\ (Brushed)} &
  \thead{AC Induction\\ Motor} &
  \thead{PM Brushed\\ DC Motor} &
  \thead{PM-Sync Reluctance \\ Motor(PM-SynRM)} &
  \thead{Permanent Magnet\\ Synchronous  Motor(PMSM)} \\ \hline
  & \multirow{2}{*}{Toyota} & Toyota Prius        &  &  &  &  & \\ \cline{3-8}
  &                         & Toyota RAV4         &  &  &  &  & \\ 
  \hline
  & \multirow{4}{*}{Tesla}  & Model S             &  &  &  &  & \\ \cline{3-8}
  &                         & Model X             &  &  &  &  & \\ \cline{3-8}
  &                         & Model 3             &  &  &  &  & \\ \cline{3-8}
  &                         & Model Y             &  &  &  &  & \\ 
  \hline
  & Nissan                  & Nissan Leaf         &  &  &  &  & \\ 
  \hline
  & Porsche                 & Porsche Taycon      &  &  &  &  & \\ 
  \hline
  & Audi                    & Audi e-tron         &  &  &  &  & \\ 
  \hline
  & \multirow{2}{*}{BMW}    & BMW i3              &  &  &  &  & \\ \cline{3-8}
  &                         & BMW-Mini E          &  &  &  &  & \\ 
  \hline
  & General Motors          & GM EV1              &  &  &  &  & \\ 
  \hline
  & Fiat Panda              & Fiat Panda Elettra  &  &  &  &  & \\ 
  \hline
  & \multirow{2}{*}{KIA}    & Soul EV             &  &  &  &  & \\ \cline{3-8}
  &                         & Niro EV             &  &  &  &  & \\ 
  \hline
  & Ather Energy            & Ather 450X          &  &  &  &  & \\ 
  \hline
\end{tabular*}
\end{table*}
\lipsum

\begin{table}
\scriptsize
\renewcommand{\theadfont}{\scriptsize}
\settowidth\rotheadsize{\theadfont DC Motor (Brushed)}
\begin{tabular}{|c|m{\widthof{General}}|m{\widthof{Model X}}|c|c|c|c|c|}
\hline
Ref &
  \thead{Manu-\\facturers} &
  \thead{Model} &
  \rothead{DC Motor (Brushed)} &
  \rothead{AC Induction Motor} &
  \rothead{PM Brushed DC Motor} &
  \rothead{PM-Sync Reluctance  Motor (PM-SynRM)} &
  \rothead{Permanent Magnet Synchronous  Motor (PMSM)} \\ \hline
  & \multirow{3}{*}{Toyota} & Toyota Prius        &  &  &  &  & \\ \cline{3-8}
  &                         & Toyota RAV4         &  &  &  &  & \\ 
  \hline
  & \multirow{4}{*}{Tesla}  & Model S             &  &  &  &  & \\ \cline{3-8}
  &                         & Model X             &  &  &  &  & \\ \cline{3-8}
  &                         & Model 3             &  &  &  &  & \\ \cline{3-8}
  &                         & Model Y             &  &  &  &  & \\ 
  \hline
  & Nissan                  & Nissan Leaf         &  &  &  &  & \\ 
  \hline
  & Porsche                 & Porsche Taycon      &  &  &  &  & \\ 
  \hline
  & Audi                    & Audi\newline e-tron         &  &  &  &  & \\ 
  \hline
  & \multirow{4}{*}{BMW}    & BMW i3              &  &  &  &  & \\ \cline{3-8}
  &                         & BMW-Mini E          &  &  &  &  & \\ 
  \hline
  & General Motors          & GM EV1              &  &  &  &  & \\ 
  \hline
  & Fiat Panda              & Fiat Panda Elettra  &  &  &  &  & \\ 
  \hline
  & \multirow{2}{*}{KIA}    & Soul EV             &  &  &  &  & \\ \cline{3-8}
  &                         & Niro EV             &  &  &  &  & \\ 
  \hline
  & Ather Energy            & Ather 450X          &  &  &  &  & \\ 
  \hline
\end{tabular}
\end{table}

\lipsum

\begin{table}
\setlength{\tabcolsep}{5pt}
\settowidth\rotheadsize{\theadfont PM-SynRM}
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}} c l l c c c c c @{}}
\toprule
Ref &
  \thead{Manufacturers} &
  \thead{Model} &
  \rothead{DCM} &
  \rothead{ACIndM} &
  \rothead{PMBDCM} &
  \rothead{PM-SynRM} &
  \rothead{PMSM} \\ 
  \midrule
  & Toyota         & Toyota Prius        &  &  &  &  & \\ 
  &                & Toyota RAV4         &  &  &  &  & \\ 
  \addlinespace
  & Tesla          & Model S             &  &  &  &  & \\ 
  &                & Model X             &  &  &  &  & \\ 
  &                & Model 3             &  &  &  &  & \\ 
  &                & Model Y             &  &  &  &  & \\ 
  \addlinespace
  & Nissan         & Nissan Leaf         &  &  &  &  & \\ 
  \addlinespace
  & Porsche        & Porsche Taycon      &  &  &  &  & \\
  \addlinespace 
  & Audi           & Audi e-tron         &  &  &  &  & \\ 
  \addlinespace
  & BMW            & BMW i3              &  &  &  &  & \\ 
  &                & BMW-Mini E          &  &  &  &  & \\ 
  \addlinespace
  & General Motors & GM EV1              &  &  &  &  & \\ 
  \addlinespace
  & Fiat Panda     & Fiat Panda Elettra  &  &  &  &  & \\ 
  \addlinespace
  & KIA            & Soul EV             &  &  &  &  & \\ 
  &                & Niro EV             &  &  &  &  & \\
  \addlinespace
  & Ather Energy   & Ather 450X          &  &  &  &  & \\ 
  \midrule
  \multicolumn{8}{@{}p{\linewidth}@{}}{DCM:~DC Motor (Brushed); ACIndM:~AC Induction Motor; PMBDCM:~PM Brushed DC Motor; PM-SynRM:~PM-Sync Reluctance  Motor; PMSM:~Permanent Magnet Synchronous  Motor} \\
  \bottomrule
\end{tabular*}
\end{table}
\lipsum


\EOD
\end{document}

答案2

这是一个解决方案不是使用\scalebox\resizebox,采用横向格式布局,tabularx允许在最后四列自动换行,省去所有垂直规则和大多数水平规则,并简化第 3 列“型号”中的条目。例如,“Prius”和“RAV4”与“Toyota Prius”和“Toyota RAV4”一样信息丰富,而且重复性更低。

在此处输入图片描述

\documentclass{article}
\usepackage{booktabs,ragged2e,rotating,tabularx}
\begin{document}
\begin{sidewaystable}
\setlength\tabcolsep{5pt} % default: 6pt
\begin{tabularx}{\textwidth}{@{} lll *{5}{>{\RaggedRight}X} @{}}
\toprule
  Ref &
  Manufacturer &
  Model &
  DC Motor (Brushed) &
  AC Induction Motor &
  PM Brushed DC Motor &
  PM-Sync Reluctance Motor \mbox{(PM-SynRM)} &
  Permanent Magnet Synchronous Motor (PMSM)\\ 
\midrule
  & Toyota & Prius   &  &  & \\ 
  &        & RAV4    &  &  & \\ \addlinespace
  & Tesla  & Model S &  &  & \\
  &        & Model X &  &  & \\
  &        & Model 3 &  &  & \\
  &        & Model Y &  &  & \\ \addlinespace
  & Nissan & Leaf    &  &  &  &  &  \\ \addlinespace
  & Porsche& Taycon  &  &  &  &  &  \\ \addlinespace
  & Audi   & e-tron  &  &  &  &  &  \\ \addlinespace
  & BMW    & i3      &  &  & \\ 
  &        & Mini E  &  &  & \\ \addlinespace
  & GM     & EV1     &  &  &  &  &  \\ \addlinespace
  & Fiat   & Panda Elettra  &  &  &  &  &  \\ \addlinespace
  & KIA    & Soul EV &  &  & \\ 
  &        & Niro EV &  &  & \\ \addlinespace
  & Ather Energy & 450X  &  &  &  &  &  \\ 
\bottomrule
\end{tabularx}
\end{sidewaystable}
\end{document} 

答案3

正如@ Jes 所建议的,Latex 表生成器可以完成这项工作

\documentclass{article}

\usepackage{multirow}
\usepackage{graphicx}

\begin{document}
    \begin{table}[h!]
        \centering
        \resizebox{\textwidth}{!}{%
            \begin{tabular}{|l|l|l|l|l|l|l|l|}
                \hline
                Ref &
                Manufactures &
                Models &
                \begin{tabular}[c]{@{}l@{}}DC\\ Motor\\ (Brushed)\end{tabular} &
                \begin{tabular}[c]{@{}l@{}}AC\\ Induction\\ Motor\end{tabular} &
                \begin{tabular}[c]{@{}l@{}}DC\\ (Brushless)\\ Motor\end{tabular} &
                \begin{tabular}[c]{@{}l@{}}PM-Sync\\ Reluctance\\ Motor\\ (PMSyncRM)\end{tabular} &
                \begin{tabular}[c]{@{}l@{}}Permanent\\ Magnet-Sync.\\ Motor (PMSM)\end{tabular} \\ \hline
                \multirow{2}{*}{} & \multirow{2}{*}{Toyota}                                  & \begin{tabular}[c]{@{}l@{}}Toyota\\ Primus\end{tabular}      &  &  &  &  &  \\ \cline{3-8} 
                &                                                          & \begin{tabular}[c]{@{}l@{}}Toyota\\ RAV4\end{tabular}        &  &  &  &  &  \\ \hline
                \multirow{4}{*}{} & \multirow{4}{*}{TESLA}                                   & Model S                                                      &  &  &  &  &  \\ \cline{3-8} 
                &                                                          & Model X                                                      &  &  &  &  &  \\ \cline{3-8} 
                &                                                          & Model 3                                                      &  &  &  &  &  \\ \cline{3-8} 
                &                                                          & Model Y                                                      &  &  &  &  &  \\ \hline
                & Nissan                                                   & Nissan Leaf                                                  &  &  &  &  &  \\ \hline
                & Porsche                                                  & \begin{tabular}[c]{@{}l@{}}Porsche\\ Taycan\end{tabular}     &  &  &  &  &  \\ \hline
                & Audi                                                     & Audi e-tron                                                  &  &  &  &  &  \\ \hline
                \multirow{2}{*}{} & \multirow{2}{*}{BMW}                                     & BMW i3                                                       &  &  &  &  &  \\ \cline{3-8} 
                &                                                          & BMW-Mini E                                                   &  &  &  &  &  \\ \hline
                & \begin{tabular}[c]{@{}l@{}}General\\ Motors\end{tabular} & GM EV1                                                       &  &  &  &  &  \\ \hline
                & Fiat Panda                                               & \begin{tabular}[c]{@{}l@{}}Fiat Panda\\ Elettra\end{tabular} &  &  &  &  &  \\ \hline
                \multirow{2}{*}{} & \multirow{2}{*}{KIA}                                     & Soul EV                                                      &  &  &  &  &  \\ \cline{3-8} 
                &                                                          & Nitro EV                                                     &  &  &  &  &  \\ \hline
                & Ather Energy                                             & Ather 450X                                                   &  &  &  &  &  \\ \hline
            \end{tabular}%
        }
    \end{table}
\end{document}

在此处输入图片描述

相关内容