Creating Overbars

Home Tutorials My MVP FAQs Useful Links

 

How to create a character with a bar over it

Users often want to know how to create a bar or line over a character or word. There are several ways to do this; which way is best for you will depend on the application.

Long vowels

Arithmetic mean, shorthand characters

Upper borders on characters or words

Saving your creations for reuse

Long vowels

One reason for putting a “line,” “bar,” or “hyphen” over a character is to indicate a long sound. Although this could be done using an EQ field (as described in the next section) and a hyphen, this is not necessary in recent versions of Word. Modern Unicode fonts contain characters (both upper and lowercase) with both the macron (long mark) and breve (short mark), as well as a variety of other accents. These are located in the Latin Extended-A character subset of the Insert | Symbol dialog, as shown in Figure 1. (In Word 2007 and above, access this dialog by clicking on Symbol in the Symbols group on the Insert tab of the Ribbon and selecting More Symbols...)

The Symbol dialog showing characters with long and short marks

Figure 1. The Symbol dialog showing characters with long and short marks

Note that if you need to use these characters frequently, you can assign shortcut keys to them. For more on using the Symbol dialog, see “How can I insert special characters, such as dingbats and accented letters, in my document?

Arithmetic mean, shorthand characters

Another frequent request is for the “x bar” character (used to indicate the arithmetic mean in mathematics and statistics), shorthand characters such as c with a line over it (shorthand for “with”), and certain medical symbols.

The easiest way to create characters of this nature is to combine the character desired with the overbar character, which can be found in most fonts at ASCI 0175 or Unicode 00AF (in the Latin-1 character subset; see Figure 2). These characters can be combined using the EQ \O (overstrike) field.

The Symbol dialog showing the overbar character

Figure 2. The Symbol dialog showing the overbar character

There are two ways to create an EQ field (or any other field).

Direct composition

If you are comfortable with creating fields “by hand,” press Ctrl+F9 to insert the field delimiters (the characters that look like braces but cannot be typed from the keyboard) and type the required text between them. The syntax of the EQ field is well documented in the “Field codes: Eq (Equation) field” Help topic. Even if you choose to use the Field dialog to begin with, once you have inserted and edited a number of fields and become comfortable with the syntax, you may find it more efficient to create them from scratch.

The Field dialog

Using Insert | Field, you can select the EQ field and use the various buttons in the Field dialog to insert the required switch and arguments. Again, reference to the Help topic will guide you. In Word 2007/2010, access this dialog by choosing Field... from the Quick Parts menu on the Insert tab of the Ribbon.

The appearance of the Field dialog varies among Word versions. Figure 3 shows how it looks in Word 2002, 2003, and 2007.

The Field dialog for the Eq field in Word 2002/2003

Figure 3. The Field dialog for the Eq field in Word 2002/2003

When using the Insert | Field dialog, you may be tempted to click the button for Equation Editor… Don’t! The Equation Editor is a very helpful applet, but (a) it may not be installed on your machine, and (b) it is overkill for this task. Instead, click the Field Codes button, which will open the dialog shown in Figure 4.

The Field dialog reached by clicking the Field Codes button for the Eq field

Figure 4. The Field dialog reached by clicking the Field Codes button for the Eq field

In this dialog, click on the Options… button to reveal the dialog shown in Figure 5.

The Field Options dialog for the Eq field

Figure 5. The Field Options dialog for the Eq field

Click on the \O() switch as shown and click Add to Field, which will give the results shown in Figure 5. Between the parentheses, type the two characters you want superimposed, separated by a comma (semicolon if you use a comma as a decimal separator). In the case of the x bar, this will give the result shown in Figure 6.

The Field Options dialog for the Eq field with the \O switch and arguments entered

Figure 6. The Field Options dialog for the Eq field with the \O switch and arguments entered

Note that characters that cannot be entered from the keyboard (such as the overbar) can be inserted later by editing the field manually. You can also insert an overbar directly into the Field dialog by pressing Alt+0175 (using the keys on the numeric keypad only—not the top number row).

Click OK to close the Options dialog and OK again to close the field dialog. The field shown in Figure 7 will be inserted in your document. (The top version is the field code; the bottom one is the result.)

Eq field code and result inserted by the Insert | Field dialog

Figure 7. Eq field code and result inserted by the Insert | Field dialog

