Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm used to do

??symbol

when I want the reference for a given symbol, then I click on the >> arrows to open the help window.

Would it be possible to redefine the meaning of ?? in order to open the reference window directly ?

share|improve this question
1  
You can simply write down the symbol and then press F1. –  xzczd Feb 5 at 10:10
2  
Are you aware that you can place the cursor in the Symbol name (or select it with a double-click) and press F1 to bring up the Help for that item? –  Mr.Wizard Feb 5 at 10:10
    
I didn't know that ... –  Cedric H. Feb 5 at 11:16
    
Related/Possible duplicate: Open and search Documentation-Center –  rm -rf Feb 5 at 16:48
add comment

2 Answers

up vote 8 down vote accepted

The simplest (and canonical) method is to place the keyboard cursor in the Symbol name, or select it with a double-click, and press F1 if you use Windows/Linux or Command-Shift-F if you use OS X. This will bring up the Help for that item. This also works with compound operators, e.g. /;.

Nevertheless I like a challenge, therefore:

$PreRead =
  # /. RowBox[{"??", name_String}] :>
    FrontEndTokenExecute["OpenHelpLink", name] &;

Now this brings up the Help page for Fold directly:

?? Fold

While this will search the documentation for the term "Fold":

?? "Fold"

I chose $PreRead for this purpose so that it will not interfere with internal calls to Information.
You can also get the original behavior by writing out Information, e.g.:

? Plus

x+y+z represents a sum of terms.  >>

Information[Plus]  (* equivalent to ??Plus *)

x+y+z represents a sum of terms.  >>

Attributes[Plus]={Flat,Listable,NumericFunction,OneIdentity,Orderless,Protected}

Default[Plus]:=0
share|improve this answer
2  
@Kuba Yes, the same in v7, which is why I stated "place the keyboard cursor in the Symbol name" but you need to select some operators for F1 to work; for example, try placing the cursor between the two ^ characters in 2^^10010 -- it does not work. However, selecting ^^ and pressing F1 directs you to the documentation for BaseForm. –  Mr.Wizard Feb 5 at 10:32
    
Good point :).. –  Kuba Feb 5 at 10:35
    
Note that on OS X, F1 also works. –  zentient Feb 5 at 18:40
add comment

The typical way to search the documentation is the keyboard shortcut Mr Wizard mentioned. In general, you can find the shortcut key for a command by looking in the menu ...

enter image description here

If you are looking for a built-in way to open a documentation pages using a built-in command, then you are looking for Documentation`HelpLookup.

Documentation`HelpLookup["euler"]

will open the documentation centre and do a search for "euler". It returns a reference to the notebook window containing the search result. The behaviour equivalent to typing the search term into the documentation search box.

share|improve this answer
1  
This method appears to have a massive overhead compared to "OpenHelpLink". Documentation`HelpLookup["Fold"] // Trace // LeafCount yields 104848 while FrontEndTokenExecute["OpenHelpLink", "Fold"] // Trace // LeafCount yields 21. What is HelpLookup doing and what is its benefit over "OpenHelpLink"? –  Mr.Wizard Feb 5 at 16:36
    
@Mr.Wizard As Szabolcs said, HelpLookup returns a notebook object, which can be very useful whereas "OpenHelpLink" returns Null, which makes it useful only for this particular evaluation and cannot be used in other programs/applications, etc. More importantly, does the leaf count matter for OP's question? :) –  rm -rf Feb 5 at 16:50
    
@rm-rf In version 7 HelpLookup also returns Null. It may not matter, but it does make me wonder about the overhead, and if given the choice between two methods that are apparently otherwise equivalent (in v7) I'll pick the one that seems to have less overhead. –  Mr.Wizard Feb 5 at 17:54
1  
@Mr.Wizard It's an interactive operation. You are going to look at the result and read it. Does it really matter if it takes 0.1 seconds or 0.01 seconds, or does it really influence your choice? ;-) Also, what takes longer: opening the window and displaying the contents or running the function in the kernel? –  Szabolcs Feb 5 at 18:10
1  
@Mr.Wizard I would have used HelpLookup for the simple reason that I've seen it before and I remembered it, so it's less searching for me. I think you'd use OpenHelpLink for the same reason. I think that ultimately both will end up running the same code, and that OpenHelpLink will end up doing kernel evaluations as well. This is a guess that might be wrong. One might test it by using LinkSnooper to monitor the kernel-frontend communication during help lookup, but I don't think I'm going to spend the time to do it. –  Szabolcs Feb 5 at 18:18
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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