I have learned that for labels and their respective references to compile and display correctly (for figures), it is necessary to have the \label{} after \caption{}, such as below:
Figure \ref{k2a}
\begin{figure}[h]
% \caption{Isothermal thick film.}
\begin{center}
\centering
\includegraphics[width= \columnwidth]{/home/userid/Research/Dissertation/2D/Periodic/k2a}
\caption{When $\lambda = \lambda_{max}$ and M=35.1, Pr=7.20, S=100, G=1/3, rupture takes place at t=1280.0 (within 1\% or\citet{Krishnamoorthy1995a})}
\label{k2a}
\end{center}
\end{figure}
However, are there any .sty / package dependencies that are not allowing my labels to compile right? I run latex twice but I receive a bunch of warnings such as Reference on page abc undefined on input line xxx. and I get the dreaded ? where the reference should be. The link to the figure through the question mark works though.
Here is my preamble, where I load all my packages. This occurs in a separate file.
does \usepackage{caption} have anything to do with this issue?
\usepackage{graphicx}
%\usepackage{float}
\usepackage[section]{placeins}
\usepackage{caption}
\captionsetup{margin=10pt,font=small,labelsep=period,labelfont=bf}
% --------
\usepackage{lscape} % allows for landscape tables and figures
\usepackage{paralist} % enancements to list environment
\usepackage{array} % enhancements to array and tabular environments
\usepackage[usenames]{color}
\usepackage{url}
\usepackage{longtable} % multipage tables
\usepackage{ifthen}
\usepackage{ifpdf}
\usepackage{setspace} % easy single or doublespacing
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{rotate}
\usepackage{subfigure}
\usepackage{subfig}
\usepackage{wrapfig}
\usepackage{listings} % for listing computer code such as matlab
\usepackage[bw]{mcode} % for matlab code with listings package
\usepackage[square,comma,sort&compress]{natbib} % enhances bibtex citations
% \usepackage{biblatex}
\usepackage{setspace} % \singlespacing, \onehalfspacing, \doublespacing, ...
%%%%%%%%xyz%%%%%%%%%%%%%%%
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage{textcomp}
\usepackage{multirow}
%\usepackage{subfig}
\usepackage{paralist}
\usepackage{changepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%11022012-START%%%%%%%%%%%%%%
\usepackage[T1]{fontenc} %Useful for file names with underscores in them
\usepackage{float}
\usepackage{grffile}
\newcommand{\hilight}[1]{\colorbox{yellow}{#1}} %To highlight text
\renewcommand{\thefootnote}{\alph{footnote}} %For footnotes
%%%%%%%%%%11022012-STOP%%%%%%%%%%%%%%
\labelinside\captionlike this:\caption{When $\lambda = \lambda_{max}$ and M=35.1, Pr=7.20, S=100, G=1/3, rupture takes place at t=1280.0 (within 1\% or\citet{Krishnamoorthy1995a}).\label{k2a}}. Notice that some of the packages are deprecated:epsfig(graphicxis enough),color(usexcolor). As well, I'm not sure whether the packagessubfigandsibfigureare not clashing each other. – yo' Dec 06 '12 at 13:20subfigandsubfigureintereference... On a side note, would you know how I could label each figure in a minipage... or in a subfigure? – dearN Dec 06 '12 at 13:22.auxfile looks after two compilations. – yo' Dec 06 '12 at 13:51[h]always use at least[htp]if you want to give latex a chance to avoid taking the float to the end of the document. – David Carlisle Dec 06 '12 at 14:21\usepackage{caption}. However now I have issues with the\label{}in my\minipage{}environments. – dearN Dec 06 '12 at 14:51\usepackage{caption}and things work fine. However I have a completely different issue with\minipagewhich I think I need to look around online before posting here. – dearN Dec 06 '12 at 15:03minipageand floats obviously cannot go along each other well. You never ever place a float inside a minipage. If you want a[h]ere-placed float inside minipage, make it non-float and use the command\captionof. – yo' Dec 06 '12 at 15:06\captionofcommand without\usepackage{caption}? And then use a\label{}inside\captionof{}?? – dearN Dec 06 '12 at 15:08matlab-prettifierpackage; see this answer. – jub0bs Apr 28 '14 at 15:54