Labeling equations in IEEE format

L

leo23co

Hello. I study Electronics engineering. For writing articles or papers we
use the IEEE format, which implies writing in two columns. For writing an
equation, it must be centered in a column and in front of it, aligned to the
right, it should be the equation number between brackets. For example:
(left column margin)| F=ma (2)|(right column margin)

I really like the equations editor and the autolabeling option (Fig. 1.,
Table 1., etc.)

I'd like to know if there's a way of, first, auto labeling and numbering
formulas the way I showed you, just the number between brackets, and second,
of making this label (doesn't matter if it has to be done manually) get
aligned to the right, keeping the formula in the center and not altering the
size of that formula (when you write normal text next to a formula it reduces
in size).

I really thank you if you can help me with this. By the way, as a
suggestion, it would be good if the autolabeling format was more flexible in
giving a format to those labels (size, numbering, color, font, etc) because
it is actually really limited.
 
G

Graham Mayor

One possibility would be to create a paragraph style with a centre tab at
the centre and a right aligned tab at the right margin in your document
template. Set the font (size, type and colour) to that you require for the
numbering as the font for the style. Call that style 'Equation'.

To insert an equation then run the following macro

Sub InsertLabelledEquation()
With Selection
.Style = ActiveDocument.Styles("Equation")
.TypeText Text:=vbTab
.InlineShapes.AddOLEObject _
ClassType:="Equation.3", FileName:="", _
LinkToFile:=False, DisplayAsIcon:=False
.TypeText Text:=vbTab
.Fields.Add Range:=Selection.Range, _
Type:=wdFieldSequence, _
Text:="Equation \# ""(#)""", _
PreserveFormatting:=False
.Fields.Update
End With
ActiveWindow.View.ShowFieldCodes = False
End Sub

http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Suzanne S. Barnhill

The drawback to this approach is that a cross-reference to the equation
number will contain the entire equation (because the equation and caption
are in the same paragraph). Another approach is to create a three-column,
single-row borderless table. The right cell is just wide enough for the
equation number and the left cell (which is left empty) is the same width;
the equation can then be centered in the center cell. A sample dummy
equation, with caption, can be saved as an AutoText entry for ease of
insertion.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
B

Bob Mathews

MathType can do this automatically, and with tabs like Graham
suggested. Cross-references to equation numbers using MathType's
method don't contain the entire equation; they contain only the
equation number. MathType also creates a style that you can edit with
the font & size settings you want for your equation numbers. You can
format the numbers any way you want.

--
Bob Mathews
Director of Training
Design Science, Inc.
bobm at dessci.com
http://www.dessci.com/free.asp?free=news
FREE fully-functional 30-day evaluation of MathType
MathType, MathFlow, MathPlayer, MathDaisy, Equation Editor
 
G

Graham Mayor

Tables we can do, but the code is busier :)

Sub InsertLabelledEquation()
Dim oRng As Range
Dim oBorder As Border
Dim sLeft As String
Dim sRight As String
Dim sWidth As String
Dim sCell As String
sWidth = Selection.PageSetup.PageWidth
sLeft = Selection.PageSetup.LeftMargin
sRight = Selection.PageSetup.RightMargin
sCell = sWidth - sRight - sLeft - 60
With Selection
.Tables.Add Selection.Range, 1, 3
With .Tables(1)
.Borders(wdBorderTop).LineStyle = wdLineStyleNone
.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
.Borders(wdBorderRight).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
With .Cell(1, 1)
.Width = 36
.Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
End With
.Cell(1, 2).Width = sCell
With .Cell(1, 2).Range
.ParagraphFormat.Alignment = wdAlignParagraphCenter
.InlineShapes.AddOLEObject _
ClassType:="Equation.3", FileName:="", _
LinkToFile:=False, DisplayAsIcon:=False
End With
.Cell(1, 3).Width = 36
.Cell(1, 3).VerticalAlignment = wdCellAlignVerticalCenter
Set oRng = .Cell(1, 3).Range
With oRng
.ParagraphFormat.Alignment = wdAlignParagraphRight
.End = .End - 1
.Fields.Add Range:=oRng, _
Type:=wdFieldSequence, _
Text:="Equation \# ""(#)""", _
PreserveFormatting:=False
.Fields.Update
End With
With .Cell(1, 3).Range.Font
.name = "Times New Roman"
.Size = 12
.Color = wdColorBlue
End With
End With
End With
ActiveWindow.View.ShowFieldCodes = False
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
L

leo23co

Thank you all guys. I think a fast and easy solution is the one given by Yves
Dhondt. I like the fact also that it can be stored in the equations gallery.
That's exactly how I needed to solve the problem.

Thanks again.

Leonardo
 

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