Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
1  
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
add comment

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 1 down vote accepted

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}
}
share|improve this answer
    
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
1  
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
show 3 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.