How do I prevent an equation from breaking across a line?

G

Gabriel

In Word 2007 I have a math equation in a paragraph, and I want to prevent it
from breaking across a line. I.e. I want it to stay in one "piece". Is there
a way to do this?
 
G

grammatim

If you've simply typed it (as opposed to using Equation Editor), then
use Non-Breaking Space instead of an ordinary space. (Type Ctrl-Shift-
Space)
 
P

Peter Jamieson

If you are using the Word 2007 equation editor, something that seems to
work here is
a. in the Developer tab, insert a rich text content control
b. copy/paste your equaiton into that.

no idea if it works for real

Peter Jamieson

http://tips.pjmsn.me.uk
 
G

Gabriel

Equations still get split, even if they are inside a rich text content control.

Thx anyway,
 
P

Peter Jamieson

Sorry about that. I don't know much about the equation editor in Word
2007, and perhaps it is well-known behaviour, but I do find it strange
that if 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.

In other words, there is plenty of space to contain the entire equation
without wrapping on the second line in all three cases, but only in case
(b) does the equation wrap. Why not in case (a)? It would be nice to
imagine there's a clue to a workaround there but if so, I can't see it.
My suspicion is that there's probably an error in the calculation of the
text width somewhere in there. The documentation for the relevant
properties dialog box is utterly useless and even the feedback mechanism
has become a time-waster.

Peter Jamieson

http://tips.pjmsn.me.uk
 
G

grammatim

If you drag the side of the enclosing box outward, does it go back to
one line? Can you find an option to turn off "shrink-wrapping," or
whatever it might call that feature?
 
Y

Yves Dhondt

Gabriel said:
In Word 2007 I have a math equation in a paragraph, and I want to prevent
it
from breaking across a line. I.e. I want it to stay in one "piece". Is
there
a way to do this?

As far as I can tell, the Word 2007 user interface does not have any
possibility to set such an option although Open Xml does.

Luckely, the underlying object model of Word 2007, which is a much closer
representation of Open Xml, gives you more power.

You can try the following macro. It will present you with a new equation
with a small dotted box inside, you have to type/copy your equation inside
that box. The box should not split lines.

Yves
================================
Public Sub BoxedMath()
Dim om As OMath
Dim omf As OMathFunction

' Insert a new equation
WordBasic.EquationInsert

' Set the object
Set om = Selection.OMaths(1)

' Insert a box function
Set omf = om.Functions.Add(om.Range, wdOMathFunctionBox)

' Set the box properties to noBreak.
omf.Box.NoBreak = True

End Sub
================================
 
Joined
Apr 8, 2022
Messages
1
Reaction score
0
The only way which works: copy and paste your equation inside a **white/background colored** formula text box. The text box is located in "Structures" Tab > "Accent" dropdown menu > "Boxed formulas".
In Word 2007 I have a math equation in a paragraph, and I want to prevent it
from breaking across a line. I.e. I want it to stay in one "piece". Is there
a way to do this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top