# subfig package displays “figure” below caption

I've included the subfig package in my latex document. The word "figure" is appearing below the main caption in each figure (even those not using subfloats). Has anyone had the same problem?

\documentclass[
final,
reprint,
notitlepage,
narroweqnarray,
inline,
twoside
]{ieee}

\newcommand{\latexiie}{\LaTeX2{\Large$_\varepsilon$}}

\usepackage{epstopdf}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

\begin{figure}
\centering
\subfloat[one]{\label{fig:one}\includegraphics[width=.4\textwidth]{figures/one.png}}
\subfloat[two]{\label{fig:two}\includegraphics[width=.4\textwidth]{figures/two.png}}
\caption{some text}
\end{figure}

\end{document}


In the output document:

Fig 1. Some text

figure

I want to get rid of that last "figure"

UPDATE:

\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{a caption not displaying OK}
\begin{tabular}{|c|p{2.5cm}|p{2.5cm}|}
\hline
&Average distance (km) & Total distance (km)\\ \hline
set 1&5.137&102.749\\
set 2&1.602&32.058\\
\hline
\end{tabular}
\label{distances}
\end{table}

-
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  yo' Mar 21 '12 at 15:10

The captions are already defined by the ieee.cls. Hence the captions can not be defined by the subfig package. You should use caption=false as the option for subfig package.

\documentclass[
final,
reprint,
notitlepage,
narroweqnarray,
inline,
twoside
]{ieee}
\newcommand{\latexiie}{\LaTeX2{\Large$_\varepsilon$}}
%-----------------------------------------
\usepackage{epstopdf}
\usepackage[caption=false]{subfig} % <---------------------changed here
\setlength{\captionwidth}{\columnwidth} %<-----------------Add this to correct table captions
%-----------------------------------------
\begin{document}
\begin{figure}
\centering
\subfloat[one]{\label{fig:one}\includegraphics[width=.4\textwidth]{figures/one.png}}
\hfill
\subfloat[two]{\label{fig:two}\includegraphics[width=.4\textwidth]{figures/two.png}}
\caption{some text representing the caption of the current figure properly}
\end{figure}
%--------------------------------------
\begin{table}[!t]
\centering
\renewcommand{\arraystretch}{1.3}
\caption{a caption displaying OK}
\begin{tabular}{|c|p{2.5cm}|p{2.5cm}|}
\hline
&Average distance (km) & Total distance (km)\\ \hline
set 1&5.137&102.749\\
set 2&1.602&32.058\\
\hline
\end{tabular}
\label{tab:distances}
\end{table}
%--------------------------------------
\end{document}


Edit: The ieee.cls provides a length \captionwidth. You can define it to be column width like \setlength{\captionwidth}{\columnwidth} so that table captions are fixed. I have modified the above code accordingly.

-
Thank you! that solved the problem. However, a table table I am using is not displaying right. I am modifying the example to include my table –  cevel Mar 22 '12 at 8:36
@csr I fixed this problem also. see my edited answer. –  Harish Kumar Mar 22 '12 at 9:03
excellent! the caption is displaying well now. Thank you. –  cevel Mar 22 '12 at 12:29