3

I write this question as Q&A after picking together information from different sources. For some issues I haven't found solutions, see answer part.


I want to create equations with numbering on the same line.

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, 
sed  diam  nonumy  eirmod   tempor  invidunt  ut  labore

                         x + y
         ∑    x * y =    -----                       (1)
          n              x - y

et  dolore magna  aliquyam erat,  sed diam  voluptua. At
vero eos et accusam et justo duo dolores
                                                           |Unnumbered  |
                   x = ...                                 |intermediate|
                   y = ...                                 |equation    |

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, 
sed  diam  nonumy  eirmod   tempor  invidunt  ut  labore

                        x = f(a,b)                  (2a)
                        y = g(c,d)                  (2b)
                        n = z(x,y)                  (2c)

et ea rebum. Stet clita  kasd gubergren, no sea takimata
sanctus  est Lorem  ipsum  dolor sit  amet, see
Eqs. (1,2b,2c). 

How can I produce such equations, such that equation numbers can be made consistent with "Update fields" (Ctrl+A, F9) and cross-reference the equations consitently, i.e. such that updating the numbering also updates the references?

1 Answer 1

3

(Wording of UI elements may deviate slightly, due to my Version being in German. I googled, what the terms should be in English.).

Contents
------
1. Adding a “display” style equation
2. Inserting an equation number field
3. Referencing auto-numbered equations
4. Subequation numbering
5. Open Issues

1. Adding a “display” style equation

Use “Insert→Equation→New Equation” for creating a new equation. For making it a display-style equation instead of an inline equation, simply put it on a new line. Such equations should differ in several way, by

  1. Being centered, and
  2. Having superscripts and subscripts of operators like the ∑ and ∫ placed above and below instead of to the side of the operator.

as would be the case with the LaTeX constructs

\begin{equation} .. \end{equation}
$$ .. $$
\[ .. \]

If it behaves differently. This might be disable in a given document, especially when working with collaborators or third-party templates.

The setting can be found by placing the cursor inside an equation or creating a new equation through the ribbon “Insert→Equation→NewEquation” and then accessing the Equation options through the ribbon “EquationTools/Design”, where the options are hidden in the button of the "Tools" section at the left of the ribbon.

In the options the section "Display math" these settings are controlled. In doubt just use the "defaults" button at the bottom.

Additionally, this dialog allows customizing display-math formatting consistently.

2. Inserting an equation number field

Word 2016 has support for manual equation numbering, similar to using the \tag command in LaTeX. For instance typing x=1#(23)<Enter> will produce

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, 
sed  diam  nonumy  eirmod   tempor  invidunt  ut  labore

                          x = 1                     (23)

et  dolore magna  aliquyam erat,  sed diam  voluptua. At
vero eos et accusam et justo duo dolores.

An automatic number can be generated using “References → Insert Caption” (ger. “Verweise → Beschriftung einfügen”), but this is grayed out inside equations. Instead,

  1. Create the equation number field outside an equation with “References → Insert Caption”. Select the type “Equation” (if it doesn't exist yet or has been deleted use the “New Label” button to create it and select the option “Exclude label from caption”.

    This creates an auto-numbered field. It also sets the paragraph style to “Caption”; Change it back to “Text Body” or “Standard” in the “Home” ribbon.

  2. Cut the field (Ctrl+X) and use it as equation number using the #(number)<Enter> pattern, but instead of <number> paste the field with Ctrl+V.

For future convenience, it is helpful to store the equation number as reuseable text snippet (ger. "Schnellbausteine") in the “Insert” ribbon, or to store a numbered equation as template in the “Insert → Equation” interface. You can also just copy-paste previous equations; The numbers will be the same only until updating the fields.

3. Referencing auto-numbered equations

I found a common recommendation to just copy/paste the generated equation numbers. This is wrong. Doing so will break the reference, when updating the numbering, because it doesn't insert a reference to the equation number, but a new auto-numbered field, that just hasn't been updated yet.

Normally, you'd insert cross-references with “Insert → Cross Reference”. However, this interface considers everything left of the number as part of the category label, and Word 2016 offers no choice to insert only the number, so using this directly will insert the whole equation instead of the numberical reference.

Instead, we need to create a named bookmark (ger. “Textmarke”) by selecting the equation number field – only the number, without surrounding braces – and using “Insert → Bookmark”.

We can then insert a self-updating and hyperlinked copy of the marked text, i.e. the equation number, using “Insert → Cross Reference” using the reference type “Bookmark” using the “Bookmark content” (ger. “Textmarkeninhalt”) option for the reference contents.

Surrounding naming like "Eq. (...)" has to be done by hand. Here it comes in handy to use a “protected space” inserted with Ctrl+Shift+Space to prevent unwanted line breaking like

yada   yada   yada   yada   See   Eq.
(1) and yada yada yada yada yada yada

LaTeX equivalents would be Eq.\,(\ref{NAME}) or Eq.~(\ref{NAME}). I'm not sure if there is a straight-forward way of inserting a thin protected space (\,) in Word.

4. Subequation numbering

This doesn't seem to be directly supported, but it can be worked around using the features already used.

  1. Insert an auto-numbered equation as before. Manually add a after the number field.

  2. In subsequent lines, do not add the auto-numbered equation and do not copy paste the field; These would result in new, differing equation numbers being assigned upon Ctrl+A, F9.

    Instead, create a bookmark for field-part of the first equation number and use a cross-reference to repeat the number. Add b, c, d etc. manually. (Automatic creation of the letters could be possible, but since this numbering is very local it is not work the effort.)

    The result will be something like

    sed  diam  nonumy  eirmod   tempor  invidunt  ut  labore
    
                            x = f(a,b)                  (2a)
                            y = g(c,d)                  (2b)
                            n = z(x,y)                  (2c)
    
    et ea rebum. Stet clita  kasd gubergren, no sea takimata
    

    where the 2 in (2a) is an auto-numbered field, the 2 in (2b) and (2c) is a reference to a bookmark to this field, and a,b,c are manually added letters.

  3. For referencing the whole equation, use the bookmark created for the number in (2). For referencing subequations, create new bookmarks, that include number and letter of the subequation.

5. Open Issues

In LaTeX, it is trivial to create multi-line equations that are both aligned at some symbol and have numbers usable for cross-references with the align environment, with

\begin{align}
  x &= hello + world \\
  y &= foo + bar
\end{align}

Resulting in

sed  diam nonumy  eirmod  tempor invidunt  ut labore  et
dolore magna aliquyam erat,

                   x = hello + world                (42)
                   y = foo + bar                    (43)

sed diam voluptua.  At vero eos et accusam  et justo duo
dolores et ea  rebum. Stet clita kasd  gubergren, no sea

For unnumbered equations, word has an alignment feature, that can either be used by selecting a symbol for alignment and setting it as alignment element through the context menu, or by typing LaTeX-style input where &= will be converted to an aligning =.

However, inserting a number with the #() method breaks all such alignment.

2
  • i just found this amazing answer! thank you for the detailed explanation. as great as this is, I am dumbstruck at how completely backwards equation numbering is done to this day in ms office after all this time! jumping through som many hoops just to achieve what latex achieves with a simple \label{} it is trully an amazing feat!
    – lucian
    Sep 22, 2021 at 7:03
  • @lucian Sadly, equations are a rather niche topic by the standards of office word processors. All other office suits I know do even worse. And WYSIWYG focus often leads to bad practices or outright broken documents; The wide use of MS Office in particular additionally leads to plenty of outright wrong how-tos on the internet.
    – kdb
    Sep 28, 2021 at 10:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .