## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ How to add or delete figure/table in between other figures/tables Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
Ali Sultan
Posts: 12
Joined: Sun Oct 02, 2016 5:09 am

### How to add or delete figure/table in between other figures/tables

Hello,
I am writing my dissertation using latex. I do have more than 100 figures/tables in chapters 4 and 5. The figure files are stored in the same latex directory in an ascending order (i.e., Fig 4-1, Fig 4-2, etc). Sometimes I need to either add, or delete, a figure/table in the middle of chapter 4 for example, what is the most efficient way to do so without going over all the figures/tables after that position and changing the numbers manually? I hope you understood the problem and have some solutions. Thanks

Johannes_B
Site Moderator
Posts: 4160
Joined: Thu Nov 01, 2012 4:08 pm
LaTeX numbers figures automatically using the caption command.
That you named the figures using numbers, is a design flaw. That should never be done.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

Ali Sultan
Posts: 12
Joined: Sun Oct 02, 2016 5:09 am
Johannes_B wrote:LaTeX numbers figures automatically using the caption command.
That you named the figures using numbers, is a design flaw. That should never be done.

Do you mean that I should've named these figures exactly as their corresponding captions?

Stefan Kottwitz
Posts: 9567
Joined: Mon Mar 10, 2008 9:44 pm
Let's say, you have a picture of a book. You call it book.png.

In your LaTeX document, you write it like

\begin{figure}  \centering  \includegraphics{book}  \caption{This is a book.}  \label{book}  \end{figure}% ...% later in the textSee the figure \ref{book} as an example.

LaTeX does all the numbering for you!
It puts
• a number before the caption, such as "Figure 4.1: This is a book"
• the number with that caption into the list of figures
• its number to all references of it in the LaTeX document (done by \ref)

It numbers in the correct sequence per chapter. You can change the design or function of numbering too. But don't number yourself, otherwise you see what happens: you need to change all manually, every time such a change happens, even your file names if you used numbers in file names.

Stefan