Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a little problem. I am trying to arrange to subfigures side by side (i.e. a graph and its legend) using the IEEE article format and I cannot remove the subcaption.

I was using package subfigure at first but I don't want to have the subcaption underneath the figures (i.e. (a), (b) ).

By searching on the internet, I've found out that package caption could do the job, but seems to have some compatibility issues with the IEEE class file.

Therefore I had to create a table and put the figures in the table. However, now the legend is not centered. Here's the code:

\begin{figure}[!h]
\centering
\begin{tabular}{cc}
 \includegraphics[scale=0.135]{fig_graph} &  \includegraphics[scale=0.115]{Legend} \\
\end{tabular}
\caption{Caption text.}
\label{fig_graph}
\end{figure}

Question:

How is possible to put two figures side by side with no subcaption and without using the caption package (and no graphical editors if possible)?

Using subcaption didn't helped. I forgot to mention that I am using IEEEConf not IEEEtran.

I modified the code as follows:

\begin{figure}[!h]
\centering
\begin{subfigure}
\includegraphics[scale=0.135]{fig_graph}
\phantomcaption{}
\end{subfigure}
\hfill

\begin{subfigure}
\includegraphics[scale=0.115]{Legend}
\phantomcaption{}
\end{subfigure}
\caption{Caption text.}
\label{fig_graph
\end{figure}

And now MikTex 2.9 complains that subcaption and subfigure cannot be used together.

If I remove subfigure, the compiler gets VERY angry on another subfigure I have

Missing number, treated as zero.\letl.214 \label{fig_matrices}}). and a lot more complaining about missing numbers and illegal units like pt (I guess beacuse subfigure is needed)

The packages I am importing are:

\documentclass[letterpaper, 10 pt, conference]{ieeeconf}
\IEEEoverridecommandlockouts
\overrideIEEEmargins

\usepackage{url}
%\usepackage[caption=false]{subfig}
\usepackage[pdftex]{graphicx}
\usepackage{subfigure}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{array}
%\usepackage{subcaption} 
\usepackage{cite}

The error I get if I use caption is:

Command \c@subfigure already defined.

If I use caption by giving:

\usepackage[caption=false]

I get many errors:

Argument of \@fileswith@pti@ns has an extra }.

Paragraph ended before \@fileswith@pti@ns was complete.

Paragraph ended before \reserved@b was complete.

Undefined control sequence. \@fileswith@pti@ns ...served@b \reserved@a ,\@nil,}\fi \reserved@al.37 \usepackage[pdftex]{graphicx}

And a lot more most of them about not finding things or finding things and think that are undefined.

I was kind of aware that people may get just a warning for caption, but what's wrong with this?

Thank you all for your help!

share|improve this question
    
Welcome to TeX.SX! In what sense the caption is not centered? –  egreg Sep 12 '13 at 20:28
    
Hi egreg, thank you for your welcome! :) The second figure (Legend) is not vertically centered with respect to the first figure (fig_graph). The subcaption (i.e. (a) ) should not be there at all –  Occh'i Papara Sep 12 '13 at 22:03
    
There is nothing wrong with a warning, it just says a macro is redefined that's all. subfigure package is old and obsolete. You should never use it for anyway. –  percusse Sep 12 '13 at 22:34
add comment

2 Answers 2

You don't need caption or subcaption, if you don't want any special label for the graphics.

\documentclass[final]{IEEEtran}
\usepackage{kantlipsum} %<- For dummy text
\usepackage{mwe} %<- For dummy images

\title{The research}
\author{The researcher}

\begin{document}
\maketitle
\begin{abstract}
\kant[1]
\end{abstract}

\kant[1-4]

\begin{figure}
\centering
\raisebox{-.5\height}{%
  \includegraphics[height=4cm,width=3cm]{example-image-a}%
}\qquad
\raisebox{-.5\height}{%
  \includegraphics[height=2cm,width=3cm]{example-image-b}%
}
\caption{The proper caption}
\label{figab}
\end{figure}
\end{document}

I imposed height and width to the images in order to emulate your real situation, where the two pictures have different heights.

With \raisebox{-.5\height} we shift vertically the reference point (usually at the bottom) for each picture, so they come out automatically center aligned. With \qquad I add some separation; leave it out (changing it into a %) if you don't want any space.

enter image description here

share|improve this answer
    
@Occh'iPapara I fixed my code (there still was the unused subcaption package); it works unchanged for IEEEconf, only the output is different. –  egreg Sep 12 '13 at 22:29
add comment

I don't know why you think there is a compatibility issue. There is a certain redefinition of commands but the result is not incompatible. You just get a warning. So you can use \phantomcaption command. Also you need to train it a little. I typically use the following settings

\documentclass[final]{IEEEtran}%
\usepackage{subcaption}
\usepackage{kantlipsum} %<- For dummy text
\usepackage{mwe} %<- For dummy images

% Remove the trailing whitespace from citations
\usepackage[noadjust]{cite}

% Training subcaption package to comply with
% IEEE standards. We can ignore the warning
% generated by caption.sty which is due to 
% the redefinition of \@makecaption
\DeclareCaptionLabelSeparator{periodspace}{.\quad}
\captionsetup{font=footnotesize,labelsep=periodspace,singlelinecheck=false}
\captionsetup[sub]{font=footnotesize,singlelinecheck=true}

\title{The research}
\author{The researcher}

\begin{document}
\maketitle
\begin{abstract}
\kant[1]
\end{abstract}

\kant[1-4]

\begin{figure}%
\centering
\begin{subfigure}{.4\columnwidth}
\includegraphics[width=\columnwidth]{example-image-a}%
\phantomcaption{}%
\label{subfiga}%
\end{subfigure}\hfill%
\begin{subfigure}{.4\columnwidth}
\includegraphics[width=\columnwidth]{example-image-b}%
\phantomcaption{}%
\label{subfigb}%
\end{subfigure}
\caption{The proper caption}
\label{figab}
\end{figure}
\end{document}

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.