TransWikia.com

How to align caption to the left of a figure?

TeX - LaTeX Asked by Royal on March 2, 2021

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}

2 Answers

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

Answered by Bernard on March 2, 2021

As suggested in this answer on the LaTeX Community forum (LaTeX.org), it's quite easy to achieve the left alignment by loading the package caption with the options singlelinecheck=false and justification=justified:

usepackage[singlelinecheck=false,justification=justified]{caption}

If you're interested in the details, you can read more about this in the caption package documentation in Sections 2.2 (pp. 9-10).

Answered by Johannes Reimer on March 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP