The following is my thesis preamble:

\usepackage{graphicx} % for graphics
%\usepackage[draft]{graphicx} % temporarily turn off graphicx
\usepackage{caption}  % Enable figure captions or figure notes
\usepackage{subcaption} %Further enable sub captions
\usepackage{booktabs} %for table
\usepackage{amsmath} %for equations and mathematical symbols
\usepackage{rotating} %for table rotation
\usepackage{float} % allow tables to self adjust
\usepackage{hyperref} % allow hyper referencing
\usepackage{enumerate} % to get all that enumeration offers
\usepackage[round]{natbib} % for bibliography

%\usepackage[natbibapa]{apacite} % load "apacite" with option "natbibapa" 
%\bibliographystyle{apacite} % specify the bibliography style


%{plainnat} % regular bibliography
\usepackage[usenames, dvipsnames]{color} % coloring fonts
% Tree-saver - if turn this on you lose page numbers
 % Allow 1 in margin on each side and nothing else
 \def\@cite#1#2{{#1\if@tempswa , #2\fi}}



%\usepackage{calc} % To reset the counter in the document after title page




I must use subfigure package for

\setlength{\lineskip}{1ex}% increase spacing
\subfloat[2002:1][![enter image description here][1]][1]{\includegraphics[width=.3\textwidth]{A9}}
\caption{\label{figure12} Dynamic crisis transmission maps from 1998-2003}

But I end up getting errors as follows:

    LaTeX Error: Command \c@subfigure already defined.

Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.113 \newcounter{subfigure}
Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

And some more errors as attached

enter image description here

How can I get rid of these errors?

  • 9
    You load subfig and subcaption, both are incompatible with another. Overall, the template you are using is just bad. Have a look at en.wikibooks.org/wiki/LaTeX/Scientific_Reports
    – Johannes_B
    Commented Apr 1, 2019 at 5:43
  • 2
    Off-topic: in your shown screenshot of overleaf I can see the complete url to reach your project :-( I do not know, I did not try, to open it. Please do not show this url, wipe it out in the image or just do not add it in the screenshot ...
    – Mensch
    Commented Apr 1, 2019 at 7:09
  • 4
    This is unrelated to overleaf, that just happens to be where you are running latex. Commented Apr 1, 2019 at 10:45
  • Thank you so much everyone.
    – Mihan
    Commented Apr 1, 2019 at 11:15
  • 1
    Do only use/call packages you know and you need for your document ...
    – Mensch
    Commented Apr 1, 2019 at 18:59

2 Answers 2


Just use the subcaption package. Instead of \subfloat[]{} use \subcaptionbox{}{}.

The subcaption documentation is exceptionally good; you should read it. https://ctan.org/pkg/subcaption?lang=en

\subcaptionbox{1998:1}{\includegraphics[width=.3\textwidth]{A1}} \\
\subcaptionbox{1998:2}{\includegraphics[width=.3\textwidth]{A2}} \\
\caption{\label{figure12} Dynamic crisis transmission maps from 1998-2003}

I also think it doesn't make sense to use both \centering and all of those \hspace{\fill} commands.

  • Well, I created the comparison in the MWEB, that you can get into with the link, overleaf.com/3391682762fdwvbmrpzhrh and also edit. subcaptionbox did not make things better. Please have a look and tell me or make change
    – Mihan
    Commented Apr 1, 2019 at 19:00
  • You have to remove \usepackage{subfig} and \usepackage{subfigmat}. See @Kurt's answer for an excellent solution.
    – jaspast
    Commented Apr 2, 2019 at 14:21

To solve your issue and to get a minimal working example you can delete most of your commands in your preamble.

For me it seems you simply copied parts of other tex files in the internet and/or collegues without knowing what the copied tex code does. That is the badest way to tex ...

General rule: Do only use code you understand. Do only use package you had read the documentation (type texdoc subcaption to get the documentation of package subcaption displayed)!

Now please have a look to the following mwe:



\usepackage[showframe]{geometry} % <====================================

\usepackage{graphicx} % for graphics
\usepackage{caption}  % Enable figure captions or figure notes
\usepackage{subcaption} %Further enable sub captions <==================

\usepackage{hyperref} % allow hyper referencing




%\setlength{\lineskip}{1ex}% increase spacing




\caption{\label{figure12} Dynamic crisis transmission maps from 1998-2003}

The blank line after three example-images generates a new line so you get three sub figures aranged in one line.

The result is:

resulting sub figures

Please see that I used option showframe for package geometry to visualize the typing area and margins. To adjust the margins use geometry (texdoc geometry) and do not use the old fashioned commands like \setlength{\textwidth}{8.276in} etc ...

Please see the correct order of calling packages (in most cases hyperref is called last!) ...

You must log in to answer this question.

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