- A casket just opened.
I.A. Krylov
What is this article aboutThis paper describes how to automatically organize numbered objects when writing articles, abstracts, reports, theses, etc. When writing this kind of materials, it is inevitable that it is necessary to number certain objects, for example, formulas or items in the list of used literature. However, many authors use when writing a text editor Microsoft Word.
In the case of a trivial "manual" organization, in which each number is written directly by hand (usually, at the very end, when the text is fully prepared), the author of the work may be mistaken in any number, and all further numbers will be incorrect. Moreover, after the review, certain parts of the work can be inserted into the text or removed from it. The latter often requires a complete renumbering of the objects in the document. Thus, the purpose of this article is to bring to the reader ways of automatically organizing the numbering of objects to avoid the situations described above.
Warning : this article includes only those techniques that the author encountered while writing a Ph.D. thesis. The described ways of organizing numbered objects do not claim uniqueness, completeness and optimality. There are other interesting ways,
for example, in TeX . Undoubtedly, the reader will be able to find other ways to achieve the stated goal. In any case, any interested reader should become familiar with the author’s approaches (at least at his leisure).
')
Basics of working with MS Word fields
This section describes the main fields of the MS Word text editor required for organizing lists and links to them, as well as methods of working with them.
The MS Word field is an object that takes a particular value depending on the keywords and parameters of this field. To insert a field in the text, press Ctrl + F9 or select the corresponding menu on the ribbon.

After inserting a field,
gray curly braces will appear in the text.

It is very easy to distinguish fields in the text - just select the necessary block of text. All fields in the selection will be highlighted in gray.

After the field is inserted into the text, it is necessary to set the value of this field. To assign a value to a field, you need to write certain keywords, discussed in Section 2, inside the field. After setting the value to the field, select the block of text containing this field and press F9. If there are several fields in the selection, all of them will be updated. To update the fields in the entire document, select everything (Ctrl + a) and press F9. You can also update the field by clicking on the corresponding context menu item.
NB! It happens that all fields need to be updated two times: the first update will reorder the lists, and the second will arrange the necessary values of the links.
The value of a field can be changed at any time. To do this, it is only necessary to select the field (or a text fragment containing the fields) and select the item “Field Codes / Values” in the context menu.

