2

I need to place the caption of a table in the center in the ieeetran class file. Is there exist any way? I have tried a lot, but failed in every aspect. Any help will be appreciated. Thanks in advance.

I am using the document class named as:

\documentclass[journal,compsoc]{IEEEtran}

The MWE for my table is as follows:

\documentclass[journal,compsoc]{IEEEtran}
\usepackage{caption,graphicx}
\begin{document}
\title{ABC Study}
\section{RM}
\begin{table}
\centering
\caption{Results of the search process.}
\label{ts}
\renewcommand{\arraystretch}{1.2}
\small
\scalebox{0.65}{
\begin{tabular}{|p{5cm}|l|p{4.7cm}|p{3cm}|p{3.9cm}|p{3.7cm}|p{3.5cm}|}
\hline
Authors with Ref. & Year & Theme & Parameter & Technique & Method Validation & Dimension \\ 
\hline
B.~Tansey, E.~Stroulia & 2007 & Estimation of potential business value of evolving SOA applications & effort estimation & COCOMO2 and real options theory & not shown & \\ \hline
L.~Santillo & 2007 & Discusses the boundary problem from the software measurement and estimation perspective & size estimation & COSMIC functional size measurement for SOA environment & not shown & \\ \hline
J.~Lee et al. & 2008 & Estimating project plans and service costs of packaged business process applications & cost estimation & Normative and constructive models & not shown & \\ \hline
\end{tabular}
}
\end{table}
\end{document}

I want to display the caption of the current table like all other previous tables.

enter image description here

The suggestion aligned the table caption at center, but like this format.

enter image description here

16
  • 1
    The caption is centered. The document is set in two-column mode, the table is a float that should fit into a single column, and the caption is centered w.r.t. the first column. If you add text, you will see that the table collides with the text of the other column. Make the float span both columns, by replacing table by table*.
    – gernot
    May 3, 2017 at 14:09
  • 1
    Have you looked at the next page?
    – gernot
    May 3, 2017 at 14:16
  • 1
    @SibaMishra I think that's a whole new question ;) May 3, 2017 at 14:18
  • 1
    @RaajaG What do you mean be "double lined"? In the original code as well as in your code the caption takes one line until it gets longer than the text width, then it wraps of course to a second line.
    – gernot
    May 3, 2017 at 14:18
  • 1
    @SibaMishra Try the code of my answer and see if it produces the same result as in my picture. The caption and the table are fine, and also the reference to the table works (see the first sentence of the section).
    – gernot
    May 3, 2017 at 14:41

2 Answers 2

3

To solve your initial problem, replace table by table*. Your caption is actually centered, but only centered with respect to one column, since table marks a one-column float, whereas table* is a float spanning both columns.

The code below suggests two further changes. First, do not rescale the table, but instead avoid vertical bars (they just take up space and rather distract than help in orientation) and use the tabularx environment that allows you to automatically have equally spaced columns. Moreover, the booktabs package results in nicely spaced rows and lines.

enter image description here

\listfiles
\documentclass[journal,compsoc]{IEEEtran}
\usepackage{graphicx}
\usepackage{tabularx,booktabs}
\usepackage{blindtext}% Only needed for dummy text
\begin{document}
\title{ABC Study}
\author{The author}
\maketitle
\section{RM}

For the results of the search process, see table~\ref{ts}.

\begin{table*}
\centering
\caption{Results of the search process.}\label{ts}

\begin{tabularx}{\textwidth}{XlXXXXX}
\toprule
  Authors with Ref. & Year & Theme & Parameter & Technique & Method Validation & Dimension
\\\midrule
  B.~Tansey, E.~Stroulia & 2007
  & Estimation of potential business value of evolving SOA applications
  & effort estimation & COCOMO2 and real options theory & not shown &
\\\midrule
  L.~Santillo & 2007
  & Discusses the boundary problem from the software measurement and estimation perspective
  & size estimation & COSMIC functional size measurement for SOA environment & not shown &
\\\midrule
  J.~Lee et al. & 2008
  & Estimating project plans and service costs of packaged business process applications
  & cost estimation & Normative and constructive models & not shown &
\\\bottomrule
\end{tabularx}
\end{table*}
\Blindtext

\Blindtext
\end{document}

In the code above I have added \listfiles as the first line. This makes LaTeX write the list of used files to the log file (including version infos). The code above works for the following versions of the packages:

 *File List*
IEEEtran.cls    2015/08/26 V1.8b by Michael Shell
  ot1ppl.fd    2001/06/04 font definitions for OT1/ppl.
graphicx.sty    2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR)
  keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
