Automatic Numbering of Tables and Figures

Question

Is there a way to have tables and figures in Writer automatically include numbering–and for that numbering to be updated i after tables & figures are re-arranged?

Explanation / Reason

I often create manuscripts with many tables and figures that must be labelled Table 1, Table 2, etc. However, I nearly as often need to re-order tables & figures while I’m writing. Re-numbering tables & figures can be tedious–and seems like a perfect job for a computer.

My question is similar to how to modify table captions, except that I would like these to be related to tables & figures, e.g., as their titles.

Example

For example to have the number automatically inserted into these table titles:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget urna aliquet, feugiat nisl eget, congue sem. Curabitur quis arcu nulla. Ut venenatis quis eros quis pharetra. Aliquam malesuada dictum ornare.

       Table 1

       Thing Value

       1        10

       2        12

Duis mollis mi ac ipsum pulvinar mollis. Duis vitae sapien sit amet purus facilisis faucibus. Praesent rutrum eleifend libero congue laoreet. Nulla tincidunt lacus ante, ut lobortis mi posuere at.

       Table 2

        Idea Reason

        A      YY

        B      ZZ

Fusce vel pretium lacus. Cras sagittis aliquam aliquet. Suspendisse potenti. Pellentesque et velit a odio accumsan rhoncus. Duis vitae purus faucibus, tincidunt magna non.

And then to have the numbering updated after I switch their places:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eget urna aliquet, feugiat nisl eget, congue sem. Curabitur quis arcu nulla. Ut venenatis quis eros quis pharetra. Aliquam malesuada dictum ornare.

       Table 1

       Idea Reason

       A      YY

       B      ZZ

Duis mollis mi ac ipsum pulvinar mollis. Duis vitae sapien sit amet purus facilisis faucibus. Praesent rutrum eleifend libero congue laoreet. Nulla tincidunt lacus ante, ut lobortis mi posuere at.

       Table 2

       Thing Value

       1        10

       2        12

Fusce vel pretium lacus. Cras sagittis aliquam aliquet. Suspendisse potenti. Pellentesque et velit a odio accumsan rhoncus. Duis vitae purus faucibus, tincidunt magna non,

I assume you already use the Insert>Caption command which can number “objects” under various counters. The counter is chosen with the Category drop-down menu. The counter is controlled by Writer. Consequently, if you move your objects, add new ones or delete some, the captions are renumbered accordingly.

The captions also define bookmarks in the text. If you need to reference a specific “object”, insert a cross-reference to it because the counter appears in the Type list of Cross-references tab.

If you want the caption to be automatically added whenever you insert a certain type of object, you must first configure the caption feature:

  • put the cursor in an object so that Insert>Caption is enabled
  • Insert>Caption and push Auto
  • tick the kind of object for which you want automatic insertion and choose the associated counter from the Category drop-down menu
  • when done, push OK; you’re back to the Insert>Caption dialog
  • I suggest to push Cancel so that you don’t mess up the current object

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Yes.

Numbering of objects like tables, figures, illustrations and the like in LibreOffice is accomplished using number ranges. Internally, a number range is a variable having the name you choose. There are some pre-defined number ranges in Writer: Illustrations, Tables, Text, Drawing, Figure.

Each of the ranges may be used when you add a special kind of field named Number range. This field does two things: first, it sets the range’s current value; and second, it displays this value. You may use any formula here, from simple number to something involving document variables, square roots, and other strange things (keep in mind that the result will finally be represented as integer); but normally, the formula here just increments the current value of the range. E.g., for Table number range, normal Number range field will contain Table+1 formula, which tells “take last value of Table number range, add 1 to it, and store to Table number range as current value”.

Naturally, putting several such fields for the same number range in a document results in each next such field showing the next number. Re-arranging them - putting a field that shows, e.g., 5, before field having 2 - will re-number the fields: the one that had 5 is now in the position where last value of the range was 1, and it applies the incrementing formula to make it 2; the one that had 2 now will have 3, and so on.

The bare sequence of numbers is rarely useful; of course, the most common use of these sequences is in object captions which include the name of the object, its number, and its description. It is done by adding a simple line of text starting with a word like “Table”, after which the Number range field follows, and then the rest of the line is normal text again. You just write it once, say, before a table, configure as you like, and then copy and paste before following tables, and the field in the text does the numbering magic. Having a separate paragraph and a dedicated paragraph style allows you to easily manage such captions after you had inserted a hundred of those and suddenly decided to change their font/alignment.

“And then copy and paste before following tables”? That’s rather tiresome. There is a way to add a caption to an object without scrolling back in the document, searching for the same kind of object, copying its caption, getting back, pasting, and then editing the description. You may simply right-click the object (e.g., table) and choose Insert Caption..., then fill the dialog. This will add the text with the field for you, just as if you did it yourself - using a paragraph style named like the number range itself.

But you wanted to have tables and figures in Writer automatically include numbering; and the above is not automatic. You may automatize the insertion of the captions: use Writer’s AutoCaption feature.

Note also that the number ranges may include chapter number; this setting is common to all the fields of a given number range (you cannot set it to a single table number, but not to other table numbers sharing the same range) - but you are not limited to the pre-defined ranges, and may add as many as you need.

Note also that adding a caption to e.g. images will add a frame to the image, inside which there will be a single paragraph with the image anchored as character, then a line break, then the caption. I mention that because personally I dislike this behavior: having the same paragraph for the object and its caption may be inconvenient when you decide to add indents/spacing to the captions. Usually I don’t use automatic captioning, and add it myself, to have full control over formatting.