Word: Adding a bar over a letter
July 2, 2010I 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 and later versions of Word is similar for the most part.
Easiest ever method!
September 2018: Anik8G, a commenter on this post, shared his solution and it’s super easy. You can probably ignore all other solutions and use his. He has a short YouTube video that describes what he does: https://www.youtube.com/watch?v=3_h7ukThU_4, but you’ll likely need a little more information for it to work.
His solution uses the built-in Math AutoCorrect feature, which you need to turn on if it’s not already on. It’s under File > Options > Proofing. Click the AutoCorrect Options button, then select the Math AutoCorrect tab and check the two check boxes.
Look at the Replace and With lists, and note down the Replace string you want to add over your letter (in this example, I needed \bar). Click OK and get back to your document. Now, type your letter, followed immediately by the Replace string, then a space. For my example, I typed D\bar<space> and that automatically added a bar over the top of the letter. Just brilliant!
Method 1: Use Word’s Equation Editor
Option 1: Use a built-in accent character
- Go to the Insert tab > Symbols group (far right), then click Equation.
- 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.
- Click Accent on the Design tab > Structures group.
- Scroll down past the Boxed Formulas section to the Overbars and Underbars section.
- Click the Overbar icon.
You’ll see something like this in your document:
- Click in the dashed box, then type D.
- 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
- Go to the Insert tab > Symbols group (far right), then click Equation.
- 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.
- Type D in the equation box, then select it.
- Click Accent on the Design tab > Structures group.
- Click the Bar icon.
You’ll see something like this:
- Click in the dashed box, then type D.
- 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
- Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
- Select Field.
- Scroll down the list of Field names and select Eq.
- Click Field Codes.
- Click Options.
- Select the \O() switch, then click Add to Field.
- 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.
- Click OK to close the Field Options dialog box.
- 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
- Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
- Select Field.
- Scroll down the list of Field names and select Eq.
- Click Equation Editor.
- A text box is added to the document, along with a floating Equation toolbar.
- Click the Overbar icon, then the icon for the bar.
- Type the letter D in the text box.
- Close the Equation toolbar, then click away from the text box.
You should see something like this:
Option 3: Create your own field
- Press Ctrl+F9 to insert an empty field.
- Type EQ<space>\O (D,<macron_code>) between the curly brackets of the field.
- 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
- Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
- Select Field.
- Scroll down the list of Field names and select Eq.
- Click Field Codes.
- Click Options.
- Select the \X() switch, then click Add to Field.
- In the Field codes: EQ Instructions box, type D between the parentheses.
- Next, type a space after the X followed by \to (for ‘top border’) then another space.
- Click OK to close the Field Options dialog box.
- 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.
- 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.
- 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:
- https://wordribbon.tips.net/T004314_Overlining_Characters.html
- BabelMap — 100,000+ Unicode characters: https://cybertext.wordpress.com/2009/08/14/all-100k-unicode-characters-and-more/
- Suzanne Barnhill’s excellent article on creating overbars: http://wordfaqs.ssbarnhill.com/Overbar.htm (Suzanne is a Microsoft Word MVP)
- Wikipedia article on macrons: https://en.wikipedia.org/wiki/Macron_(diacritic)
[Links last checked September 2018]
Thanks so much… tutorial was very helpful.
by M J February 14, 2011 at 10:59 amThank you! Very helpful :-)
by nsv501@york.ac.uk February 15, 2011 at 8:39 pmThank 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!!
by MSC Masters June 17, 2011 at 1:30 amThanks so much! Yours was THE ONLY tutorial that helped me figure out how to type the x-bar for the “mean”. Thanks again!
by Olgy July 23, 2011 at 2:32 amUsing 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
by JCB July 28, 2011 at 10:59 pmhttp://en.wikipedia.org/wiki/Overline
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
by Rhonda July 29, 2011 at 7:34 amThe 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
by Max Scharnberg September 29, 2011 at 5:35 amHi 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
by Rhonda September 29, 2011 at 5:59 amTHANKS!
by Tamar October 6, 2011 at 10:31 amThanks a million – on my 2011 mac word – I finally found the equation option under “document elements” – after that it was just as you described.
by layne October 16, 2011 at 10:40 pmThere 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…
by Matthew Tiger November 2, 2011 at 2:09 amYes, this tip has helped me!
by Bill Balvanz January 13, 2012 at 6:47 amthanks dude
by gova sura February 13, 2012 at 9:39 pmexcellent 1000 times thank you
by jai February 15, 2012 at 1:53 amI 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”.
by Max Scharnberg February 15, 2012 at 4:32 amHi 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
by Rhonda February 15, 2012 at 6:06 amI 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
by Max Scharnberg February 15, 2012 at 7:15 amI 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?
by Waqar Younas March 10, 2012 at 4:36 amI 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.
by Christine March 31, 2012 at 12:55 amThe 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.
by Mariza Cabral April 12, 2012 at 9:33 amThere 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.
by Brian May 1, 2012 at 3:22 amTo 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 =
by Brian May 1, 2012 at 3:32 amThanks, I struggled alot. You helped me
by Mpoki Mwaikokesya July 14, 2012 at 8:37 pmIt’s a very good suggestion. Thanks a lot for helping.
by Sinchana November 21, 2012 at 10:41 pmThank You mate!
by rahmanwrite December 15, 2012 at 3:08 pmMany thanks
by Steve February 13, 2013 at 6:07 pmThanks so much ik who to do it now
by Kat/Katherine February 22, 2013 at 9:04 pmthanku sir it really helps so much
by Gaurav Sharma April 26, 2013 at 7:49 pm“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.
by Quikson May 7, 2013 at 9:59 amSo that’s one less disadvantage for Method 1, and thanks for sharing this!
Thanks, Quikson!
by Rhonda May 7, 2013 at 10:10 amgreat thanks very much
by Skip August 6, 2013 at 6:31 amThank you very much!
by Iaroslav September 23, 2013 at 12:16 pmthank you!
by qwertyuiop December 1, 2013 at 9:25 pmThank you very much!
by siavash diary January 21, 2014 at 1:30 pmAwesome! Thanks so much! You´re the guy!
by Juvenal Bolzan Junior January 23, 2014 at 8:22 pmexcellent help. Thanks
by Anas Zarka April 29, 2014 at 12:04 amthank you! it really helps.
by isthatjim July 21, 2014 at 2:07 pmthanks.
by Mohamadrafy September 9, 2014 at 6:08 pmHi,
by cuk October 11, 2014 at 2:45 amI 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.
thanks!
by utkarsh92 February 13, 2015 at 2:41 amall of these ways are good but not so easy and clean! i Found a way that is usable without need to insert any block:
by mokhabadi April 28, 2015 at 9:51 pmthere is a character with 0305 code. this character is upper line. you can use it by holding alt key down and type this code with num pad to insert this character.
Correction: Code of upperline character is 773 in dec and 0305 is in hex mode!
by mokhabadi April 28, 2015 at 10:08 pmBRILLIANT!!!! Thank you so much! Just started a STATS class & this is so helpful when taking notes!!! So far that’s all I’ve needed it for but it may come in handy again so I’m bookmarking this page. THANK YOU!
by BeHeard BeHealed (@BeHeardBeHealed) May 26, 2015 at 5:54 amType in a letter that you want to adorn with a bar. Say, for example, x.
by G Mathew September 19, 2015 at 12:49 amNext, go to Insert -> Symbol, drop down to “More Symbols”, and in the window that pops up, make sure you have selected “Arial Unicode MS” as the font. In the bottom right, you’ll see a text area and a drop down. To the right of the text area labeled “Character code:” type in 0305. That’s the code for a bar-on-top-of-a-letter. Going further right, there’s a drop down that says “from:” and you’ll want to make sure that you see “Unicode (hex)” selected in that box. Click “Insert”.
Thanks, G Mathew!! Further note, select the Unicode (hex) option BEFORE you type the 0305 character code. If you don’t, the character code will change after you select Unicode (hex) and you’ll have to type it in again.
by Rhonda September 19, 2015 at 7:22 amThanks. I’m writing a paper for linguisitics. I used Method 2, option 3. I was able to change the font size of the macron to TNR 14, while my letter remained TNR 12. No unwanted italics, Perfect spacing. Very easy to do and to remember for future papers–but I bookmarked this page just in case I need a refresher in the future.
by Maybe Nik November 30, 2015 at 3:28 amI found one more method. Type the desired letter, go to Insert -> Shapes – > Line -> Draw over desired letter.
So easy isn’t it :)
by SAKTHI SARAVANAN March 17, 2016 at 11:47 amthanks, its very usefull,
by Hansama - Free Android and PC Games March 30, 2016 at 10:46 pmim looking for this in equation but i didn’t find that
thank you so much
Thanks for the newsletter and the comments. As unproductive as it is, I liked best the comment from Matthew Tiger (Nov. 2011), but as many, am doomed to MS Word at work. That’s why also I have use of the tips given here.
But I use http://www.codecogs.com/latex/eqneditor.php for equation typesetting with 200 dpi and white background, then I copy the picture from the browser to word as bitmap, reduce to 50% and via VBA put the latex code as “Alt Text” under “Format Picture” – for later editing.
This method is also possible, however not nice for inline equations and symbols. At least I never get the symbol nicely vertically aligned if inserted as a picture.
My attitude: If it should look nice and be precise, use LaTeX. If you are obliged to use Word for technical text, don’t use much time on layout.
Thanks again.
by Volker Siepmann July 26, 2016 at 7:18 pmI know this is old, but it still comes up on google. The easiest way is to press ctrl+= to bring up an equation, then type D\bar then press spacebar twice, then press the right arrow to leave the equation editor.
by Charlie October 18, 2016 at 3:03 amThank you for that ! I am dying to type phonetically and it kills to not be able to…
by Rhéa a.h. Hleihel February 17, 2017 at 11:48 amUnicode 0305 method is very easy.
by Ramesh Chandra Gupta August 7, 2017 at 2:34 pmThank you for your research! You’re awesome!
by Salote Filivao January 14, 2018 at 4:56 pmIn MS Word, an alternative is to type the letter requiring a macron, e.g. “x”, then Insert → Symbol… Symbols tab; scroll down to the “Combining Diacritical Marks” portion, click on the box with the character “Combining Overline” (macron), click Insert, and Close. You’ll get this: “x̅”. The shortcut is Alt+0305 but I find that this is font-dependent and doesn’t always work. If you do find that it works in a font, sometimes using Cut & Paste will put it in your document the way you want it.
by Patrick May 3, 2018 at 7:15 pmThank you Patrick! That worked well, but as you say it’s very font-dependent. It looks good in Arial, Cambria, and others, but not so good in Calibri, Verdana, etc., and looks horrid in Courier New. I couldn’t get it to work with the Alt+0305 shortcut — all that did was add a small pipe character after the letter (holding down the Alt key while pressing 0305 on the numeric keypad) or put my doc into Print Preview mode (pressing and releasing Alt then typing 0305 on the numeric keypad).
–Rhonda
by Rhonda May 4, 2018 at 4:37 amYou can also use Word’s ADVANCE field code for this sort of requirement.
For the macron-D, type “D”, then Insert > Quick Parts > Field… and choose the Advance field. In the dialog, set an Offset text left amount (6.5 worked well for Candara 11pt, but adjust as needed) and an Offset text up amount (I used 6pt). Type a suitable bar (I used Alt-0150 to get an en dash), then add another Advance field code to reset the vertical position. If you reveal the field codes (Alt-F9), it will look something like this:
D{ ADVANCE \l 6.5 \u 6 }–{ ADVANCE \d 6 }
To make this more readily available as you type, select the completed combined character with the field codes, and use Insert > Quick Parts > AutoText > Save Selection to AutoText Gallery. If you give it a memorable name like “dmac”, a pop-up will appear when you type “dmac” to let you press Enter to insert it (you can also press F3).
Note that like other methods, raising the baseline will cause the paragraph’s line spacing to increase if Format Paragraph > Line spacing is set to “single”. You can avoid the problem by setting specific line spacing for the paragraph style (i.e. “Exactly 12pt”).
by Eric Fletcher May 14, 2018 at 9:38 pmThanks this article is great. However when I have lot of text to type with accent, I use math autocorrect option. It saves lot of time and are easy just type a\overbar and then space. This works really fast. For more detail please check https://www.youtube.com/watch?v=3_h7ukThU_4
by Anik8G September 13, 2018 at 11:14 pmHi Anik8G
This is just BRILLIANT!!! I’ll add it to the body of the blog post. Thank you so much for sharing this trick.
–Rhonda
by Rhonda September 14, 2018 at 6:13 amMethod 1 worked great for showing a Bar over a number to indicate it repeats. Thanks
by Tim Roy October 5, 2018 at 1:24 amJust change the language, for example convert English to Maori.
by Peter S September 11, 2019 at 3:17 pmIn Office 365 you can simply draw it, and Word will convert it to text.
Select Draw > Ink to Math
If you need more space to write, drag one of the bottom corners down. If you need a larger preview window, drag one of the top corners up.
Draw the letter(s) or number(s) you want with the bar over them. Select Insert.
This is particularly useful for geometry line segments with two letters. The bar will go over both letters with no gap in between.
(You can also get to the same feature through Insert > Symbols > Equation > Ink Equation. It’s just a longer method to get to the same place, but I included it here because some people may remember “draw” and others might remember “equation.”)
by Trena November 29, 2019 at 11:56 pmThanks for sharing, Trena! I had the Draw tab turned off because I don’t use a touch surface. However, after reading your solution I turned it back on (File > Options > Customize Ribbon) and tried it by drawing with the mouse, and it worked beautifully!
–Rhonda
by Rhonda November 30, 2019 at 6:23 amThanks a lot!
by yosef December 26, 2019 at 8:05 pmThank you!
by Dreaming19 May 9, 2020 at 1:43 pmcan you guys decode this Ⅎ̅ . its like letter E if you flip this
by JM January 26, 2021 at 1:25 amThere are some 145,000 Unicode characters, so it could be anything. Best place to start would be Wikipedia article that lists more than 1000: https://en.wikipedia.org/wiki/List_of_Unicode_characters
If it’s not there, then check the references at the bottom of that Wikipedia page, and/or search the internet for a complete list of characters.
–Rhonda
by Rhonda January 26, 2021 at 7:13 amYou can change the font from Calibri math by selecting abc normal text in the tools section of the Design tab.
by Anonymous July 27, 2021 at 1:45 pmAmazing stuff
by Daniel Smith March 11, 2022 at 3:55 am