[Tex/LaTex] How to put figure caption on top?


I have a table that I have inserted as a figure in LateX because it was externally created. I would like to have the caption on top, but it is not working. Any suggestions?

\topcaption{\textbf{{Table 1}}
\includegraphics[origin=c, scale=0.74]{table1}

Best Answer

A common misunderstanding by many beginners to LaTeX is that a tabular like environment can only be in a table environment and a graphics/diagram etc. must be contained in a figure environment.

However, LaTeX does not really care about the fact that the table might be included as an image 'only'. As long as the graphics format is the 'table' can be included as an image of course too.

The only relevance that is needed is the \caption which must appear inside the floating environment.

If the floating is not desired (or not possible), the \captionof{floattype}{your caption title} can be used instead -- this requires the very sophisticated caption package, however!

Either way the caption appears at the top if it is placed before the \includegraphics command -- no need to use weird \newline calls.



\caption{Foo caption} \label{foo}

Or using a \verb!\captionof! - command:

\captionof{table}{Foobar caption} \label{foobar}

There are two nice figures: \ref{foo} and \ref{foobar}

enter image description here