1

I would like to change the caption of Figure for Table, just on a particular case, which is when such a figure is a table. The last thing is about the position of the caption and its numbering. I want to put it on the top centered, saying something like "Table 2. XXX". I don't really need to worry about having later a list of tables or figures, just to let you know.

5
  • This is the same question answered. Jun 26, 2016 at 3:53
  • But the link provides a way to change the caption for all figures, and I don't want it. I want to change it, in some parts of the article. Jun 26, 2016 at 4:03
  • 1
    Well, you can revert back to "Figure" with the same method. Why don't you just call your image a table though? You can put graphics inside a table environment. \begin{table} \caption{This is my table} \includegraphics{pictureoftable} \end{table} Jun 26, 2016 at 4:23
  • What do you want to change the labelling to? Figure 2: Figure caption to MyFigure 2: Figure caption?
    – Werner
    Jun 26, 2016 at 6:31
  • A table environment can contain anything, for instance \includegraphics. There's no law imposing that \includegraphics has to be inside a figure environment.
    – egreg
    Jun 26, 2016 at 15:24

2 Answers 2

3

You should provide an MWE in the future for the quickest help. The (at least) two ways of doing what you want, sort of:

\documentclass{article}
\begin{document}

% what you are asking to do (rename "Figure" in caption to "Table"):
\renewcommand{\figurename}{Table}

\begin{figure}
  \caption{This is my table}
  <picture of table>
\end{figure}
% The problem with this though, is that the number (e.g. "Table #: ...") will be
% counted as a figure still, so you really shouldn't do it this way.

% anyhow, to revert back to the usual "Figure" nomenclature:
\renewcommand{\figurename}{Figure}

% But, actually, you should just call it a table:
\begin{table}
  \caption{This is my table}
  <picture of table>
\end{table}

\end{document}

Note the problem with the incorrect "table" number you'd get (well, it's technically correct because the number would be the count of figure environments, which you'd still be doing even if you rename the caption).

You should just place your image inside a table environment, as I show at the bottom of the example.

1
  • 1
    You could spare one \renewcommand{\figurename}{\tablename} by using it before \caption in the figure environment -- it won't leak outside then! As you noticed already: The counter is still the wrong one!
    – user31729
    Jun 26, 2016 at 6:01
2

Using a table environment is easier, actually -- if the screenshot is made with high quality, nobody will notice that the 'table' is a figure actually, especially in printing!

If somebody insists on a figure environment, one has to change the \@captype from figure to table inside of the figure environment with \def or \renewcommand. This way, the change is restricted to the group formed by the environment and does not leak outside.

\caption uses the same name for the counter as \@captype and looks for something like \csname \@captype name\endcsname to enter the name!

The only thing to worry still about this: You have to use a \makeatletter...\makeatother pair!

\documentclass{article}

\usepackage[demo]{graphicx}



\begin{document}
\tableofcontents
\listoftables
\clearpage
\section{A section with a 'figure'}

\makeatletter
\begin{figure}
  \renewcommand{\@captype}{table}
  \includegraphics[scale=0.3]{ente}
  \caption{A nice 'table'}
\end{figure}
\makeatother


\end{document}

enter image description here

You must log in to answer this question.

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