[Tex/LaTex] raggedright caption option not working in beamer

beamercaptions

I'm trying to right-align one my captions in beamer. For that I use the caption package:

\documentclass{beamer}

\usepackage{caption}
\usepackage{mwe}

\begin{document}
\begin{frame}
\begin{columns}
\column{0.4\textwidth}
\captionof{figure}[justification=raggedleft,singlelinecheck=off]%
     {This is a long caption just to reach the second line}
\column{0.6\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\end{columns}
\end{frame}
\end{document}

However, this is not working and I wonder if this is due to beameror if I'm doing something wrong. This is what it looks like:

enter image description here

Best Answer

You need to load the caption package with compatibility=false and to use \captionsetup to specify your options, otherwise they will not have any effect.

\documentclass{beamer}

\usepackage[compatibility=false]{caption}
\usepackage{mwe}

\begin{document}
\begin{frame}
\begin{columns}
\column{0.4\textwidth}
\captionsetup{singlelinecheck=off,justification=raggedleft}
\captionof{figure}{This is a long caption just to reach the second line}
\column{0.6\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\end{columns}
\end{frame}
\end{document}

enter image description here