[Tex/LaTex] How to align caption to the left of a figure

captionsfloats

I am using this command, but it centers the figure caption. How can I left-align this? Please help me.

\documentclass[conference]{IEEEtran}
\usepackage{authblk}

\begin{document}

\begin{figure}[!h]
\centering
\includegraphics[scale=0.28]{fig1}
\caption{Generation of Digital Signature}
\label{fig_sim}
\end{figure}

\end{document}

Best Answer

You can load the caption package and choose the option singlelinecheck=off, and the measuredfigure environment from threeparttable:

\documentclass[conference]{IEEEtran}
\usepackage[utf8]{inputenc} %
\usepackage{graphicx, caption} %
\usepackage{threeparttable}%
\usepackage{lipsum}

\begin{document}

\lipsum[1]
\begin{figure}[!htb]
  \captionsetup{singlelinecheck = false, format= hang, justification=raggedright, font=footnotesize, labelsep=space}
  \centering
  \begin{measuredfigure} % \begin{measuredfigure}
    \includegraphics{Pepe-le-Pew2}
    \caption{Chuck Jones – Pepe Le Pew in action}
  \end{measuredfigure}
  \label{PlP}
\end{figure}
\lipsum[2]

\end{document} 

enter image description here

Related Question