Typing x-bar, y-bar, p-hat, q-hat, and all that! In Microsoft Word
I use Microsoft Word to prepare documents. I do not like Microsoft Equation Editor. And I have to type equations and expressions not often (like every sentence or every other sentence), but definitely regularly. This has led me to apply what I like to call “agile shortcuts” — basically, I’ll write down the equation in my own handwriting, take a picture of it, and then use a paint program to crop and clean up my equation before inserting it into my document. This works nicely, and even though some people might think it’s a kludge, I kind of like the ability to retain the personality of my own handwriting in my technical documents.
However, I don’t want to be embedding images if all I have to do is make reference to a variable within a paragraph of text… and I’ve never had a good solution. UNTIL THIS MORNING when I really, really, really wanted to be able to use y-bar and p-hat in my paragraph, without having to do the even kludgier thing where you just call them “y-bar” and “p-hat” in the text. That doesn’t feel good.
Even Arial Unicode MS, the behemoth of fonts (it even contains tons of Chinese, Japanese, and Korean characters) does not have essential statistical symbols. But turns out, it DOES have this very useful capability called “combining diacritics” — and here’s how you can use it to type characters with their own hats and bars on them:
1. Open up Microsoft Word
2. Choose “Arial Unicode MS” as your font
3. First, type in a letter that you want to adorn with a hat. Say, for example, p.
4. Next, 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 dropdown. To the right of the text area labeled “Character code:” type in 0302. That’s the code for a hat-on-top-of-a-letter. Going further right, there’s a dropdown that says “from:” and you’ll want to make sure that you see “Unicode (hex)” selected in that box. Click “Insert”.
5. Voila, your p has a hat!! Now, type a few spaces and let’s do this again.
6. Only now, type in a letter that you want to adorn with a bar. Say, for example, x.
7. Next, 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 dropdown. 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 dropdown that says “from:” and you’ll want to make sure that you see “Unicode (hex)” selected in that box. Click “Insert”.
8. Voila again! Your x has a bar.
Go forth into the world and enjoy the same liberation I have just felt… o, ye writers of statistical stuff in documents.
Hi, I tried this and it works! If the letter is upper-case, the symbol goes through it, but lower case p or x has the symbol above. The cursor has to be to the right of the letter to be correctly positioned. Great feature in MS Word.
Great, it works with small letters, which is the trck with capital letters. Maybe the “Character code” is different?
have microsoft 2011 for mac, there is no option for “more symbols”
Can you post a screen shot of what comes up after you do Insert->Symbol? I don’t use Macs, but would be interested in figuring this out for Macs too.
Thank you! This was very helpful.
That was AWESOME!!!
This also works in MS EXCEL
Found a way to correct the bar and letter misalignment and goes through the upper case letter. Type a letter, then go to Symbol, In “Font”, select Arial, and choose “Combining Diacritical Marks” in Subject. Type 0304 for lower case, and 0305 for upper case and insert it. Afterwards, mostly the upper case will not align. The correction is to do “copy/paste”. Copy it (both letter and bar) and paste it as text ( A in Word and 123 in Excel). It works in MS office 2010. If need more bars on top, inert bar twice, you double bars on top, and so on.
If you’re looking for a way to not have to do so many mouse clicks and interrupt your typing, there are options to TYPE many math symbols and operators.
For example, “x\bar” will produce x̅, or “q\hat” will produce q̂. For Greek letters “\sigma” produces σ, while “\Sigma” produces Σ. (In all of these cases, do NOT type the quotes.)
Click on File > Options > Proofing > AutoCorrect Options > Math AutoCorrect
Check the box next to “Use Math AutoCorrect rules outside of math regions”
— This allows you to use these math and symbol typing short-cuts outside of the equation tool (a little mini-window within your document for equations). Equation”.
Check the box next to “Replace as you type”
— This initiates a special kind of AutoCorrect that replaces the text you are typing with symbols or diacritical marks.
You can find a list of typing shortcuts here: https://support.office.com/en-za/article/Math-AutoCorrect-symbols-b8b463d9-f47d-45c4-a00f-9245c2b38843
Or, if you have an equation tool open, you can hover your cursor over the symbol and the name of the symbol and any available typing shortcuts (e.g. “Infinity (\infty)”) will appear.
Oh, that is awesome! I hate having to stop typing to go look up a symbol.
Awesome! Thank you!
Thank you this is amazing
Thank you so much!!!! I just made the changes in my options and now (after typing up 8 chapters of statistics homework) I now have an easier way to insert my symbols without always going to “insert symbols.” An p̂ and q̂ were not even listed. You just made my life easier!!!
This is an AMAZING tip! I do layouts which have the odd letter with a hat in, and this will make then look so much better! Thank you for finding out how to do this!!
Yes! simple. neat. efficient.
@Nicole. I’m surprised that if you write equations often in your work and are a fan of quality that you don’t move to software such as LaTeX. Not as intuitive to begin with as word, but once mastered produces fantastically amazing documents.
Hi Charles — I use LaTeX often (since mid 90’s)… but my students don’t, and I’d rather they focus on the material than on the typesetting of equations. Definitely agree though, once you get over the LaTeX learning curve, there’s no comparison! 🙂
Hi Nicole, great thread and it pushed me to figure this out for Office for Mac 2016. I found it’s an easy solution on Word for Mac and hope it’s the same for previous versions: select Word from the menu and go to Preferences. Then select AutoCorrect. Click the radio button for “use Math AutoCorrect rules outside of math regions.” There is a list of about 100 math symbols that will be replaced automatically. For example, typing X\bar will be replaced by an X with a bar on top. Typing X\Bar will be replaced by an X with a double bar on top. Typing \div will insert the division symbol. Really great shortcuts.
Thanks!! As a non Mac user, I would not have ventured into attempting a solution, so your contribution is very VERY much appreciated 🙂
This is great as far as it goes. I can do y\bar and q\hat but unfortunately it does not work well for Greek symbols such as \theta\hat. The hat gets lost in the Greek letter. Any suggestions?
You can use what are called “combining diacritical marks” above the letter (including Greek letters). But you need to use Unicode diacriticals sometimes. If the \alpha technique turns it into a Greek alpha in Word, then you change to “unicode mode” on your computer and type the unicode 0302 to get a circumflex above the last letter (or 0304 for a macron). If the Greek letter is too tall, you will need to reduce the font size for theta to about 9, and then do the full 12 pt size circumflex. It looks great. θ̂. At least on my Mac, this looks like a well-aligned theta and circumflex. On my Mac, I set unicode in the keyboard preference for “unicode hex input” (and I change it under the American flag menu bar icon). There must be a similar Windows command.
Thank you for taking the time to find out this information and sharing it with us! I am taking my first stats for psych class and googled how to make “p-hat”, and your blog article was the first hit. I am so grateful for Google and for wonderful people like you. 🙂
Pingback: How To Make X Bar In Word Mac | Critical5
Awesome! Thanks a ton for the tips. Works nicely.
Thank you so much for posting! I have been trying to figure this out for YEARS and you are the only person that has explained a method that works!
I’m using Word 2013 and what I found to look best (good enough for me) are simply the BOLD Capital letters of “Times New Roman” (go figure). I’d show you, but I guess I can’t use Times New Roman here.
For numbers greater than 4,999 you’ll need one or more overbars. There’s a few ways to do an overbar, but the one that looks best to me can be done by inserting a symbol. Let’s say you want to represent 106,748. Using Times New Roman, BOLD, type capital “C”, go to Insert -> Symbol -> More Symbols (the shortcut to get there is Alt-n-u-m), then for font (Alt-f) choose “(normal text)”, then in the lower right of the dialog (Alt-c), choose “Character code: 0305” and at the top right, the Subset should automatically switch to “Combining Diacritical Marks”. If it doesn’t, make sure you typed the letter “C” using Times New Roman, but in any case, you need to choose “(normal text)” or some other font that gives you “Combining Diacritical Marks” and a valid symbol at 0305. Next, back to the lower right corner (Alt-m), make sure it says “from: Unicode (hex)”, then finally press the Insert button (Alt-i, left arrow, Enter). Now your “C” should have an overbar. Next type “V” and when you go back to Insert -> Symbol (Alt-n-u), the last symbol that was used should always appear as the first choice in the upper left of the pull-down, so press Enter (or click the symbol) and your “V” should have its overbar, too. (If not, check all those previous steps again.) Last type “MDCCXLVII” and your final result should be the Roman numeral for 106,748: C̅V̅MDCCXLVII
I had mixed results simply using the “0305 Alt-x” shortcut. Sometimes I could type the letter immediately followed by the number “0305” (no space) and then Alt-x and it usually inserts the overbar, but sometimes it didn’t work correctly. However, going up to the Insert Symbols dialog and making sure all the options were correct always worked.
Hope that helps.
VERY VERY Helpful Thank You!
thank you thank you!!!
This still works. Thank you for being you and sharing
You are awesome! Thanks and God bless you.
Aahh.. that helped me a lottttt..!!… Thank you very much..!
you’re welcome! 🙂
Thank you so much< really works! You're a lifesaver, been searching for so long
Success! Thank you.
Pingback: How To Add Hat In Word Equation - asztutorials.com