2

I am preparing a beamer presentation and I am having problems in combining justification and centering. I use mainly itemize and enumerate in my slides, and I want to have the text justified in all my slides, thus I have renewed the command \item. Now, I need to add a table (tabular) in my slide (the same applies also to figures) and I want it to be centered. The standard environment center does not work and thus I need to use something like \centering to obtain the result I am looking for. This however is quite annoying, since in a set of slides I might have many tables (and figures). Is there any way to fix this centering issue automatically from the preamble?

My code follows:

\documentclass[11pt]{beamer}
\usepackage{beamerthemesplit}
\usetheme{Copenhagen}
\usepackage{ragged2e}
\setbeamercovered{transparent}
\newcommand*\oldmacro{}%
\let\oldmacro\insertshorttitle%
\renewcommand*\insertshorttitle{%
\oldmacro\hfill%
\insertframenumber\,/\,\inserttotalframenumber}
\let\olditem=\item%
\renewcommand{\item}{\olditem \justifying}
\makeatletter
\renewcommand{\maketag@@@}[1]{\hbox{\m@th\normalsize\normalfont#1}}%
\makeatother
\begin{document}
\section{Bla bla bla}
\begin{frame}
\begin{itemize}
\item bla bla bla
\begin{center}
\centering
  \begin{tabular}{|c|c|}
   \hline
   1 & 2 \\
   \hline
   a & b \\
   c & d \\
   \hline
 \end{tabular}
\end{center}
\end{itemize}
\end{frame}
\end{document}

The following is what I am trying to obtain without having to insert all the time the \centering command:

enter image description here

3

The use of ragged2e's \justifying is the cause of the problem. One could just add \centering to the start of the center environment via the following preamble addition:

\makeatletter
\g@addto@macro\center\centering
\makeatother

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.