Long equations often do not fit on a single line and ways are needed to break them up for display on multiple lines. Word 2007 offers two approaches: automatic and manual line breaking. A related feature is alignment of multiple equations, such as aligning the equal signs of a group of equations. This post describes all three subjects.

Automatic line breaking occurs when an equation doesn’t fit on a single line and no user defined breaks exist. This kind of line breaking is essential for viewing in rendering environments like HTML that can be resized and don’t generally require the panning and scrolling used by fixed-width displays such as for pdf’s. The algorithm used for automatic breaking is similar to that for optimum line breaks in a paragraph: various possible line breaks are assigned penalty values and the line breaks with the minimum total penalty are chosen. Binary and relational operators outside of built-up functions have the lowest penalties, whereas these operators inside built-up functions like parenthesized expressions have higher penalties. In addition the distance from the maximum break point is an important factor in the breaking formula. Each line break starts a new line at a document-specified indentation. Such breaking is effective, but it’s not the most aesthetically satisfying.

Users who desire more pleasing line breaking can “right click” on a binary or relational operator and choose the option to “Insert Manual Break”. Three document-level possibilities exist: break before, break after, and duplicate. In the United States, mathematical typography is almost always “break before”, i.e., the operator chosen starts the new line. But some locales prefer another option. In particular, the duplicate option (display operator at the end of the broken line *and* at the start of the new line) is popular in Russian mathematical typography. Since the layout routine was developed primarily by Russian computer scientists (see my blog on LineServices), we certainly had to support this option!

Once such a line break is selected, the user can type the Tab key to tab into the position of a binary or relational operator on the line above. Each successive Tab key aligns to the next binary/relational operator on the previous line. Such operators can be inside parenthesized expressions, even if the expression ends up spanning several lines. The parentheses (or other brackets) are sized to fit the total expression within, in spite of the line breaks. It’s an easy and aesthetically pleasing way to break lines. Naturally if the viewer nevertheless insists on making the window width too small, additional automatic breaks may occur that don’t look as nice.

A common scenario is the display of a group of several related equations aligned at particular equal signs or other relational operators. To do this, separate the equations not by the usual Enter key, but by Shift Enter, which is a special user-defined line break that doesn’t terminate a paragraph. Then select the desired operators to be aligned with one another choosing the “Align at this Character” option for each one. The operators will then all line up precisely. It’s very cool J

Thank you very much. This is exactly what I was after. As a general comment on mathematics in Office 2007, it certainly looks better than the previous EqnEdit but I do miss the key board shortcuts!

Yeah that was useful. Still I think in your next patch you should add support for breaking between pairs of bracketed expressions, e.g. between (a+b) and (c+d) in (a+b)(c+d).

In an ideal world manual alignment would never be necessary, the automatic one would be sufficiently sensible for almost all occasions. Still some automatic alignment is better than none *cough*LaTeX*cough*…

Hi, the way you have explained about the breaking equations is very excellent…please go on and explain more and more in your next blog…

Cheers,

Suma valluru

—————————

http://www.esumz.com

Another line splitting bug:

if you have an expression containing brackets with multiple bar delimited arguments, e.g.:

[A+B+…+M | N,O,…,Z]

that is longer than one line, then the equation will just be clipped by the margins, rather than breaking on to a new line.

Furthermore, manual breaks inserted in the expression are ignored.

And one more bug:

When using the "shift-enter" trick you mentioned above on equations in a table cell, if the block of equations would go across a page boundary, Word gets confused and prints the first equation on both pages.

My Word 2007 cannot display any equation in two or more lines even if "Professional" and "Change to Display" are selected. The content outside one line is clipped. I wonder if you know how to fix this.

Why can’t I just break lines by pressing enter in an equation where I want? Why make it unnecessarily complicated?

An earlier post describes math context menus (right click somewhere in a math zone) for changing the

The earlier post Breaking Equations into Multiple Lines describes equation line breaking and alignment.

It does not seem possible to prevent line-breaks after an "=" sign. If you have "a=b+c" and it lands near the end of the line, you will get blah blah a=

b+c

which looks awful. I have not found a way to say, do not break this equation.

