add figure to overleaf code example
Example 1: how to add image overleaf
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\title{A project with images}
\author{Overleaf}
\date{}
\begin{document}
\maketitle
\section{Introduction}
\begin{figure}[htp]
\centering
\includegraphics[width=4cm]{InsertingImagesEx5}
\caption{An image of a galaxy}
\label{fig:galaxy}
\end{figure}
\end{document}
Example 2: insert figure latex
%...
\begin{figure}[h!]
\centering
\begin{subfigure}[b]{0.2\linewidth}
\includegraphics[width=\linewidth]{coffee.jpg}
\caption{Coffee.}
\end{subfigure}
\begin{subfigure}[b]{0.2\linewidth}
\includegraphics[width=\linewidth]{coffee.jpg}
\caption{More coffee.}
\end{subfigure}
\begin{subfigure}[b]{0.2\linewidth}
\includegraphics[width=\linewidth]{coffee.jpg}
\caption{Tasty coffee.}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\includegraphics[width=\linewidth]{coffee.jpg}
\caption{Too much coffee.}
\end{subfigure}
\caption{The same cup of coffee. Multiple times.}
\label{fig:coffee3}
\end{figure}
%...