graphics.sty    2016/10/09 v1.0u Standard LaTeX Graphics (DPC,SPQR)
    trig.sty    2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg    2016/06/04 v1.11 sample graphics configuration
  pdftex.def    2017/01/12 v0.06k Graphics/color for pdfTeX
infwarerr.sty    2016/05/16 v1.4 Providing info/warning/error messages (HO)
 ltxcmds.sty    2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
tabularx.sty    2016/02/03 v2.11 `tabularx' package (DPC)
   array.sty    2016/10/06 v2.4d Tabular extension package (FMi)
booktabs.sty    2016/04/27 v1.618033 publication quality tables
blindtext.sty    2012/01/06 V2.0 blindtext-Package
  xspace.sty    2014/10/28 v1.13 Space after command names (DPC,MH)
supp-pdf.mkii
pdftexcmds.sty    2017/03/19 v0.25 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty    2016/05/16 v1.4 Provides the ifluatex switch (HO)
   ifpdf.sty    2017/03/15 v3.2 Provides the ifpdf switch
epstopdf-base.sty    2016/05/15 v2.6 Base part for package epstopdf
  grfext.sty    2016/05/16 v1.2 Manage graphics extensions (HO)
kvdefinekeys.sty    2016/05/16 v1.4 Define keys (HO)
kvoptions.sty    2016/05/16 v3.12 Key value format for package options (HO)
kvsetkeys.sty    2016/05/16 v1.17 Key value parser (HO)
etexcmds.sty    2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
epstopdf-sys.cfg    2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
  ot1phv.fd    2001/06/04 scalable font definitions for OT1/phv.
    upzd.fd    2001/06/04 font definitions for U/pzd.
 ***********
5
  • It throws error.
    – M S
    May 3, 2017 at 17:47
  • @SibaMishra Which error, what does the message say? You are probably missing one of the packages, or you have an outdated version of some package, e.g. of IEEEtran (conference sites sometimes offer really old versions). Add \listfiles as first line of the code (as I did above for my code, so you can just copy the code), and then compare the file list and version info at the end of the log file with the version info above.
    – gernot
    May 3, 2017 at 17:54
  • table* not working properly. I have added the \listfiles.
    – M S
    May 3, 2017 at 19:01
  • @SibaMishra The "information" that you provide leads nowhere. I suggest that you ask a new question, linking back to this one, and post exactly the code that you try to compile and also a screenshot of the output that you get. And add the first error message that you see in the log file.
    – gernot
    May 3, 2017 at 19:08
  • Okay will do that.
    – M S
    May 3, 2017 at 19:09
2

Maybe this could be useful

\documentclass[journal,compsoc]{IEEEtran}
\usepackage{graphicx}
\newcommand{\mycaption}[1]{\stepcounter{table}\raisebox{-7pt}{\footnotesize Table. \thetable.\hspace{3pt} #1}}
\begin{document}
\title{ABC Study}
\section{RM}
Table. \ref{ts}
\begin{table*}
\centering
    \mycaption{Results of the search process.}
\label{ts}
\renewcommand{\arraystretch}{1.2}
\small
\scalebox{0.65}{
    \begin{tabular}{|p{5cm}|l|p{4.7cm}|p{3cm}|p{3.9cm}|p{3.7cm}|p{3.5cm}|}
        \hline
        Authors with Ref. & Year & Theme & Parameter & Technique & Method Validation & Dimension \\ 
        \hline
        B.~Tansey, E.~Stroulia & 2007 & Estimation of potential business value of evolving SOA applications & effort estimation & COCOMO2 and real options theory & not shown & \\ \hline
        L.~Santillo & 2007 & Discusses the boundary problem from the software measurement and estimation perspective & size estimation & COSMIC functional size measurement for SOA environment & not shown & \\ \hline
        J.~Lee et al. & 2008 & Estimating project plans and service costs of packaged business process applications & cost estimation & Normative and constructive models & not shown & \\ \hline
    \end{tabular}
}
\end{table*}
\end{document}

enter image description here

10
  • @gernot my bad edited it. May 3, 2017 at 14:11
  • Thank You @Raaja G. From the use of your suggested macro, the table caption is placed at the desired position. But, the label defined inside the table is not working properly.
    – M S
    May 3, 2017 at 14:30
  • @SibaMishra What label? May 3, 2017 at 14:32
  • 1
    @SibaMishra "Still showing error" is not helpful, not at all. There are myriads of possible errors, so please give at least the error message and its context.
    – gernot
    May 3, 2017 at 17:56
  • 1
    @SibaMishra In Raaja's code, replace \stepcounter{table} by \refstepcounter{table} and see if it works. It would be better to use the \caption or \captionof command instead of reinventing the command.
    – gernot
    May 3, 2017 at 19:02

You must log in to answer this question.

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