[Tex/LaTex] ragged2e justifying – centering figures

floatshorizontal alignmentragged2e

I am preparing a beamer presentation and I used the ragged2e package to justify the text in my slides (I justified the itemize environment). However, this does not allow me anymore to center a figure. Any way to fix this?

\documentclass[10.5pt]{beamer}
\usepackage{beamerthemesplit}
\usetheme{Copenhagen}
\setbeamercovered{transparent}
\usepackage{ragged2e}
\let\olditem=\item%
\renewcommand{\item}{\olditem \justifying}
\begin{document}
\begin{frame} 
\begin{itemize}
\item blablabla
\begin{center}
\begin{figure}
\includegraphics{.jpg} 
\end{figure}   
\end{center}         
\end{itemize}
\end{frame}
\end{document}

Best Answer

Use \centering inside the figure environment.

\documentclass[10.5pt]{beamer}
\usepackage{beamerthemesplit}
\usetheme{Copenhagen}
\setbeamercovered{transparent}
\usepackage{ragged2e}
\let\olditem=\item%
\renewcommand{\item}{\olditem \justifying}
\begin{document}
\begin{frame}
\begin{itemize}
\item blablabla
\begin{figure}
\centering
\includegraphics[width=2cm]{example-image}
\end{figure}
\end{itemize}
\end{frame}
\end{document}

enter image description here

Related Question