# using subfig (side-by-side) figures

I used the package subfig for my first time, I got this error: ! LaTeX Error: File figures/Rnefft1310' not found. ! LaTeX Error: Filefigures/imt1310' not found. However, I am sure the file is there as eps. What is wrong?

Am I using the wrong code for subfig? here is what I wrote:

\begin{figure}
\centering
\subfloat[]{\includegraphics[width=3.1in]{figures/Rnefft1310}}
\subfloat[]{\includegraphics[width=3.1in]{figures/imt1310}}
\caption{Real and imaginary part of effective index }
\label{fig:EcUND}
\end{figure}

• Are you saying you can load the figures OK outside of subfloat? The syntax looks OK to me. Have you checked your graphics path is defined properly? Have you got package epstopdf loaded? Otherwise, can you provide a complete MWE please as it would help a lot to help you! – FionaSmith Jun 9 '14 at 21:33
• How you compiled your file? With pdf(La)TeX? It require figures in jpg, png or pdf. – Zarko Jun 9 '14 at 21:34
• Hi: I just tried each figure separately and I am able to compile and see my figure. However, when I try to do the two figures as subplots using the first code I typed above, I have error saying the files are not found!!! – Naema Jun 10 '14 at 3:33
• File "figures/Rnefft1310 not found". File"figures/imt1310" not found". Any help, please? I am stuck. I loaded the package subfig from CTAN. And, I used \usepackage{subfig} in my main thesis file. – Naema Jun 10 '14 at 3:47

This is not really an answer - I don't know what the problem you are having is! It is really hard to help with this sort of thing! It's very strange that you can plot them when not in the subfloat - it implies there is no package missing for rendering graphics generally.

I thought it might be useful for me to send you some code that works for me so you can see if there is a difference in what you are doing or how you are loading the packages. Obviously replace my .eps files with your own!

If this doesn't point you in the right direction, please change your question to include a minimal working example - i.e. something that can be compiled by someone else, as it may help someone to spot some incompatibility somewhere in your preamble.

\documentclass{report}

\usepackage{graphicx}      % needed for including graphics
\usepackage{epstopdf}
\usepackage{grffile}
\graphicspath{{figures/}}
\usepackage{caption, subfig}

\makeatletter
\makeatother

\begin{document}

\begin{figure}

\subfloat[Watervapour]{\label{fig:opt_nmc_q}\includegraphics[clip=true,  width=0.4\textwidth, height=0.3\textheight]{figures/AoptBandB_q_RTTOV10_MoistCovVNMC_F_TH_NEW.eps}}

\caption{Some figures}
\label{fig:opt_nmc_bc}

\end{figure}

\end{document}

• thanks, I used your code, it gave me the same error along with another error. – Naema Jun 10 '14 at 14:11
• the second error was (! LaTeX Error: Cannot determine size of graphic in figures/imt1310.eps (no Boun dingBox).) I had this error for each figure of the two subplots. – Naema Jun 10 '14 at 14:12
• @Naema In which case I think we need significantly more information! If my code doesn't work for you, there must be something to do with the compilation procedure. I am using MikTex2.9 and TeXnicCenter1.0 under windows, and compiling with pdflatex. What about you? – FionaSmith Jun 10 '14 at 16:04
• I am using miktex 2.9 and texmaker and compile with quickbuild with view pdf. I also tried pdflatex and it is still the same error!. – Naema Jun 10 '14 at 16:08
• I solved it!. I removed the command figures/ and it works. this is what I copied \begin{figure} \subfloat[Temperature]{\label{fig:opt_nmc_t}\includegraphics[clip=true, width=0.4\textwidth, height=0.3\textheight]{Rnefft1310.eps}} \quad \subfloat[Watervapour]{\label{fig:opt_nmc_q}\includegraphics[clip=true, width=0.4\textwidth, height=0.3\textheight]{imt1310.eps}} \caption{Some figures} \label{fig:opt_nmc_bc} \end{figure} – Naema Jun 10 '14 at 16:16