4

I have several tabulars side-by-side using the subcaption package in beamer:

enter image description here

However, as you can see, they are not quite centered.

How can I center the tabulars, so that tabular RAID5 isn't on the very right and RAID0 hasn't too much space on the left side?

This is my current code:

\documentclass{beamer}
\usepackage{subcaption}

\begin{document}
% ...
\frame{\frametitle{RAID-Types}
\begin{table}[!htb]
  \subcaptionbox{RAID0}[.25\linewidth]{%
        \begin{tabular}{|c|c|c|}
        \hline
        0&1&2\\
        \hline
        3&4&5\\
        \hline
        6&7&8\\
        \hline
        \end{tabular}}%
  \subcaptionbox{RAID1}[.25\linewidth]{%
        \begin{tabular}{|c|c|c|}
        \hline
        0&0&0\\
        \hline
        1&1&1\\
        \hline
        2&2&2\\
        \hline
        \end{tabular}}%
  \subcaptionbox{RAID5}[.25\linewidth]{%
        \begin{tabular}{|c|c|c|}
        \hline
        0&1&P(0+1)\\
        \hline
        2&P(2+3)&3\\
        \hline
        P(4+5)&4&5\\
        \hline
        \end{tabular}}%
  \caption{RAID-Types. Each column represents one disk. Each row is a block level.}
\end{table}
}

1 Answer 1

1

As I mentioned in my answer to Subcaption with Beamer, it's better not to use caption/subcaption with beamer; you can use subfig, with the caption=false option, instead:

\documentclass{beamer}
\usepackage[caption=false]{subfig}

\begin{document}

\begin{frame}
\frametitle{RAID-Types}
\begin{table}
  \subfloat[RAID0]{%
        \begin{tabular}{|c|c|c|}
        \hline
        0&1&2\\
        \hline
        3&4&5\\
        \hline
        6&7&8\\
        \hline
        \end{tabular}}\qquad%
  \subfloat[RAID1]{%
        \begin{tabular}{|c|c|c|}
        \hline
        0&0&0\\
        \hline
        1&1&1\\
        \hline
        2&2&2\\
        \hline
        \end{tabular}}\qquad%
  \subfloat[RAID5]{%
        \begin{tabular}{|c|c|c|}
        \hline
        0&1&P(0+1)\\
        \hline
        2&P(2+3)&3\\
        \hline
        P(4+5)&4&5\\
        \hline
        \end{tabular}}%
  \caption{RAID-Types. Each column represents one disk. Each row is a block level.}
\end{table}
\end{frame}

\end{document}

enter image description here

1
  • Thanks, that works better :). How can I add a newline/new row of floats, without destroying the first row? E.g. If I add another subfloat called RAID4, then the first row contains RAID0 and RAID1 only and RAID5 goes to row2. I want to keep the structure of row1, however. EDIT: I got it. Adding \bigskip and newlines after the first three floats.
    – polym
    Aug 5, 2014 at 17:59

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.