2

I have a problem with using \subcaption and IEEEeqnarraybox in IEEEtran class.

The caption should look like below along with using \subcaption(as it does without using \subcaption)

enter image description here

but it looks like below with using \subcaption enter image description here

Following is MWE:

\documentclass[twoside]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\usepackage{booktabs}
\usepackage{lipsum}
\usepackage{subcaption}

\begin{document}

\lipsum[2]

\begin{table}[!t]
    \centering
    \caption{This is a Caption. \label{mylabel}}
    \centering
    \begin{IEEEeqnarraybox}[
        \IEEEeqnarraystrutmode
        \IEEEeqnarraystrutsizeadd{3pt}
        {1pt}
        ]{c'c'c/v/c'c'c}
    a & b& c && d & e
        \\\hline
        1 & 3 & 3 && +1 & +1 \\
        3 & 5 & 4 && +1 & -1 \\
        2& 2& 3  && -1 & +1 \\
        4& 44& 24 && -1 & -1 \\
        4& 5 & 10 && -1 & +1 
    \end{IEEEeqnarraybox}
\end{table}

\lipsum[1-40]

\end{document}
kaka
  • 546
  • 2
  • 6
  • 20
  • 1
    Removing subcaption is no option, I think? –  Jun 07 '17 at 06:28
  • Yup, no option. I am actually using subcaption because of subfigure in my document. – kaka Jun 07 '17 at 06:44
  • 1
    Well, your 'MWE' is not using it yet and caption gives a clear warning: "Unsupported document class -- don't use caption" –  Jun 07 '17 at 06:44

2 Answers2

3

Please note that the caption package regards the IEEEtran class as being not supported and gives a clear warning to refrain from using caption here...

However, it works with

\captionsetup[table]{name=TABLE,labelsep=newline,justification=centering,textfont=sc}

The \label has to be put outside.

\documentclass[twoside]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\usepackage{booktabs}
\usepackage{lipsum}
\usepackage{subcaption}

\begin{document}

\lipsum[2]


\captionsetup[table]{name=TABLE,labelsep=newline,textfont=sc}



\begin{table}[!t]
    \centering
    \caption{This is a Caption.}
    \centering
    \begin{IEEEeqnarraybox}[
        \IEEEeqnarraystrutmode
        \IEEEeqnarraystrutsizeadd{3pt}
        {1pt}
        ]{c'c'c/v/c'c'c}
    a & b& c && d & e
        \\\hline
        1 & 3 & 3 && +1 & +1 \\
        3 & 5 & 4 && +1 & -1 \\
        2& 2& 3  && -1 & +1 \\
        4& 44& 24 && -1 & -1 \\
        4& 5 & 10 && -1 & +1 
    \end{IEEEeqnarraybox}
\end{table}

\lipsum[1-40]

\end{document}

enter image description here

kaka
  • 546
  • 2
  • 6
  • 20
  • But it still look like what the problem actually is. Caption should look like as in first figure in my question. – kaka Jun 07 '17 at 06:56
  • You vote for some of your new answers to return the favor of chatting help. +1 – Sebastiano Jun 07 '17 at 06:57
  • @kaka: There is TABLE I\newline Your caption --- that's what you wanted, see the screen shot –  Jun 07 '17 at 06:58
  • Caption has to be in Upper case. – kaka Jun 07 '17 at 07:01
  • 1
    @kaka: Updated the code, however, not the screen shot yet –  Jun 07 '17 at 07:18
  • Thank you but it is still different from the upper case as shown in first figure of the question. – kaka Jun 07 '17 at 07:41
  • 1
    @kaka: You mean small caps, not capital letters, actually, see the next update –  Jun 07 '17 at 07:50
  • Thank you. One last thing, if the caption goes long then it is not properly centered and instead justified to the left. – kaka Jun 07 '17 at 08:04
  • 1
    @kaka: Add justification=centering to the \captionsetup options, that should work –  Jun 07 '17 at 08:06
2

The caption package is incompatible with IEEEtran.cls, as the warning

Package caption Warning: Unsupported document class (or package) detected,
(caption)                usage of the caption package is not recommended.
See the caption package documentation for explanation.

hints at. Copy editors at IEEE will be very annoyed by contributors trying to break the class.

If you need subfloats, you can do

\usepackage[caption=false]{subfig}

and use \subfloat instead of subfigure (syntax change is necessary).

egreg
  • 1,121,712
  • There are a lot of subfigures in my document to change syntax and also subcaption is more recent and up to date so I want to stick to subcaption. Thanks anyways for letting me know the inherent issue. – kaka Jun 07 '17 at 07:44