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

Zavrnitev odgovornosti za umaknjeno vsebino KB

Ta članek govori o izdelkih, za katere Microsoft ne ponuja več podpore. Zato je ta članek na voljo »tak, kot je«, in ne bo več posodobljen.

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:
    1. Insert a three-column table.
    2. Format the first and third cells (column) width to 0.5.
    3. Format the second cell (column) width to Auto.
    4. In the second cell, choose the Center button.
    5. Insert the equation in the second cell.
    6. 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 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

Microsoft Advisory Services - 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
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
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:

158918 WD97: How to Insert a Caption Next to an Equation or Object

References

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

ID članka: 123430 – Zadnji pregled: 13. jul. 2009 – Revizija: 1

Povratne informacije