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.
2 Answers
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.
-
1You could spare one
\renewcommand{\figurename}{\tablename}
by using it before\caption
in thefigure
environment -- it won't leak outside then! As you noticed already: The counter is still the wrong one!– user31729Jun 26, 2016 at 6:01
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}
\begin{table} \caption{This is my table} \includegraphics{pictureoftable} \end{table}
Figure 2: Figure caption
toMyFigure 2: Figure caption
?table
environment can contain anything, for instance\includegraphics
. There's no law imposing that\includegraphics
has to be inside afigure
environment.