h1

Word: Adding a bar over a letter

July 2, 2010

I learnt a new word the other day: macron. So, what’s a macron? It’s a bar or line over the top of a word or letter, such as those used to indicate the mean in mathematical equations.

And why did I learn this word? Because Stephanie, one of my team’s authors, wanted a line over the top of her capital D. She could get the line using Microsoft Word’s equation editor, but as she had to define what the D with the overbar/overline/overscore meant, she wanted to insert it into the Terms list too. However, it wouldn’t copy properly. So she asked me.

Equations are one of the few areas in Word that I’ve never tackled, so, as I told Steph, it was all a new experience for me. I confirmed that copying the D with the overbar was problematic when I used the equation editor, so I figured there had to be another way to get a line on top of a letter. And there is. In fact, there are several ways and the method you choose should be the one that gives you the result you’re looking for, taking into account your circumstances (e.g. will you have to copy from one document to another? is the method easy for you to use/remember? do you have to create a lot of these? is the font important?).

I Googled the problem and after some hunting around I discovered some great resources (listed at the end of this post), and discovered that the line over the top of a letter is called a ‘macron’. Armed with that little piece of information, back to Google, where I found out more about this beastie.

Please note: Some letters already have a macron built-in. Check the Windows Character Map (Start > All Programs > Accessories > System Tools > Character Map on Vista)  or use a program such as BabelMap to see if there’s an existing character you can use — if there is, use that as it’s the quickest and simplest method. If your letter doesn’t have an existing character (D doesn’t), you’ll have to create it yourself, which is what the rest of this article is about.

The methods below show how to create your own letter with a macron (I’ll use D as the example). I’ve used Word 2007 in these instructions, but Word 2003 is similar for the most part.

Method 1: Use Word’s Equation Editor

Option 1: Use a built-in accent character

  1. Go to the Insert tab > Symbols group (far right), then click Equation.
  2. Select Insert New Equation from the bottom of the list.

    This opens the Equation Tools > Design tab and puts a Type equation here box into your document.
  3. Click Accent on the Design tab > Structures group.
  4. Scroll down past the Boxed Formulas section to the Overbars and Underbars section.
  5. Click the Overbar icon.

    You’ll see something like this in your document:
  6. Click in the dashed box, then type D.
  7. Click outside the equation box to hide it; you can show it again by clicking on the D with the macron.

Your character will look like this:

Option 2: Create your own

  1. Go to the Insert tab > Symbols group (far right), then click Equation.
  2. Select Insert New Equation from the bottom of the list. This opens the Equation Tools > Design tab and puts a Type equation here box into your document.
  3. Type D in the equation box, then select it.
  4. Click Accent on the Design tab > Structures group.
  5. Click the Bar icon.

    You’ll see something like this:
  6. Click in the dashed box, then type D.
  7. Click away from the equation box to hide it; you can show it again by clicking on the D with the macron.

Your character will look like this:

Note that the macron created using this option is slightly narrower than that created using the built-in accent (above), and is closer to the top of the letter.

Advantages:

  • Quick and easy
  • You get a properly formatted macron over the letter

Disadvantages:

  • You may not be able to change the font (I wasn’t able to change it from Cambria Math)
  • If you copy this equation from one Word document to another, you must remember to select Keep Source Formatting as soon as you paste it, otherwise the letter and its macron are treated as two separate characters.

Method 2: Use Word’s Equation field, with switches

To use this method, you need to know the character code to create a macron. If you have a numeric keypad, it’s Alt+0175; if you have a keyboard without a numeric keypad, it’s 00af (they are zeros) followed immediately by Alt+x. Test these key combinations in your document first to make sure you can create the macron successfully with the keyboard.

Option 1: Using the built-in field codes and switches

  1. Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
  2. Select Field.
  3. Scroll down the list of Field names and select Eq.
  4. Click Field Codes.
  5. Click Options.
  6. Select the \O() switch, then click Add to Field.
  7. In the Field codes: EQ Instructions box, type D,<macron_code> between the parentheses.
    The <macron_code> is the key combination you tested earlier to see if it worked — either Alt+0175 on the numeric keypad, or 00af followed by Alt+x. Make sure you also insert the comma between the D and the macron.
  8. Click OK to close the Field Options dialog box.
  9. Click OK again to close the Field dialog box.

Your letter with its macron should look like that below (I have field shading turned on); change the font if you don’t see the macron:

Option 2: Using the built-in field codes and Equation Editor

  1. Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
  2. Select Field.
  3. Scroll down the list of Field names and select Eq.
  4. Click Equation Editor.
  5. A text box is added to the document, along with a floating Equation toolbar.
  6. Click the Overbar icon, then the icon for the bar.
  7. Type the letter D in the text box.
  8. Close the Equation toolbar, then click away from the text box.

You should see something like this:

Option 3: Create your own field

  1. Press Ctrl+F9 to insert an empty field.
  2. Type EQ<space>\O (D,<macron_code>) between the curly brackets of the field.
  3. Right-click on the field, then select Toggle Field Codes to show the result:

Advantages:

  • Quick and relatively easy

Disadvantages:

  • Some fonts, such as Calibri (Body), do not display the macron. If you don’t see the macron over the letter, try changing the font — Arial, Times New Roman (TNR), Courier New all work; however, TNR puts the macron very close to the top of the D, making it hard to read. You’ll need to experiment with fonts.
  • You need to know how to create a macron using the keyboard.
  • You should have a basic understanding of field codes and switches.

Method 3: Create a box around the letter showing only the top border

  1. Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
  2. Select Field.
  3. Scroll down the list of Field names and select Eq.
  4. Click Field Codes.
  5. Click Options.
  6. Select the \X() switch, then click Add to Field.
  7. In the Field codes: EQ Instructions box, type D between the parentheses.
  8. Next, type a space after the X followed by \to (for ‘top border’) then another space.
  9. Click OK to close the Field Options dialog box.
  10. Click OK again to close the Field dialog box.