In principle, you should be able to put the equation into a box (enclose it in box(…), where the … is the equation and use a context menu to specify no break. But unfortunately the context menu is missing.

box(…) does not work. It does no harm, but the equation is still broken after the "=". Continuing in this vein, I thought word might hesitate to break a subscripted object. I tried

(ABC=B+D)_zwsp

but it still breaks after the "=".

In normal text, we already have non-breaking spaces and dashes. but I guess a nonbreaking "=" has never seemed necessary.

What is a zwsp ? If you type it into an equation, it disappears, but produces no error. If you type zwsp into the help system, nothing is found.

zwsp is a zero width space, Unicode U+200B. It doesn’t display anything, but it is a character and can be used to suppress an empty argument dotted box. There’s more discussion in my post on

The Invisibles (http://blogs.msdn.com/murrays/archive/2008/08/26/the-invisibles.aspx)

box() should have a context menu that lets you specify no break, but it’s not there 🙁 So I don’t know how to prevent a break in Word 2007.

Hi!

I too am confused why I can not insert a line-break manually in an equation. This was no problem in the previous versions of word! Instead, I now end up with multiple "equation boxes".

For everyone who seriously need control on their equations (no breaks, controlled breaks, formatting etc.) you really need to look to LaTeX. It takes quite a bit of up-front effort if you have never used it, but it typesets math equations beautifully. Google is your friend, I recommend MikTeX as your search term (small caps works just fine.)

Actually it’s easy to insert a line break manually into an equation. Just right click on a binary or relational operator and a context menu appears with the option to insert a manual break. You can customize the break to be before/after/duplicated.

Note that typing Enter terminates both the equation and the parent text paragraph (see my post on the math paragraph). Typing Shift+Enter inside a display math zone terminates the equation and displays the place holder for another equation. The set of equations so entered can be aligned with respect to one another.

The reason for doing it this way is to provide very powerful inter/intra equation alignment, together with the overall measurement that stretches enclosing brackets to the full height of the broken expressions they contain. This feature is not available in [La]TeX: large brackets across broken equations have to be entered as a given size, e.g., bigg(, which may not match to what’s inside the brackets.

Shift + Enter doesn’t work for me. It still creates a new paragraph. How do I fit this?

Could you show the text that is required to create an alignment within an equation.

For example, under the "Bracket" menu, the first one under "Common Brackets" at the bottom.

I am trying to do a similar thing, but having no luck with the right alignment and the "tabs" that are used there.

You can enter the first example under "Common Brackets" using the linear format by typing into a math zone the following

f(x)={eqarray(-x, &x<0@x, &x≥0)close

See Sec. 3.19 Equation Arrays of the linear format paper (http://www.unicode.org/notes/tn28/UTN28-PlainTextMath-v2.pdf).

Basically the & is used alternately to space and to align as in TeX. The first & on a line is an align operator, since there’s an implied space operator at the start of the line. Sec. 3.19 gives a more complicated example.

Re Shift+Enter, that does start a new equation in a math paragraph provided you type the Shift+Enter within a math zone. Outside a math zone, Shift+Enter inserts a line break, but doesn’t end the paragraph.

I'm converting a Word 2003 document with equations over to Word 2010 and I'm going crazy trying to get alignment at equals to work as I re-enter in the equations by hand using the new equation capability. I've read all the blog posts and it's just completely hit or miss as to whether it works or not. My typical use case is as follows:

Have a one row table with two columns that spans the entire document width. The rightmost column is used for equation numbers. The left column is used to hold the equation and has a center tab set up that is centered on the page itself (3 inches in on a 6 inch wide page).

For each equation, I insert a tab, followed by the equation. I type in the first equation and then use the Shift+Enter as per the blogs. Enter a second equation, then Shift+Enter again. I can now select the = character in either of the last two lines, right-click, and get the context menu that allows me to "Align at this character". Doing so on the last two lines works great. But the first equation simply won't give me an "Align at this character" option when I select it's =.

If I delete the tab before the first equation, then it works, but then my equations are left aligned within the table column. Most of the times I can't even get a context menu that says "Align at -".

I've been googling and searching everywhere with no luck. The complete lack of any documentation in the Help is beyond belief. I type "equation" into the search and find one item that describes how to insert a new equation. I type "Change to display" to find out what that context menu choice means and get nothing. Where is any of this stuff documented?

I'm at the point where it would be faster to type it into LaTex. …

Have you tried selecting all three equations, right clicking to get the context menu, and then clicking on "Align at ="? That works for me.

I did. I finally chased the issue down to having the leading tab character within the cell. If I delete it, then I can do alignment and selecting all three works. But if I have the leading tab within the cell it looks like it treats it as inline and that's what's messing it all up. So I've now gone to a one row / 3 column table with the large center column holding the equation and centering it. This is working well, but I've now run into the issue noted in earlier comments when the table row spans two pages (because I have multiple equations in the row). Word is duplicating equation lines on both pages…

Sorry, to better answer your question, with the leading tab on the same line as the equation, there is no context menu option for "Align at =" after I multi-select all three equations.

It appears that once Word gets confused by the multiple equations in one table row spanning a page break, then all the subsequent equations in the document don't render the equation box correctly when clicking into the equation. The equation box shows up about half a line higher.

Ok, it's nice to know how to align multiple lines like that. But what about when it breaks inline equations at inappropriate places? Word seems to have a bug with determining 1) how much room is left to fit an equation, and 2) where acceptable places to break equations are. I've pulled this example from another forum, but I've encountered the same problem several times.

Suppose you have

blah blah blah (x + y)**n remainder of the equation blah2 blah2 blah2

If the blah blah blah is short enough, you get

(a)

blah1 blah1 blah1

(x + y)**n remainder of the equation blah2 blah2 blah2

if you add another blah1 you then get

(b)

blah1 blah1 blah1 blah1 (x +

y)**n remainder of the equation blah2 blah2 blah2

but another blah1 gets you

(c)

blah1 blah1 blah1 blah1 blah1

(x + y)**n remainder of the equation blah2 blah2 blah2

again.

(a) illustrates the first problem I described about space left, and (b) illustrates the second problem – you cannot break (wrap) the equation to another line in the middle of a set of parentheses.

You're right, there's a bug in Word's inline equation wrapping. I'll investigate. Thanks for the feedback.

Is it possible to have several alignment points ("Align at this character"), like you can have several &'s in the AmsTeX align environment?

I mean like this:

R0 = one thing x next thing x last thing

= a x b x c

= d

so that the equal signs are aligned, and the first x on the first line is aligned with the first x on the second line, the second x on the first line with the second x on the second line, etc.

Yes. I think I’ll do a blog post on it. The functionality is described in Section 3.19 of Unicode Technical Note #28,

Thank you, that is a very useful reference. I found that the following linear code produces almost the example I gave above, except that d is not aligned to the left of its "abstract box". For that I would have to find an appropriate value for n, but there is none listed as giving align left. I am not sure this would be implemented in MS Word, as the n& disappears automatically.

■(R0&=&"one thing"&×&"next thing"&×&"last thing"@" "&=&a&×&b&×&c@" "&=&□(n&d)&" "&" "&" "&" ")

Actually, I am looking for a way to align d to (a x b x c) taken as one thing, so that d would appear right below the middle of (a x b x c):

R0 = one thing x next thing x last thing

= a x b x c

= d

Looking forward to your blog!

Use the equation editor in WordPerfect. Just hit ENTER to go to the next line, then use the alignment symbol on whatever you want to align. Then, if you must, select the equation and drop it into Word. After that, you can edit in Word with the WordPerfect editor.

Hello,

I found a problem in Word 2010, so I would like to report bug:

Please, in Word 2010 type some expression with several relation operators in math zone (display mode), e.g. f(x)=a+b+c=d+e+f=g+h+i; "right click" on the second relation operator and choose the option "Insert Manual Break", then "right click" on the third relation operator and also choose the option "Insert Manual Break". Now, the equation is breaking into three lines. Then on ribbon click "Home Tab" and click several times on "Pi" in Paragraph section (or press several times "Ctrl+8"), the number of eqaution line and manual breaks change randomly.

The same problem happens also for binary operators.

I know it's an old thread but what the hell, someone will need it.

I had same problem someone here mentioned with preventing equation breaking. After unsuccessful googling, I come up with a possible workaround:

In new equation field insert 1×2 empty matrix, right click on it and select delete column from context menu, then enter your equation in remaining feald.

In my experience this should effectively disable equation breaking.