DetailPage-MSS-KB

Microsoft small business knowledge base

Article ID: 212381 - Last Review: November 23, 2006 - Revision: 1.3

This article was previously published under Q212381

On This Page

SUMMARY

Microsoft Word does not offer a built-in method for automatically inserting a caption that is right-aligned with the right margin of a document. Many scientific journals require equation objects to be in one of the following formats:
  • The equation and caption are right-aligned,

                                            y = mx + b ( 1 )
    						
    -or-
  • The equation is centered and the caption is right-aligned,

                          y = mx + b                   ( 1 )
    						
    -or-
  • The equation is left-aligned and the caption is right-aligned.

     y = mx + b                                        ( 1 )
    						
In any case, the caption number is enclosed in parentheses and is right-aligned.

This article describes several methods that you can use to format equation objects in one of these styles.

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

MORE INFORMATION

Follow these steps to create a caption as described in the "Summary" section of this article:

Step 1: Setting Up the Caption

To create the caption label with the parentheses, follow these steps:
  1. In Microsoft Word, on the Insert menu, click Caption.
  2. Click New Label.
  3. In the Label box, type an opening parenthesis.
  4. Click OK.
  5. In the Caption box, to the right of the number, type a space, and then type a closing parenthesis.
  6. Click OK.
After you create the caption format, you can insert additional captions. To insert additional captions, follow these steps:
  1. On the Insert menu, click Caption.
  2. Change the Label box to the opening parenthesis.
  3. In the Caption box, to the right of the existing caption, type a space, and then type a closing parenthesis.
  4. Click OK.

Step 2: Aligning the Equation and the Caption

NOTE: If you intend to cross-reference the caption, use Method 2, Method 3, or Method 4.

Method 1: How to Set a Right-Aligned Equation and Caption Number

  1. On the Insert menu, click Caption.
  2. In the Label list, select the open parenthesis. In the Caption box, type a space, type a closing parenthesis, and then click OK.
  3. In the Word document, move the insertion point to the beginning of the line, before the caption.
  4. Set a right-aligned tab at the right margin. For example, if the right margin is six inches from the left margin, set the right-aligned tab at six inches by doing the following:
    1. On the Format menu, click Tabs.
    2. In the Tab stop position box, type 6.
    3. Under Alignment, click Right, and then click OK.
  5. Press the TAB key to move the caption to the right edge of the page.
  6. Insert the equation in the document.

Method 2: How to Set a Left-Aligned Equation

  1. On a new, blank line, insert the equation.
  2. Quit Equation Editor by clicking anywhere in the document area.
  3. Press the TAB key, and then insert the caption.
  4. Select the entire line containing the equation and caption. On the Table menu, click Convert Text to Table. The selection is converted to a two-column table.
  5. Remove the border around the table by doing the following:
    1. Move the insertion point into any cell of the table. On the Table menu, point to Select, and then click Table.
    2. On the Format menu, click Borders and Shading.
    3. Under Setting, click None.
    4. Click OK.
  6. Select the table cell that contains the caption, and then click the Align Right button on the Formatting toolbar.

Method 3: How to Set a Center-Aligned Equation

  1. On a new, blank line, press the TAB key, and then insert the equation.
  2. Quit Equation Editor by clicking anywhere in the document area.
  3. Press the TAB key, and then insert the caption.
  4. Select the entire line containing the equation and caption. On the Table menu, click Convert Text to Table. The selection is converted to a three-column table.
  5. Remove the border around the table by doing the following:
    1. Move the insertion point into any cell of the table. On the Table menu, point to Select and click Table.
    2. On the Format menu, click Borders and Shading.
    3. Under Setting, click None.
    4. Click OK.
  6. Select the table cell containing the equation, and click the Center button on the Formatting toolbar.
  7. Select the table cell containing the caption, and click the Align Right button on the Formatting toolbar.

