LaTeX forum ⇒ Graphics, Figures & TablesHow 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

Postby Ali Sultan » Thu Nov 24, 2016 6:46 am

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

User avatar
Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Nov 24, 2016 8:30 am

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

Postby Ali Sultan » Thu Nov 24, 2016 9:00 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?

User avatar
Stefan Kottwitz
Site Admin
Posts: 9444
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Nov 24, 2016 4:58 pm

Let's say, you have a picture of a book. You call it book.png.

In your LaTeX document, you write it like

Code: [Select all] [Expand/Collapse] [Download] ({untitled.tex})
  1. \begin{figure}
  2. \centering
  3. \includegraphics{book}
  4. \caption{This is a book.}
  5. \label{book}
  6. \end{figure}
  7. % ...
  8. % later in the text
  9. See 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
Site admin

Ali Sultan
Posts: 12
Joined: Sun Oct 02, 2016 5:09 am

Postby Ali Sultan » Thu Nov 24, 2016 6:09 pm

Thanks Stefan and Johannes_B. for answering the question. You're the best guys. :D


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 3 guests