6
$\begingroup$

(I'm navigated from stackoverflow.com where I asked almost the same question)

I'm a beginner in Mathematica. Like shown in the image below, I'm trying to put hat and bar to some letters in a statement (I basically want to write vector notation) but only some letters can have them. What's wrong with how I do?

enter image description here

In the stackoverflow.com page I cited above, someone suggested functions OverHat/OverBar. These could do the similar work when I only want a letter in a line. But as I described, I want to write a statement, which consists of left-hand & right-hand sides, where those functions might not work as it seems.

If you could provide online resource that covers these syntax, that would be more appreciable. Thank you.

(Environment) { Mac OSX 10.7, Ubuntu 11.10, Ubuntu 10.10}, Mathematica 8.0.4 Student Edition

$\endgroup$
3

6 Answers 6

5
$\begingroup$

You can use the menu Palettes -> Basic Math Assistant and click the overscript button:

enter image description here

Then you can type j, followed by the tab key, followed by ^.

It should be possible at this point to assign to this typesetting construct.

Also, in this same grid of buttons you will see a button with a black square and a ^ already on top of it, which should save you one step. There is also a button for the overbar construction.

$\endgroup$
6
$\begingroup$

Taking the recommendation from the StackOverflow thread:

Mathematica graphics

In addition to Ctrl+Shift+7 and then _ or ^, you can also use OverBar[thing] or OverHat[thing], select the expression and press Ctrl+Shift+N to convert to InputForm

$\endgroup$
6
$\begingroup$

The reason why some letters work using the esc a ^ esc and others not is that the ones that do have their own atomic symbol name in the Mathematica language.

ô // FullForm
\[OHat]

Versus

\!\(\*OverscriptBox[\(h\), \(^\)]\) // FullForm 
(* sorry that's how it pasted across *)
OverHat[h]

The ones that have atomic representation are all vowels: here is a list in the online documentation. Note that capital vowels with hats also work.

As Spartacus' answer shows, you can use the OverHat and OverBar syntax for the other letters to assign expressions to them.

$\endgroup$
6
$\begingroup$

What has not been mentioned so far is that putting hats on the garden variety i's and j's is, well, somewhat ugly. This is precisely why Mathematica provides for the dotless versions, "$\imath$" and "$\jmath$". Try typing OverHat[\[DotlessI]] and OverHat[\[DotlessJ]] on the front end.

$\endgroup$
1
$\begingroup$

As a comment to J.M.s answer, if you find the OverBar too close to your letters you can insert an additional Overscript:

   OverBar[Overscript["YourExpression", Style["", 1]]]
$\endgroup$
0
$\begingroup$

In addition to what is already written about it, if you need to make vectors you might like to use this

OverVector[x]

Try it. All this is for the use in input fields. If what you need is the text field, however, you may be more comfortable with accepting the notations typical for scientific journals, where vectors are printed in bold. Use then the in-line math cell for formulas (Ctrl+9), and in it you may use bold and plain.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.