Method 4: How to Create a Microsoft Visual Basic for Applications Macro

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 a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:

Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104)

Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice)

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms)
For more information about how to use the sample code in this article, click the article number below to view the article in the Microsoft Knowledge Base:
212536  (http://support.microsoft.com/kb/212536/EN-US/ ) OFF2000: How to Run Sample Code from Knowledge Base Articles
Create a macro that will allow you to select between left-aligned or center-aligned as outlined in both Method 2 and Method 3. After you run this macro, insert your equation in the appropriate location.

Sub CaptionRight()

   Dim Align As Integer
   On Error GoTo Bye

   ' If insertion point is in a table, show message and end macro.
   If Selection.Information(wdWithInTable) Then
      MsgBox "You are in a table. Please move outside of the " _
         & "table to run this macro.", vbInformation
      GoTo Bye
   End If

   ' Ask whether to center or left align equation.
   Align = MsgBox("Would you like the Equation to be " & "centered? " _
      & "(Selecting No will left-align the " & "Equation.)", vbYesNoCancel)

   If Align > 2 Then
      Selection.InsertParagraphAfter
      Selection.Collapse Direction:=wdCollapseEnd
      W = ActiveDocument.PageSetup.PageWidth
      L = ActiveDocument.PageSetup.LeftMargin
      R = ActiveDocument.PageSetup.RightMargin
      RTMarg = W - R - L
      CaptionLabels.Add Name:="("

      If Align = 6 Then
         tblT1 = Selection.Tables.Add(Selection.Range, 1, 3)
      Else
         tblT1 = Selection.Tables.Add(Selection.Range, 1, 2)
      End If

      tblT1.Select

      With Selection
         ' Do this if Center-align selected.
         If Align = 6 Then
            .Columns(1).Cells.Width = 50.4
            .Columns(3).Cells.Width = 50.4
            .Columns(2).Cells.Width = RTMarg - 100.8

            'Represents 1.5" in Points
         Else
         ' Do this if Left-align selected.
            .Columns(2).Cells.Width = 50.4
            .Columns(1).Cells.Width = RTMarg - 50.4
            'Represents .75" in Points
         End If

         .InsertCaption Label:="(", _
            Position:=wdCaptionPositionBelow, Title:=" )"
         .HomeKey unit:=wdLine, Extend:=wdExtend
         .Cut
         .MoveRight unit:=wdCharacter, Extend:=wdExtend
         .Delete
         .MoveLeft unit:=wdCharacter, Count:=2
         .Paste
         .Rows(1).Select

        ' Set the table borders to None.
         For Each x In Selection.Borders
            x.LineStyle = wdLineStyleNone
         Next x

         .Borders.Shadow = False
         .Cells(9 - Align).Select
         .ParagraphFormat.Alignment = wdAlignParagraphRight
         .Cells(1).VerticalAlignment = wdCellAlignVerticalCenter
         .Font.Bold = True
         .Rows(1).Select

         If Align = 6 Then
            .Cells(2).Select
            .ParagraphFormat.Alignment = wdAlignParagraphCenter
            .InlineShapes.AddOLEObject ClassType:="Equation.3", _
               FileName:="", LinkToFile:=True, DisplayAsIcon:=False
         Else
            .Collapse
            .InlineShapes.AddOLEObject ClassType:="Equation.3", _
               FileName:="", LinkToFile:=True, DisplayAsIcon:=False
         End If
      End With
   End If

Bye:

End Sub
				
Several methods exist for inserting captions. AutoCaption inserts a caption either above or below an inserted object; manually inserted captions are placed 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.

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:
212623  (http://support.microsoft.com/kb/212623/EN-US/ ) WD2000: Macro Programming Resources
226118  (http://support.microsoft.com/kb/226118/EN-US/ ) OFF2000: Programming Resources for Visual Basic for Applications

APPLIES TO
  • Microsoft Word 2000
Keywords: 
kbdtacode kbfield kbhowto kbinfo kblayout kbusage KB212381
Share
Additional support options
Ask The Microsoft Small Business Support Community
Contact Microsoft Small Business Support
Find Microsoft Small Business Support Certified Partner
Find a Microsoft Store For In-Person Small Business Support