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

This is the ouput i am getting This is the acutual table that i want

schoekling
  • 3,142
  • 2
    Welcome to tex.se! Maybe you could explain where the problem is...? – Jes Mar 20 '21 at 11:13
  • Actually, 1st image is the output that I'm getting by the above code and also the full table is not showing in the document. 2nd image is the table that I want. Kindly help me with this – Ch Qasim Mar 20 '21 at 11:15
  • Oh I see, the table is overflowing in your IEEE document. Kindly consider modifiying your code and adding a MWE, so other users can compile it and experiment with it. Please check What is an MWE. On a first glance, the overflowing of the table comes from resizebox{\textwidth}. Maybe it's not considering that is a two column document? – Jes Mar 20 '21 at 11:21
  • Also, maybe it's because it's not working properly, but there seems to be some cells merging where they should be separated. In the case that you are not very experienced with tables, may I suggest an online latex table generator? – Jes Mar 20 '21 at 11:25
  • Your table appears to be quite wide, so I assume it won't fit into one column of text that easily. Could you introduce some kind of abbreviation in the column headers of columns 4 to 6 as well? – leandriis Mar 20 '21 at 11:33
  • yes the doc is two-column document, and I think that's the only reason it's not considering resizebox{\textwidth} – Ch Qasim Mar 20 '21 at 11:45

3 Answers3

3

Here are some alternative approaches:

enter image description here

PErsonally, I'd suggest using a table with no vertical and less horizontal lines, such as the following:

enter image description here

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

leandriis
  • 62,593
2

Here's a solution that does not use \scalebox or \resizebox, employs a landscape format layout, a tabularx environment to allow automatic line-breaking in the final four columns, dispenses with all vertical rules and most horizontal rules, and simplifies the entries in column 3, "Model". For instance, "Prius" and "RAV4" is just as informative, and less repetitious, as "Toyota Prius" and "Toyota RAV4".

enter image description here

\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} 
Mico
  • 506,678
0

As @ Jes suggested, the latex table generator will do the job

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

enter image description here

Excelsior
  • 2,322