WD: How to Insert a Caption Next to an Equation or Object

ID: Q123430

The information in this article applies to:

SUMMARY

Word does not offer a built-in method of automatically inserting a caption flush with the right edge of a document. Many scientific journals require equation objects to be either centered or left aligned and the caption to be on the same line, flush with the right margin, and the caption number enclosed in parentheses. This article explains how to achieve that format.

NOTE: This article uses the term "equation," but this method applies to any item (such as a figure or picture) where the caption needs to appear on the same line as the object.

Examples of scientific journal formats:

                              y = mx + b                            ( 1 )

- or -

y = mx + b                                                          ( 1 )

MORE INFORMATION

Setting Up the Caption

For either of the two alignment methods described below, use these steps to create the label with parentheses:

1. From the Insert menu, click Caption.

2. Select New Label.

3. In the Label box, type an opening parenthesis.

4. Choose OK.

5. In the Caption box, to the right of the number, type a space.

6. Type a closing parenthesis.

7. Choose OK.

Inserting Additional Captions

After you have created the new caption format, you can insert additional captions by following these steps:

1. From the Insert menu, choose Caption.

2. In the Caption box, to the right of the existing caption, type a

   space and a closing parenthesis.

3. Choose OK.

Aligning the Equation and Caption

Note that if you will be cross-referencing the caption number, method 2 is the preferred method.

Method 1:

Insert the caption. Move to the Start of the line. Set a right-aligned tab for the right margin. Insert the equation. Press the TAB key to move the caption to the right edge of the page.

Method 2:

Insert the Equation in a table. If you want the equation to appear on the left edge of the page, insert a two-column table. If you want the equation in the center of the line, insert a three-column table.

To position the equation on left margin:

1. Insert a two-column table.

2. Format the first cell (column) width to Auto.

3. Format the second cell (column) width to 0.5.

4. Insert the equation in the first cell.

5. Insert the caption in the second cell.

6. To center the equation:

    a. Insert a three-column table.

    b. Format the first and third cells (column) width to 0.5.

    c. Format the second cell (column) width to Auto.

    d. In the second cell, choose the Center button.

    e. Insert the equation in the second cell.

    f. Insert the caption in the third cell.

Method 3: Create a Macro that Automatically Runs Method 2

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

Sub MAIN
' This macro will prompt you to choose either Left Aligned or Centered
' for the equation object. The caption for this equation will be flush
' with the right margin or column. This macro will then launch Equation
' Editor.

   ScreenUpdating
   Begin Dialog UserDialog 280, 108, "Select Equation Alignment"
        OptionGroup  .OptionGroup1
             OptionButton 69, 14, 120, 16, "Left Aligned", .OptionButton1
             OptionButton 69, 31, 140, 16, "Center Aligned", .OptionButton2
        OKButton 40, 68, 88, 21
        CancelButton 145, 69, 88, 21
   End Dialog
   
   On Error Goto bye
   Dim dlg As UserDialog
   Dialog dlg
   
   choice = dlg.OptionGroup1
   Select Case choice
        Case 0
             x = 2
        Case 1
             x = 3
   End Select
   
   TableInsertTable .NumColumns = Str$(x), .NumRows = "1"
   
   If x = 2 Then        'For left aligned, insert a two cell table.
        NextCell
        CharRight 1, 1
        TableColumnWidth .ColumnWidth = "0.5", .PrevColumn
   ElseIf x = 3 Then    'For center aligned, insert a three cell table
        CharRight 1, 1
        TableColumnWidth .ColumnWidth = "0.5", .PrevColumn
        TableColumnWidth .ColumnWidth = "0.5", .PrevColumn
   EndIf
   
   TableColumnWidth .ColumnWidth = "Auto"
   NextCell
   InsertCaption .Label = "(", .Title = " )", .Position = 1
   RightPara
   PrevCell
   
   If x = 3 Then CenterPara
   InsertObject .Class = "Equation.2", .Caption = "Microsoft Equation 2.0"
   
   bye:
   ScreenUpdating
   
End Sub

MORE INFORMATION

Several methods exist for inserting captions. AutoCaption inserts a caption either above or below an inserted object; manually inserted captions appear above or below the object when the object is selected, or to the immediate right when the insertion point is to the right of the object.

For information about how to do this in later versions of Word, see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q158918
   TITLE     : WD97: How to Insert a Caption Next to an Equation or Object

REFERENCES

"Microsoft Word Developer's Kit," version 6.0, page 520

Additional query words: equations center centered align alignment position positioned figure photo picture pictures object objects graphic graph

Keywords          : kbole kbfield winword macword word6 word7 word95 
Version           : WINDOWS:6.0,6.0a,6.0c,7.0,7.0a;MACINTOSH:6.0,6.0.1,6.0.1a
Platform          : MACINTOSH WINDOWS
Issue type        : kbhowto

Last Reviewed: April 9, 1999