2

My table captions don't conform to IEEE journal format. I wrote the below code:

\documentclass[10pt,journal]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{float}
\usepackage{multirow}
\usepackage{makecell}
\usepackage{caption,subcaption}
\usepackage{varwidth}
\graphicspath{ {./images/} }
\usepackage{nccmath}
\usepackage{afterpage}
\usepackage{placeins}
   
\begin{table*}
\caption{Comparison of test accuracies of classifiers on different features}
\setlength\tabcolsep{0pt}
\begin{minipage}[t]{0.42\textwidth}
\caption{Confusion Matrix}
\begin{tabular*}{1\textwidth}[t]{@{\extracolsep{\fill}} l *{8}{c}}
\toprule
Original Class & \multicolumn{8}{c}{Class Predicted} \\
\cmidrule{2-9}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8  \\
\midrule
1 & 30 & 0 & 0 & 0 & 0  & 0  & 0 & 0 \\
2 & 0 & 30 & 0 & 0 & 0 & 0 & 0 & 0 \\
3 & 0 & 0 & 30 & 0 & 0 & 0 & 0 & 0 \\
4 & 0 & 0 & 0 & 30 & 0 & 0 & 0 & 0  \\
5 & 0 & 0 & 0 & 0 & 30 & 0 & 0 & 0  \\
6 & 0 & 0 & 0 & 0 & 3 & 27 & 0 & 0  \\
7 & 0 & 0 & 0 & 0 & 0 & 0 & 30 & 0  \\
8 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 29  \\
\bottomrule
\end{tabular*}

\end{minipage}
\hfill
\begin{minipage}[t]{0.55\textwidth}
\caption{Evaluation Metrics}
\begin{tabular*}{1\textwidth}[t]{@{\extracolsep{\fill}} l *{8}{c}}
\toprule
& \multicolumn{8}{c}{Class} \\
\cmidrule{2-9}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8  \\
\midrule
TPR & 1 & 1 & 1 & 1 & 1  & 0.9  & 1 & 0.97 \\
TNR & 1 & 1 & 1 & 1 & 0.98 & 1 & 1 & 1 \\
FPR & 0 & 0 & 0 & 0 & 0.02 & 0 & 0 & 0 \\
FNR & 0 & 0 & 0 & 0 & 0 & 0.1 & 0 & 0.03  \\
\bottomrule
\end{tabular*}

\end{minipage}
\end{table*}

The output looks like this:

enter image description here

2
  • Can you add something about what output you would like. – StefanH Mar 8 at 7:53
  • package caption, sunbcaption overwrite default IEEEtran settings. Remove them from preamble. – Zarko Mar 8 at 8:23
5

As I mentioned in my comment, packages caption and subcaption overwrite default settings of IEEEtran document class. Instead of them yo should use subfig if you needed it: \usepackage[caption=false,font=footnotesize]{subfig}

An example how you can correct your MWE. It now contain your original presentation of your tables and new one with sub tables which has more sense:

\documentclass[journal]{IEEEtran}
\usepackage[english]{babel}
\usepackage{nccmath, amssymb,mathtools}% nccmath had to be loaded before mathtools
\usepackage{graphicx}
\usepackage{booktabs, makecell, multirow}
\usepackage{float}
%\usepackage{caption,subcaption} % they are not compatible with ieeetran
\usepackage[caption=false,font=footnotesize]{subfig}
\usepackage{varwidth}
\graphicspath{ {./images/} }
\usepackage{afterpage}
\usepackage{placeins}

\begin{document}
\begin{table*}
\caption{Comparison of test accuracies of classifiers on different features}
\setlength\tabcolsep{0pt}
\begin{minipage}[t]{0.42\textwidth}
\caption{Confusion Matrix}
\begin{tabular*}{1\textwidth}[t]{@{\extracolsep{\fill}} l *{8}{c}}
\toprule
Original Class & \multicolumn{8}{c}{Class Predicted} \\
\cmidrule{2-9}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8  \\
\midrule
1 & 30 & 0 & 0 & 0 & 0  & 0  & 0 & 0 \\
2 & 0 & 30 & 0 & 0 & 0 & 0 & 0 & 0 \\
3 & 0 & 0 & 30 & 0 & 0 & 0 & 0 & 0 \\
4 & 0 & 0 & 0 & 30 & 0 & 0 & 0 & 0  \\
5 & 0 & 0 & 0 & 0 & 30 & 0 & 0 & 0  \\
6 & 0 & 0 & 0 & 0 & 3 & 27 & 0 & 0  \\
7 & 0 & 0 & 0 & 0 & 0 & 0 & 30 & 0  \\
8 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 29  \\
\bottomrule
\end{tabular*}
\end{minipage}
\hfill
\begin{minipage}[t]{0.55\textwidth}
\caption{Evaluation Metrics}
\begin{tabular*}{1\textwidth}[t]{@{\extracolsep{\fill}} l *{8}{c}}
\toprule
& \multicolumn{8}{c}{Class} \\
\cmidrule{2-9}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8  \\
\midrule
TPR & 1 & 1 & 1 & 1 & 1  & 0.9  & 1 & 0.97 \\
TNR & 1 & 1 & 1 & 1 & 0.98 & 1 & 1 & 1 \\
FPR & 0 & 0 & 0 & 0 & 0.02 & 0 & 0 & 0 \\
FNR & 0 & 0 & 0 & 0 & 0 & 0.1 & 0 & 0.03  \\
\bottomrule
\end{tabular*}
\end{minipage}
\end{table*}

\begin{table*}
\caption{Comparison of test accuracies of classifiers on different features}
\setlength\tabcolsep{0pt}
\subfloat[Confusion Matrix]
{
\begin{tabular*}{0.45\linewidth}[t]{@{\extracolsep{\fill}} l *{8}{c}}
    \toprule
\makecell{Original\\ Class} 
  & \multicolumn{8}{c}{Class Predicted} \\
    \cmidrule{2-9}
  & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8  \\
    \midrule
1 & 30 & 0 & 0 & 0 & 0  & 0  & 0 & 0 \\
2 & 0 & 30 & 0 & 0 & 0 & 0 & 0 & 0 \\
3 & 0 & 0 & 30 & 0 & 0 & 0 & 0 & 0 \\
4 & 0 & 0 & 0 & 30 & 0 & 0 & 0 & 0  \\
5 & 0 & 0 & 0 & 0 & 30 & 0 & 0 & 0  \\
6 & 0 & 0 & 0 & 0 & 3 & 27 & 0 & 0  \\
7 & 0 & 0 & 0 & 0 & 0 & 0 & 30 & 0  \\
8 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 29  \\
    \bottomrule
\end{tabular*}
}%
\hfill
\subfloat[Evaluation Metrics]
{
\begin{tabular*}{0.45\linewidth}[t]{@{\extracolsep{\fill}} l *{8}{c}}
\toprule
& \multicolumn{8}{c}{Class} \\
\cmidrule{2-9}
& 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8  \\
\midrule
TPR & 1 & 1 & 1 & 1 & 1  & 0.9  & 1 & 0.97 \\
TNR & 1 & 1 & 1 & 1 & 0.98 & 1 & 1 & 1 \\
FPR & 0 & 0 & 0 & 0 & 0.02 & 0 & 0 & 0 \\
FNR & 0 & 0 & 0 & 0 & 0 & 0.1 & 0 & 0.03  \\
\bottomrule
\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.