1

I require a method for captioning tables according to IEEE standards as follows:

enter image description here

Specifically, "TABLE I" must be above the caption itself.

For the record, I am aware of the \documentclass{ieeetran} which will give me exactly the table captioning I want, but this comes with a whole host of other formatting which I neither want nor require for my purposes.

So, here is my MWE:

\documentclass[12pt]{report}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{float}
\renewcommand*\thetable{\Roman{table}}
\renewcommand*{\tablename}{TABLE}
\usepackage{cleveref}

\begin{document}

\noindent \Cref{tab:table} demonstrates my current table-captioning method.

\begin{table}[H]
    \centering
    \caption[Alphanumeric Data]{ALPHANUMERIC DATA}
    \vspace{0.2cm}
    \begin{tabularx}{\textwidth}{X X X X}
        \toprule
         & \bf x & \bf y & \bf z \\
        \midrule
        \bf A & 1 & 2 & 3 \\
        \bf B & 4 & 5 & 6 \\
        \bf C & 7 & 8 & 9 \\
        \bottomrule
    \end{tabularx}
    \label{tab:table}
\end{table}

\end{document}

enter image description here

How do I put "TABLE I" above the caption itself and remove the colon so I get the output I showed in the first picture?

Thanks in advance.

1
  • 3
    Take a look at the caption packe and its labelsep=newline option.
    – leandriis
    Commented Sep 23, 2019 at 5:12

2 Answers 2

2

caption offers labelsep = newline, as well as other options that might provide what you're looking for:

enter image description here

\documentclass{report}

\usepackage{caption}
\usepackage{cleveref}

\renewcommand*\thetable{\Roman{table}}

\captionsetup[table]{
  labelsep = newline, % Label and caption on separate line
  font = sc % Small caps font for caption
}  

\begin{document}

\noindent \Cref{tab:table} demonstrates my current table-captioning method.

\begin{table}
  \centering
  \caption{A table}
  \label{tab:table}
  \begin{tabular}{ *{3}{c} }
    \hline
    A & B & C \\
    \hline
  \end{tabular}
\end{table}

\end{document}
0

NB! I have replaced the not supported \bf commands with \bfseries. Since first column was in bold, I used the >{\bfseries}-command to make the text in the column bold in one go.

The layout of the caption can easily be archive using a document class from the KOMA-script bundle. In addition, I suggest to uppercase the table label by redefining a KOMA-script-command instead of hardcode the word TABLE. If you use other language than English, you solution breaks. Just for demonstration of the flexible KOMA-script-commands, I changed the font in the caption. If you cannot use one of KOMA-script's document-classes, you can load the package scrextend, which give you much of KOMA-script's flexible commands. KOMA-script has several commands which give you the possibility to format the captions both globally and locally. It is also easy to compose non-floating table environments.

enter image description here

\documentclass[captions=tableheading, fontsize=12pt, captions=nooneline]{scrreprt}
\usepackage{tabularx, cleveref}
\usepackage{booktabs, scrhack, ragged2e}

\renewcommand*\thetable{\Roman{table}}
\usepackage{cleveref}

\renewcommand*{\tableformat}{\MakeUppercase{\tablename~\thetable\autodot}} % Instead of hard coding TABLE
\addtokomafont{caption}{\small\sffamily}
\addtokomafont{captionlabel}{\small\sffamily}
\setcaptionalignment[table]{C}
\renewcommand*{\captionformat}{}
\setcapindent*{0pt}

\begin{document}

\noindent \Cref{tab:table} demonstrates my current table-captioning method. As you will see,  \cref{tab:table} is a floating table, since it has floated above the referring text.

\Cref{tab:table-ii} demonstrates how to typeset a none-floating table in KOMA-script. As you will see, \cref{tab:table-ii} is not floating, because it is appear where I have written the table inside text. A `minipage` environment should be used to avoid page breaks between the caption and the table. In addition, you should embed the `minipage` environment in a `flushleft` environment both to achieve a pleasing separation between the surrounding text, and to avoid that the `minipage` environment is indented by the paragraph indentation (you may also use the `center` environment.

\begin{table}
    \caption[Alphanumeric Data]{ALPHANUMERIC DATA\label{tab:table}}
    \begin{tabularx}{\textwidth}{@{}>{\bfseries}X X X X@{}}
        \toprule
         &  \bfseries x & \bfseries y & \bfseries z \\
        \midrule
        A & 1 & 2 & 3 \\
        B & 4 & 5 & 6 \\
        C & 7 & 8 & 9 \\
        \bottomrule
    \end{tabularx}
\end{table}


\begin{flushleft}
\begin{minipage}{\linewidth}
\captionaboveof{table}[More Alphanumeric Data]{MORE ALPHANUMERIC DATA\label{tab:table-ii}}
\begin{tabularx}{\textwidth}{@{}>{\bfseries}X X X X@{}}
        \toprule
         &  \bfseries x & \bfseries y & \bfseries z \\
        \midrule
        A & 1 & 2 & 3 \\
        B & 4 & 5 & 6 \\
        C & 7 & 8 & 9 \\
       \bottomrule
\end{tabularx}
\end{minipage}
\end{flushleft}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .