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 below) 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. Two methods are presented here.

Combining diacritics

Erick Groot has pointed out a more elegant approach for creating these characters than the field solution described below. The Combining Diacritical Marks character subset in the Symbol dialog contains two characters that can be used to add a line over most alphanumeric symbols. Unicode character 0304, the Combining Macron, is suitable for lowercase letters, while U0305, the Combining Overline (highlighted in Figure 2 below), is suitable for uppercase characters and numbers.

Figure 2. The Symbol dialog showing combining diacritical marks

As the name suggests, these characters combine with others; specifically, when one is inserted, it combines with the previous character. There are several ways to insert either character.

  •  In general, any Unicode character can be inserted in Word (as the dialog shows) by typing the Unicode glyph number and then pressing Alt+X. Unfortunately, this does not work for these characters because the Unicode number must be freestanding (must be preceded by a space), and that results in a line over the space instead of the desired character.

  •  If you click the Shortcut Key... button, you can assign a custom shortcut key to either character.

  •  The characters can also be inserted directly from the keyboard. You may be aware that ASCII characters can be inserted using the numeric keypad by pressing Alt+0xxx, where xxx represents the ASCII number (decimal value) of the character; that is, press the Alt key while typing the ASCII number on the numeric keypad (with NumLock enabled). Unfortunately, Word's Symbol dialog displays ASCII characters only in the range of 32 through 255. In order to insert Unicode characters above this range, you must convert the hexadecimal Unicode values to decimal values (you can use a converter such as the one here). Erick Groot discovered that the decimal values needed to insert these characters by this method are 0772 (Combining Macron, U0304) and 0773 (Combining Overbar, U0305). So you can insert them using Alt+0772 and Alt+0773.

  •  Needless to say, you can insert the character directly from the Symbol dialog. This is probably the easiest way. In any version of Word, when you insert one of these characters, it will be added to the list of “Recently used symbols” (a list that gets longer as you drag the Symbol dialog wider); in Word 2007 and above, it will be added to the palette of symbols displayed by the Symbol button on the Insert tab (this palette always contains just 20 symbols).

EQ field

If for some reason the combining diacritics described above are not satisfactory (or are not present in the font you are using), another 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 3). These characters can be combined using the EQ \O (overstrike) field. (As noted below, this method has other applications, which are elaborated further in the article on “Superimposing Characters.”)

The Symbol dialog showing the overbar character

Figure 3. The Symbol dialog showing the overbar (macron) 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 4 shows how it looks in Word 2002, 2003, and 2007.

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

Figure 4. 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 5.

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

Figure 5. 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 6.

The Field Options dialog for the Eq field

Figure 6. 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 6. 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 7.

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

Figure 7. 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 8 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 8. 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 9) 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 9. 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 8). 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 10). (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 10. 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 11.

Text with a box border around it

Figure 11. 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 12 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 12. 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, 2015 by Suzanne S. Barnhill.