# same float in multiple places pdflatex [duplicate]

Possible Duplicate:
How to recall a figure without rewriting it

I have some floats (tables) that i would like to use in several spots in the document.

For this use a normal reference is not enough since i want the actual float to appear in both places. is there a way to call the float and have latex reproduce it in the second spot, instead of me copying and thereby maybe forget to update it in one position?

I use PDFLatex

-

## marked as duplicate by Joseph Wright♦Dec 23 '12 at 22:09

What about the float's number? Should it be the same? –  egreg Dec 21 '12 at 12:23
i agree its a duplicate, sry i could not find the other post in my search –  Rasmus Dec 21 '12 at 14:17

Just define the float inside a command, call the command as many times as you want.

\def\testFloat{
\begin{figure}[h!]
\begin{center}
\includegraphics[width=0.3\textwidth]{logo.png}  %Insert Your Image Here.
\end{center}
\end{figure}
}
%Call it once
\testFloat

%Call it twice
\testFloat


Since your question was regarding tables....

\newcommand{\testFloat}{
\begin{tabular}{ l | c || r }
\hline
1 & 2 & 3 \\ \hline
4 & 5 & 6 \\ \hline
7 & 8 & 9 \\
\hline
\end{tabular}
}

-
awesome i will try this out –  Rasmus Dec 21 '12 at 13:40
Small follow up Question, some of the tables are autogenerated and included in the end of the document. I can easily modify the auto generate code to do the \defs but are there anyway of using the def before its defined or including the document earlier with out actually printing the content. (its an appendix, don't want this in the beginning of the doc) –  Rasmus Dec 21 '12 at 13:50
I'm not sure I follow you, Defining the command doesn't print the content, its only when you call the command. So you can define it as early as the preamble, or as late as at the point of first use (ie in the appendix). –  Nicholas Hamilton Dec 21 '12 at 14:02
sorry for not being clear. the problem is the tables i want to have in multiple places are in an appendix that is autogenerated. which means the \def will be in the last chapter. but i would like to CALL it before its actually defined. sort of a two times compile as for the \ref –  Rasmus Dec 21 '12 at 14:06
Cant you call the script earlier, formally putting the results into the appendix at the end, at the moment, it seems like you are doing things back-to-front. Without seeing your code or a minimum example, its is difficult to advise. –  Nicholas Hamilton Dec 21 '12 at 14:33