1

I’m using the caption package, to name tables in beamer. \caption{Name} automatically provides Table: Name output. I would like to change the word “Table” to a custom caption, but also to be able to have a different caption for different tables. E.g.:

\documentclass[pdf,xcolor=table]{beamer}
\setbeamercovered{highly dynamic}
\usepackage{caption}
\mode<presentation>{}
\begin{document}
\begin{frame}
\begin{table}[]
  \centering
  \caption{Name 1.}
  \begin{tabular}{|l|l|}
  \hline
   &  \\ \hline
   &  \\ \hline
  \end{tabular}
  \end{table}

\begin{table}[]
  \centering
  \caption{Name 2.}
  \begin{tabular}{|l|l|}
  \hline
  &  \\ \hline
  \end{tabular}
\end{table}

\end{frame}
\end{document}

Above the first table gets a caption “Table: Name 1.” and the second “Table: Name 2.”. I want to be able to call the first one “Random Caption: Name 1.”, and second “Different Random Caption: Name 2.”. Can I change this caption for different tables independently?

1 Answer 1

4

There is no need to use the caption package for this as you can just redefine \tablename to suit your needs:

enter image description here

\documentclass{beamer}

\begin{document}

\begin{frame}

  \begin{table}
    \centering
    \renewcommand{\tablename}{Random Caption}
    \caption{Name 1.}
  \end{table}

  \begin{table}
    \centering
    \renewcommand{\tablename}{Different Random Caption}
    \caption{Name 2.}
  \end{table}

\end{frame}

\end{document}

The redefinition is localized to the table environment, like with all scoping within the \begin ... \end group.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .