Graphics, Figures & TablesMultiple copies of the same figure, equation etc.

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jrossjr
Posts: 2
Joined: Mon Dec 14, 2009 4:56 am

Multiple copies of the same figure, equation etc.

Post by jrossjr »

I am using Latex for my dissertation. Since my document is rather long I have multiple copies of some equations so that the reader is not required to flip back and forth to stay in the flow of each chapter. A couple questions:

1. Is there a away to (re)insert a figure, or equation that already exists in the document based on its label?
2. Is there a way to insert an equation/figure yet have it referenced back to the original? I.E. if I put an equation in chapter 4 that also existed in chapter 1, can i have it list the reference the equation number for chapter 1? (1.7 instead of 4.2 for example)

Thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

olofos
Posts: 56
Joined: Tue Nov 24, 2009 10:37 pm

Multiple copies of the same figure, equation etc.

Post by olofos »

I don't think there is a simple way to reuse an equation or a figure. You can of course define a macro which gives the content of the equation/figure, so that you don't have to copy/paste if you change it.

To reuse an equation number, you can use the \tag feature to manually set the tag of the reused equation. To set a figure number, I think you have to manually tinker with the involved counters. Does the following example do what you want?

Code: Select all

\documentclass{book}
\usepackage{amsmath}

\begin{document}
\chapter{First}

\begin{equation}
  \label{eq:1}
  A = B
\end{equation}

\begin{figure}
  \centering
  \rule{2cm}{2cm}
  \caption{Figure 1}
  \label{fig:1}
\end{figure}

\chapter{Second}

\begin{equation}
  \tag{\ref{eq:1}}
  A = B
\end{equation}

\begin{figure}
  \centering
  \rule{2cm}{2cm}
  \caption{Figure 2}
  \label{fig:2}
\end{figure}

\begin{figure}
  \addtocounter{figure}{-1}
  \renewcommand\thefigure{\ref{fig:1}}
  \centering
  \rule{2cm}{2cm}
  \caption{Figure 1 again}
\end{figure}

\begin{figure}
  \centering
  \rule{2cm}{2cm}
  \caption{Figure 3}
  \label{fig:3}
\end{figure}

\begin{figure}
  \centering
  \rule{2cm}{2cm}
  \caption{Figure 4}
  \label{fig:4}
\end{figure}

Three figures: \ref{fig:1} \ref{fig:2} \ref{fig:3}

\end{document}
jrossjr
Posts: 2
Joined: Mon Dec 14, 2009 4:56 am

Re: Multiple copies of the same figure, equation etc.

Post by jrossjr »

Yes, thank you!
Post Reply