I have the following code which produces the first attached Table. But as you can see in the table, both the table label and the caption all fall on the same line:
\documentclass[10pt,journal,compsoc]{IEEEtran}
% *** CITATION PACKAGES ***
%
\ifCLASSOPTIONcompsoc
% IEEE Computer Society needs nocompress option
% requires cite.sty v4.0 or later (November 2003)
\usepackage[nocompress]{cite}
\else
% normal IEEE
\usepackage{cite}
\fi
\usepackage{subcaption}
%\usepackage{subfig}
%\usepackage{subcaption}
\usepackage[draft]{graphicx}
\usepackage{algorithm,algpseudocode}
\usepackage{mathtools}
\usepackage{filecontents}
\usepackage{lipsum}
\usepackage[flushleft]{threeparttable}
\usepackage{cite}
\usepackage{amssymb}
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx
\usepackage{mathtools, cases}
\usepackage{amsmath,empheq}
\usepackage{eqparbox} % for the second example
\usepackage{verbatim}
\usepackage{varwidth}% http://ctan.org/pkg/varwidth
\usepackage{color}
\usepackage{xcolor}
\usepackage[export]{adjustbox}
\usepackage{multirow}
\newcommand{\meq}[2]{%
\eqmakebox[#1][s]{$\displaystyle#2$}%
}
% correct bad hyphenation here
\hyphenation{op-tical net-works semi-conduc-tor}
%\let\emptyset\varnothing
\begin{document}
\begin{table}[!bp]
\centering
\caption{Evaluation of overall performances on both datasets}
\label{tab:default}
\resizebox{0.5\textwidth}{!}{%
\begin{tabular}{|l|l|l|l|l|l|l|}
\hline
\multicolumn{7}{|c|}{Datasets} \\ \hline
\multicolumn{3}{|c|}{In-House} & \multicolumn{4}{c|}{NSL-KDD} \\ \hline
DR & ACC & FPR & K & DR & ACC & FPR \\ \hline
\multirow{8}{*}{99.75\%} & \multirow{8}{*}{99.72\%} & \multirow{8}{*}{0.06\%} & 1 & 90.53\% & 96.14\% & 0.00\% \\ \cline{4-7}
& & & 2 & 94.22\% & 97.65\% & 0.00\% \\ \cline{4-7}
& & & 3 & 95.47\% & 98.16\% & 0.00\% \\ \cline{4-7}
& & & 4 & 96.10\% & 98.41\% & 0.00\% \\ \cline{4-7}
& & & 5 & 96.48\% & 98.57\% & 0.00\% \\ \cline{4-7}
& & & 10 & 97.25\% & 98.87\% & 0.02\% \\ \cline{4-7}
& & & 20 & 97.57\% & 98.88\% & 0.22\% \\ \cline{4-7}
& & & 30 & 97.68\% & 98.40\% & 1.11\% \\ \hline
\end{tabular}%
}
\end{table}
\end{document}
But what I want is a table with the caption format below:
How do I achieve this? Any help will be appreciated.
Best Answer
subcaption
. do you really need them? if not simple delete it and your problem will disappearsubcaption
than you need mimic IEEEtran table caption set up already in document preamble (see mwe below)off-topic:
0.5\textwidth
is not good solution. with this the table is wider then text in a column. if you persist to resize table, then:\resizebox{\columnwidth}{!}{....}
note: in preamble i delete all packages load twice and comment others not relevant to this mwe