If you find that the overbar is too high or low to display properly, you can edit the field code by hand. Press Alt+F9 to display field codes, select just the overbar, and use the Format | Font dialog (as shown in Figure 8) to raise or lower the character. (In Word 2007/2010, access this dialog from the context (right-click, shortcut) menu or by using the dialog launcher arrow at the bottom right corner of the Font group on the Home tab.) Some trial and error will probably be required. Also see the Important Note below.

The Character Spacing tab of the Font dialog

Figure 8. The Character Spacing tab of the Font dialog

Other applications

The EQ \O field can be used to superimpose other characters besides the overbar. It is almost always possible to find a made-up font character for most accented letters, but if a nontraditional one is needed, it can be created with this field. Similarly, users sometimes want a slashed zero, which can be created by combining the zero and slash characters:

{ EQ \O (0,/) }

The behavior of this field in mathematical calculations may not be as expected. A better solution is to find a font in which the zero is already slashed.

Important Note: One peculiarity of the EQ field that does not seem to affect any other field is that the trailing space that is automatically included in the field is carried over to the field result. Users who create a slashed zero often complain that it doesn’t align properly with other digits. If they had nonprinting characters displayed, they would see that this is because of the extraneous space (which can be seen in Figure 7). Luckily, this problem is easily solved by deleting the final space from the field.

Upper borders on characters and words

The same EQ field can be used to create lines over characters and words in a different way by using a different switch, the \X switch. To get an idea of the results of this field, try this experiment:

  1. Select a character, word, or phrase in a body of text.
  2. Go to Format | Borders and Shading and, making sure that “Text” is selected in the “Apply to” box, click on Box in the panel on the left (see Figure 9). (In Word 2007/2010, access this dialog from the menu you get when you click on the arrow beside the Border button in the Paragraph group on the Home tab of the Ribbon. You can also apply a border to selected text by choosing Outside Border on this menu.)

The Borders and Shading dialog showing a box border around text

Figure 9. The Borders and Shading dialog showing a box border around text

  1. Click OK.

You will see that you have created a box around the selected text, as shown in Figure 10.

Text with a box border around it

Figure 10. Text with a box border around it

The Borders and Shading dialog is deceptive here; it appears that you can apply a border to selected sides of words, but in fact what you get is always a box. This can be very useful (for one application, see the “Other applications” section below), but it’s not always what you want. Using the EQ \X field, you actually can apply a border to selected sides.

This field can be constructed in the same two ways described above, by direct composition or using the Insert | Field dialog. Refer to that section for instruction on using the dialog. There are only two things you do differently in constructing this field.

Different arguments

What goes between the parentheses is the text to which you want to apply a border. You can copy and paste this into the dialog if desired (using Ctrl+V to paste).

Extra switches

The EQ \X field accepts four additional switches.

\to        Draws a border above the element

\bo       Draws a border below the element

\le        Draws a border to the left of the element

\ri         Draws a border to the right of the element

If you do not include any of these switches, you will get a border on all four sides of the text (similar to the box you got using the Borders and Shading dialog). Obviously, if you want a line over a character or word, you need to use the \to switch. Note that the weight of the line and the distance from text cannot be changed (the distance from text cannot be changed in the Borders dialog, but the line weight and style can be edited).

Other applications

The EQ \X field with the \bo switch offers an alternative to underlining for drawing a line under text. In some fonts where the underline is too close to the text, this can be helpful for text that needs to be underlined. Note, however, that headings underlined this way will not be picked up by an automatically generated table of contents (TOC field).

One of the most useful applications of this field (which can also be accomplished, with some effort, using the Borders and Shading dialog) is to create an empty check box for a printed form. I find this much more satisfactory than any of the box characters available in any font. Approximately three spaces between the parentheses in the field will create a square box, but note that the trailing space will need to be removed from the field (see Important Note above).

The secret to creating a similar box using the Borders dialog is to use at least one nonbreaking space (Ctrl+Shift+Spacebar) since Word will not put a border on ordinary spaces. Figure 11 shows the results of these two methods. Note that the box created using Borders is better proportioned to the font size and won’t affect line spacing; the point size of the box created with the EQ field will need to be reduced to maintain the line spacing.

Text borders created by the EQ \X field and the Borders dialog

Figure 11. Text borders created by the EQ \X field and the Borders dialog

Saving your creations for reuse

No matter which method you use to create a character with a line over it, you can save the result as an AutoText or AutoCorrect entry for ease of future insertion.

This article copyright © 2004, 2008, 2011, 2014 by Suzanne S. Barnhill.