Your letter with its macron should look like that below; change the font if you don’t see the macron:

Advantages:

  • Quick and relatively easy

Disadvantages:

  • You end up with a large space after the letter so if it’s to be part of a word, it will look strange
  • You get a longer line over the letter.
  • You should have a basic understanding of field codes and switches.

Method 4: Cheat!

Seriously. Sometimes we can overthink stuff, and if it’s a one-off and you’re limited for time, using a workaround may be your best option.

  1. Either create a graphic of what you want using graphics software, or take a screen capture of the full equation then crop it to show just what you want.
  2. Insert the graphic into the document.

Advantages:

  • Quick and easy if you know how to use graphics and/or screen capture software
  • Useful if you only have to do a few

Disadvantages:

  • Can’t be edited easily if you need to change the letter in the graphic — you may have to create a new graphic or screen shot

See also:

[Links last checked July 2010]

39 comments

  1. Thanks so much… tutorial was very helpful.


  2. Thank you! Very helpful :-)


  3. Thank you very much. This tutorial has been very helpful to me. After looking for a solution for more than an hour, I finally got it hear. Big up!!


  4. Thanks so much! Yours was THE ONLY tutorial that helped me figure out how to type the x-bar for the “mean”. Thanks again!


  5. Using the combining overline is much easier:
    Insert > Symbol
    Go down to Unicode character code 0305 (in the “Combining Diacritical Marks” subset). Wherever you insert combining characters, it will combine with the previous character.

    http://en.wikipedia.org/wiki/Combining_character

    http://en.wikipedia.org/wiki/Overline


  6. Wow! Thanks for those links, JCB. I didn’t know you could do that — it’s what I wanted all along, but had to use other cludgy approaches to achieve.

    –Rhonda


  7. The first method about how to place a bar over a letter (a versal) is excellent, also in microsoft XP, when I use word. – However, when I change the document into html, both the bar and the letter under it will disappear. – Anyone who knows how to place a bar over a letter in thml, or how to retain a bar when a word document is changed into the html format?

    Max


  8. Hi Max

    That Wikipedia article on macrons has a list of the various HTML entities to use to create one (long, short, medium as well as over or under): http://en.wikipedia.org/wiki/Macron (it in the table near the bottom of the page).

    –Rhonda


  9. THANKS!


  10. Thanks a million – on my 2011 mac word – I finally found the equation option under “document elements” – after that it was just as you described.


  11. There is an even better way to get a bar over a letter! All you have to do is type in $\bar{D}$ to have it reproduce a D with a bar over it! Of course this can only be done in LaTeX editors, something that Microsoft Word could never hold a light to…


  12. Yes, this tip has helped me!


  13. thanks dude


  14. excellent 1000 times thank you


  15. I think I was the first who asked about how to make a bar above a letter, and in particular, a bar above a capital. – While the techniques I learned were perfect as long as I wrote in Word, in the same moment I posted my text (and it was transformed to html), both the bar and the letter totally disappeared. – I have understood that the only reasonable solution is to abstain from special symbols and instead write “not-A”.


  16. Hi Max

    Back in Sept 29, 2011, I answered your comment on this post re HTML by referring you to the Wikipedia article that tells you what HTML entity to use. Didn’t that work?

    –Rhonda


  17. I have used so much time for this problem, and what is more serious, I have had to waste as much time for two other people, and whatever recommendation I apply, the same error will return. Greetings. Max


  18. I searched this tutorial to further do some work, like have one equation and there is one bar below the equation. Now i want to add text below the bar. How to do that?


  19. I loved your method one. I tried the 2nd one first, because someone else had described it – after 2 days of searching – the second method seemed to keep the over bar too high. The first method was so easy and I could save it.

    You are a true blessing. I will direct others to this site as I saw many people looking to do this, especially nurses and therapists in the health field.

    Thanks so much again.


  20. The easiest method is to use the feature that defines the spacing between 2 characters (in font, under spacing). You can make any 2 characters (or more) overlap. So you can make a superscript bar overlap with any letter.


  21. There is a much easier way. In equation editor, type “D” followed by “\bar” and hit the space bar. Voila. There are many such shortcuts that make it easy and intuitive to enter equations. To see them, in Word go to File->options->proofing->auto correction options ->math autocorrect.


  22. To make there’s no confusion, enter “D\bar” and hit space bar twice. Also, you can get into equation editor easily by holding down Alt while pressing =


  23. Thanks, I struggled alot. You helped me


  24. It’s a very good suggestion. Thanks a lot for helping.


  25. Thank You mate!


  26. Many thanks


  27. Thanks so much ik who to do it now


  28. thanku sir it really helps so much


  29. “Method 1: Disadvantage: You may not be able to change the font (I wasn’t able to change it from Cambria Math)”

    I realized you could change the font after you select your “overbarred” letter and click on “Normal Text” in the “Equation Tools” tab.
    So that’s one less disadvantage for Method 1, and thanks for sharing this!


  30. Thanks, Quikson!


  31. great thanks very much


  32. Thank you very much!


  33. thank you!


  34. Thank you very much!


  35. Awesome! Thanks so much! You´re the guy!


  36. excellent help. Thanks


  37. thank you! it really helps.


  38. thanks.


  39. Hi,
    I knew about the insert equation. However, I need to add the bar accent on the heading 1 (on c letter) title of my thesis. Tried the equation but the letter with bar accent does not appear in my table of content. The field method suggested here however appeared. Many many many thanks.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 346 other followers

%d bloggers like this: