[Tex/LaTex] How to include images and figures in elsarticle document class

elsarticlegraphics

I used elsarticle document class

\documentclass[preprint,11pt,3p,authoryear]{elsarticle}

I try to include image inside. The document is running with out any error put the image was not appear. I used the following:

\documentclass[preprint,11pt,3p,authoryear]{elsarticle}
\usepackage{amsmath}
\numberwithin{equation}{section}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{natbib}
\usepackage{graphicx} 
\usepackage{subfig}
\usepackage{subcaption}

\begin{document}

\begin{frontmatter}

\title{Title}\author[label1,label2]{Author1\fnref{label3}\corref{cor1}}

\address[label1]{ Address1}
\address[label2]{Address2}
\address[label3]{Address3}
\cortext[cor1]{Corresponding author}
\author[label1]{Author\fnref{label2}}
\author[label2]{Author3}
\author[label2]{Author4}

\begin{abstract}
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text.
\end{abstract}

\begin{keyword}
  keyword1
  keyword2 
  keyword3
  keyword4
  keyword5
\end{keyword}
\end{frontmatter}

\begin{multicols}{2}

%% main text
\section{Introduction}
\label{sec1}

Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. 

\begin{figure}[!ht]
\centering

\begin{subfigure}[b]{0.49\columnwidth}
    \includegraphics[width=columnwidth]{image1}
    \caption{ image 1}
    \label{fig1.1.a}
\end{subfigure}

\begin{subfigure}[b]{0.49\columnwidth}
    \centering
    \includegraphics[width=columnwidth]{image2}
    \caption{image 2}
    \label{fig1.1.b}
\end{subfigure}

\caption{image 1 and 2} 
\label{fig1.1}
\end{figure} 
\section{Related work}
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. 

\section{The research problem and contributions of this study}     
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. 
\section{Materials}
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. 

\section{Method}
Sample text. Sample text. Sample text. Sample text. Sample text. Sample text. 

\end{multicols}
\end{document}

My question is: Is there any specific format to include figures inside the elsarticle format document because I use the same example with report format and it was work properly.

\documentclass[12pt,a4paper]{report} 

Note: the images format is PDF format and there are existing I the same folder of the text file.

Best Answer

When you compile the given example, you can see TeX is warning you that something is amiss:

Package multicol Warning: Floats and marginpars not allowed inside `multicols' 
environment!.

Since the figure is a float, you can't use it inside the multicols environment. You could insert your figure as a non-float using the float package and the H option.

With the elsarticle class, however, you should use the twocolumn class option to have a two column layout:

\documentclass[preprint,11pt,3p,authoryear,twocolumn]{elsarticle}

and get rid of the multicol package.