0

I am having trouble with the subfigures in one main figure. I am using the following preamble and coding for the figures:

\documentclass[11pt]{report}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{acronym}
\usepackage{times}
\usepackage{amssymb}
\usepackage{mathrsfs}
\usepackage{latexsym}
\usepackage[none]{hyphenat} % no word break
\usepackage{wrapfig}
\usepackage[font={footnotesize,it}]{caption}
\usepackage{url}
\usepackage{titling}
\usepackage{textcomp}
\renewcommand{\thechapter}{\Roman{chapter}}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{graphics, float}
\usepackage{caption}
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf} %graphics in .eps format
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{microtype}
\usepackage{subfigure}
\usepackage{subfig}
\usepackage[english]{babel}\addto\captionsenglish
{\renewcommand{\bibname}{References}}
\usepackage[backend=bibtex,style=numeric, sorting=none]{biblatex}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage{csquotes} %Package biblatex Warning: 'babel/polyglossia' detected but 'csquotes' missing.
\usepackage{listings}
\usepackage{babel,blindtext}
%\usepackage[T1]{fontenc} 
\geometry{a4paper} % ... or letter or a4paper or a5paper or ...            %\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}
\hypersetup{colorlinks,
        citecolor=black,
        filecolor=black,
        linkcolor=black,
        urlcolor=blue }
\setlength{\textwidth}{420pt}
\oddsidemargin = 0.5cm
\def \m{$\mu$} 
\def \g{$\gamma$}
\def \b{$\beta^-$}
\def \a{$\alpha$}
\newcommand{\unicode}[1]{{}}
\def \PCL{$\text{PCL}_\text{13000}$-$\text{PEO}_\text{5000}$}
\def \PEO{$\text{PCL}_\text{1100}$-$\text{PEO}_\text{550}$}

   \begin{figure}
    \begin{subfigure}{0.36\textwidth}
            \includegraphics[scale=0.72]{PolymersomePCLPEO.JPEG}
            \caption{PEO-PCL}
            \label{fig:PCLPEO1}
    \end{subfigure}        
    \begin{subfigure}{0.34\textwidth}
            \includegraphics[scale=0.4]{PEO.JPEG}
            \caption{PEO}
            \label{fig:PEO1}        
    \end{subfigure}       
    \begin{subfigure}{0.32\textwidth}
            \includegraphics[scale=0.82]{PCL.JPEG}
            \caption{PCL}
            \label{fig:PCL1}       
    \end{subfigure}
    \caption{In figure a, the chemical structure of block copolymer PCL-PEO can be viewed. In figure b and c, the chemical structures of respectively polymer PEO and PCl can be viewed.}\label{fig:PCLPEO2}

\end{figure}

It now looks like this: enter image description here

I would like them to be horizontally next to each other with some spacing in between, but I cannot figure this out..

1

Try removing any imports of the subfigure and subfig packages; the former is deprecated, and the latter certainly should not be used at the same time as the former. Replacing them with the subcaption package should accomplish what you want (see, for example, here).

Indeed, I don't think the subfigure package will accept the arguments you're passing to it, which accounts for those little ‘0.3’s and ‘b’s floating around your diagrams.

  • I changed the packages into the subcaption package. It looks better now, but I am still not satisfied with the result. Do you know how I can get the images all horizontally to each other with some spacing in between? – W. v. Ekeren Feb 24 '15 at 10:03
  • The widths you've specified in your example seem to add up to more than \textwidth. Is the problem solved if you decrease them all to 0.25\textwidth, for example? – Stephen Morgan Feb 24 '15 at 10:08
  • Yes, I know I actually cannot use these widths, but it looked better then for example using 0.25\textwidth. When Iam using these widths u are putting forward the figures will overlap.. I did use minipages before, but I it is not working for subfigures right? – W. v. Ekeren Feb 24 '15 at 10:12
  • I'm not clear on the problem you're having then. What is it that you're not satisfied with? Is it just that the diagrams are too large and so you cannot fit them onto one line without them overlapping, or is there something else? I'm not sure about the interactions of minipages with subfigures, but I've used them with the subequations environment before without any problem. – Stephen Morgan Feb 24 '15 at 10:15
  • The problem was that the figures did not have the same dimensions, so I just had to vary the widths a little bit. It worked now! Thanks for your tip of using the subcaption package, because that actually was the trick! :) – W. v. Ekeren Feb 24 '15 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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