The main fields of MS Word necessary for the automatic organization of numbered objects
This section describes the main fields and keys used with these fields. These fields allow you to organize automatic numbering, lists and links.
To organize automatic numbering, you must use the following fields:
SEQ
The SEQ field is used to create numbered lists. Each SEQ field increases by one a unique variable specified in this field. If such a variable has never been used, then its value becomes 1. If the field with this variable is inserted into one or another part of the text and completely updates the document, then the numbering of all the fields after the inserted one will automatically increase by one.
Example of setting the field SEQ{SEQ pic_chap1}
NB! It is advisable to use meaningful variable names, for example:
pic_chap1 - pictures of the first chapter,
fn_intro - formulas in the introduction, etc. Authors can use any variable names, but it is meaningful names that will allow you to quickly navigate the text and correct it.
Important field keys SEQ. The key "\ s" is used to display the current value of the variable. In particular, using the tab (SET) with the value of the field with the key "\ c" you can organize automatic output of the number of tables, figures, formulas and other objects, which will be shown below. The key "\ h" increases the value of the variable in the place where the field is specified, without displaying the field itself. Using the keys "\ h" and "\ c" together is obviously permissible, but does not make sense. The author recommends to refrain from such.
Examples of using keys of the field SEQ{SEQ pic \ h}, {SEQ tables \ c}
SET
The SET field sets a bookmark at a given location in a document.
An example of using the SET field{SET lit_Z2009 “1”}
Here, lit_Z2009 is the name of the bookmark, and “1” is the bookmark text. The most significant is the ability to use nested fields, i.e. fields inside fields. In particular, they can be used as bookmark text.
To do this, insert a field as described above, while inside the field.Example{SET lit_Z2009 “{SEQ lit \ c}”}
Ref
The REF field is used to create links and hyperlinks to bookmarks. If a bookmark has been defined somewhere in the text, then you can refer to it, for example, as follows:
After updating this field, the bookmark text will be inserted in its place. The key "\ h" is used to set a hyperlink to a bookmark. When clicking on the hyperlink, the user will be moved to the location specified by the link. The key "\ * MERGEFORMAT" resets the text format of the original link, converting it to the format of the current part of the text.
PAGEREF
The PAGEREF field works the same as the REF field, except that the link text is the page number on which the corresponding object is located, not the object number.
Organization of automatic numbering in documents
Before you begin describing how to automatically number objects in documents, you must warn the reader about the obvious disadvantage of the proposed approach: for each type of object and for each element of lists with links, you will have to create your own unique identifier. In this case, the author recommends to think over the system of unique names in advance and write it down somewhere so that it is always before your eyes. The great advantage will be that when moving, inserting, adding and deleting objects and links, all objects are guaranteed to have the correct numbers, and links are guaranteed to point to the necessary objects.
Numbering in the titles of chapters and sections
For the title of chapters and sections, you can use the MS Word styles, and then insert the autoglow. However, if the second chapter suddenly becomes the third, or section 2.2 becomes section 2.3, then renumbering a large number of formulas, tables, and figures will be troublesome. Special difficulties will be caused by the renumbering of the list of references organized in the order of appearance. To avoid the above, it is recommended to give each chapter a unique name (based on, probably, from its meaning). In addition, for chapters it is necessary to define a unique variable - the name of the field SEQ. For example, the name of this chapter may be
CHAP_USING_FIELDS , and the variable counter of heads may be
CHAP .
After determining how to name and number the chapters, the following (one of the following) line is written in the title:
- {SEQ CHAP} . Organization of automatic numbering in documents
- {SEQ CHAP \ h} {SET CHAP_USING_FIELDS “{SEQ CHAP \ c}”} {SEQ CHAP \ c} . Organization of automatic numbering in documents
Let us examine these lines in more detail. The first line causes the value of the
CHAP variable to be incremented by one. After updating the field, the current chapter number will appear in its place. This method of numbering is suitable for objects that are not referenced in the text (for example, for intermediate formulas). If an object reference is required, then the second construction should be used. In it, the first field increases the value of the CHAP variable without displaying it, the second field sets a bookmark named
CHAP_USING_FIELDS , giving it the text of the third field - the current value (already increased by 1) the variable
CHAP , and the fourth field displays the current value (already increased on 1) variable
CHAP . It should be noted that the third field is nested in the second field. This design is used because there is no clear understanding of which field will be updated earlier and in which case it is nested or coming after, if only one of them had the “\ c” key. Experience has shown that increasing the variable in the background and using the current value leads to the desired result. All further arguments are built on this technique.
For the numbering of sections within a chapter, you must set a variable (unique for each chapter, otherwise in the next chapter, the sections will begin with the number n + 1), and for each section you must define a unique name.
As an example, the following lines{SEQ CHAP \ h} {SET CHAP_USING_FIELDS “{SEQ CHAP \ c}”} {SEQ CHAP \ c} . Organization of automatic numbering in documents
{SEQ SUBCHAP_FIELDS \ h} {SET SUBCHAP_USING_REF “{SEQ CHAP \ c}. {SEQ SUBCHAP_FIELDS \ c}”} {SEQ CHAP \ c}. {SEQ SUBCHAP_FIELDS \ c} . Using REF
After updating the links, this piece of text will turn into
3 Organization of automatic numbering in documents
3.1 . Using REF
In this example, the second technique, described in the chapter numbering, is used, only now two fields are inserted and followed. The first field
{SEQ SUBCHAP_FIELDS \ h} in the background updates the corresponding variable defined under the sections of this chapter, the 2-4 fields
{SET SUBCHAP_USING_REF "{SEQ CHAP \ c}. {SEQ SUBCHAP_FIELDS \ c}"} give a link with the value "CURRENT HEADER CURRENT SECTION ”, and fields 5-6
{SEQ CHAP \ c}. {SEQ SUBCHAP_FIELDS \ c} insert the value“ CURRENT HEAD SECTION ”into this place of the document.
It should be repeated once again that for each chapter and section (subchapters, paragraphs) it is necessary to define its own unique names in order to specify references to them, if necessary.Autocontent
MS Word tools allow you to organize autocontent, however, it is recommended to use
REF fields to specify links to chapter numbers and
PAGEREF fields for links to pages. It is better to place them in tables with hidden boundaries of size
N x3, where
N is the number of elements in the autocontent: sections, subsections, etc. The first column will contain the item numbers obtained from the
REF fields. The second column will contain the names of the elements. (Alas, oh! They'll have to write down hands). The third column will contain the page numbers on which the corresponding
SET field is located. Receiving values is done through
PAGEREF .
Formula Numbering
For the numbering of formulas you need to use the same constructions as for the numbering of chapters and subsections. The author recommends placing formulas in tables
N x2, where
N is the number of formulas that follow in succession, hiding the borders of the tables and exposing the desired alignment.
An example is shown here.x = a + b (3.5)
Here (3.5) is the value of the field, which in the source codes is written as follows:
( {SEQ FN_CHAP_FIELDS \ h} {SET FN_AX2_BX_C “{SEQ CHAP \ c}. {SEQ FN_CHAP_FIELDS \ c}”} {SEQ CHAP \ c}. {SEQ FN_CHAP_FIELDS \ c} )
Here FN_CHAP_FIELDS is the name of the variable for numbering the formulas of the current chapter, {SEQ CHAP \ c}. {SEQ FN_CHAP_FIELDS \ c} is the number of the corresponding formula.
NB! When converting a document to pdf formulas are often displayed incorrectly. In the final version of the thesis, the author replaced all the formulas with the corresponding drawings through the good old PrintScreen - MS Paint.
Numbering of tables and figures
The numbering of tables and figures is done in the same way as the numbering of formulas. The only difference is that it is better to give different names to corresponding objects and invent other variable counters for them, for example,
PIC_CHAP2 ,
TABLE_BETTER_NPV , etc.
Let's give a couple of examples.
Example 1, tablesTable {SEQ TAB_CH2 \ h} {SET TAB_CH2_SHOPS “{SEQ CHAP \ c}. {SEQ TAB_CH2 \ c}”} {SEQ CHAP \ c}. {SEQ TAB_CH2 \ c} . Comparison warehouse / market shopping.
Shop 1 Shop 2
Warehouse 100 180
Market 16 29
Here TAB_CH2 is the variable-counter of the tables of the second chapter, TAB_CH2_SHOPS is the name chosen by the author for this table. Let this chapter be number 3, and it already had 3 tables. Then this formula, as it is easy to show, will be converted to the following text:
Table 3.4 . Comparison warehouse / market shopping.
Shop 1 Shop 2
Warehouse 100 180
Market 16 29
Work with images is done in exactly the same way. You must set your own counter variables, names, etc. In general, in terms of autonumbering, there is no difference between a table and a picture. The only difference is in the formatting of parts of the text: other names, captions from the bottom / top, etc.
Example 2, imagesPicture
{SEQ PIC_CH2 \ h} {SET PIC_CH2_EXPONENT “{SEQ CHAP \ c}. {SEQ PIC_CH2 \ c}”} {SEQ CHAP \ c}. {SEQ PIC_CH2 \ c} . Exhibitor, cosine and sine.
Similar to the tables, here PIC_CH2 is the variable-counter of the drawings of the second chapter. Again, it is obvious that the result will be something like this:

Figure
3.10 . Exhibitor, cosine and sine.
The organization of the list of used literature
Working with the bibliography in general is similar to working with formulas, tables, and figures, but it still has one significant difference. Because of this, the organization of the list of references was placed in a separate section. This section describes in detail the construction of a list of used literature in alphabetical order. The construction of the list of references in the order of appearance in the text is not described in such detail, but can easily be done by analogy.
Registration of the list of used literature in alphabetical order at the end of the document
So, in the text there was a need to make a link to a book, article, magazine, etc. If they have to go a single list, the design should be done in succession alphabetically. If they have to go according to types of sources, then you need to write first books in alphabetical order, then articles in alphabetical order, etc. In the sense of autonumbering, it doesn't matter. What is important is the order in which these sources will be recorded, after which they will be assigned numbers.
NB! Each source must be given a unique name that will be used to specify links in the text. When writing a dissertation, the author used the format "
lit_INITIALY_AVTOROV_GOD " or "
lit_INITIALY_AVTOROV_POSTFIX_GOD ." Postfix is needed in order to share certain works that the author (s) could release in one year.
Keep this list of unique names before your eyes, because he will have to turn to often .
When adding new sources, all you have to do is to insert them in the right place in the list of used literature, preserving the order, and update the document twice. Update twice is required to update nested fields and external fields. A double update of the document guarantees both updating the list of references and updating links to it.
An example of a part of the list with detailed formulas is shown below.{SEQ LIT \ h} {SET lit_CHR2011 “{SEQ LIT \ c}”} {SEQ LIT \ c} . Christofides N. Graph Theory: An Algorithmic Approach. Academic Press Inc., London, 1975. - 400 p.
{SEQ LIT \ h} {SET lit_CHVATAL1983 “{SEQ LIT \ c}”} {SEQ LIT \ c} . Chvatal V. Linear Programming. WH Freeman and Company, 1983. - 425 p.
{SEQ LIT \ h} {SET lit_ERL1978 “{SEQ LIT \ c}”} {SEQ LIT \ c} . Erlenkotter D. A Dual-Based Procedure for Uncapacitated Facility Location. J. Operations Research, 26, 1978. - pp. 992-1009.
It is easy to show that this list is converted to
15 Christofides N. Graph Theory: An Algorithmic Approach. Academic Press Inc., London, 1975. - 400 p.
16 Chvatal V. Linear Programming. WH Freeman and Company, 1983. - 425 p.
17 Erlenkotter D. A Dual-Based Procedure for Uncapacitated Facility Location. J. Operations Research, 26, 1978. - pp. 992-1009.
If you need to insert some work between the authors of Chvatal [16] and Erlenkotter [17], then all you have to do is add an empty line, copy an existing literature item into it (for example, Chvatal [16]), replace the unique name work, replace the text description of the work and update the entire document twice.
Making references to the elements of the list of used literature in the text
Now, perhaps, it is obvious how to make references to the literature in the text.
Knowing the unique names, it is enough to use the REF field.From the solution of the classical transport problem [ {REF lit_MEELIT1972 \ h} ], it follows that any basis of such a problem contains exactly m + s-1 elements. From the theorem of Danzig [ {REF lit_CHVATAL1983 \ h} ] it follows that all elements of the basis in the formulated problem will be either zeros or natural numbers.
After updating the document twice, this text fragment will look as follows:
From the solution of the classical problem of transport type [ 26 ], it follows that any basis of such a problem contains exactly m + s-1 elements. It follows from the Danzig theorem [ 16 ] that all elements of the basis in the formulated problem will be either zeros or natural numbers.
Making a list of used literature in order of appearance in the text
If the previous method was clear, then the list of references in the order of appearance also would not be difficult. References, set at the end, now need to be placed directly in the text. If this source is encountered for the first time, then indicate the structure of the form [
{SEQ LIT \ h} {SET lit_ERL1978 “{SEQ LIT \ c}”} {SEQ LIT \ c} , p. 18]. If this source has already met before, then indicate a structure of the form [
{REF lit_ERL1978 \ h} , p. 95]. Of course, the list itself must
contain {REF lit_ERL1978 \ h} fields - references to the appearance of sources in the text. The whole difficulty lies in the manual placement of the full names of the sources. However, if somewhere in the text there will be changes in the order in which the links appear, then (after a double update) this will immediately reflect on the order in the list of references, which can be quickly corrected by cutting and pasting. An additional plus: checking the order of sources in this case is a "checksum". Errors in the sequence are either absent or, if any, are obvious.
Uploading a document in pdf format with preservation of links
Well, perhaps, the final of this story. The document is ready. You can do it spread, but do not want to give the original. There are two ways. The first is to replace the links with their values using MS Office. This is achieved by pressing Ctrl + Shift + F9, but the author does not strongly recommend doing so.
Far more interesting is uploading the document to pdf format. When unloading, you can replace the fields with values, thus breaking links to objects, or leave them. The advantage of the second case (why all this was done at all) is that when reading the text, the reader can click on one or another link to move to the desired formula, table, picture or element of the list of references. Enable or disable this option when saving to pdf:
Create bookmarks using: Word bookmarks .
