I am doing which should be a simple task, but I cannot fathom why it does not work…
I just want a simple caption of a figure I centered, aligned to the left of the figure, right down its lower left corner.
This is my MWE:
\documentclass{beamer}
\mode<presentation> {
\usepackage[labelformat=empty,
font=scriptsize,
skip=0pt,
justification=justified,
singlelinecheck=false]{caption}
}
\begin{document}
\begin{frame}
\begin{center}
\includegraphics[width=.5\linewidth]{example-image}
\captionof{figure}{my caption here}
\end{center}
\end{frame}
\end{document}
Which produces:
How can I have the caption right below the bottom left corner of my image? And why does the code above not work?
Please note the solution should also work within a \figure environment to add captions to tikzpictures…
Thanks!
EDIT:
I TRIED justification=justified,singlelinecheck=false AS SUGGESTED HERE, BUT STILL NO SUCCESS…
\documentclass{beamer}
\usepackage[labelformat=empty,font=scriptsize,skip=0pt,
justification=raggedright,singlelinecheck=false]{caption}
\begin{document}
\begin{frame}
\begin{center}
\includegraphics[width=.5\linewidth]{example-image}
\captionof{figure}{my caption here}
\end{center}
\end{frame}
\end{document}
Best Answer
You can use package
threeparttable
to restrict the caption width to the width of the image:Usually you do not need explicit
center
or\centering
, becausebeamer
centers the figure by default (see the result in the image above). Instead, if you want left aligned or right aligned figures you have to add\raggedright
or\raggedleft
just after\begin{figure}
. Nevertheless, you can activate the commented\centering
.