# How do I get a list of allowed values for an option?

When using Mathematica how can I get a list of the allowed values of an option? As an example I can use the Options command as follows -

Options[Manipulate]


which gives me a list of available options

(* {Alignment->Automatic,AppearanceElements->Automatic,AutoAction->\
False,AutorunSequencing->Automatic,BaselinePosition->Automatic,\
BaseStyle->{},Bookmarks->{},ContentSize->Automatic,ContinuousAction->\
ControllerMethod->Automatic,ControllerPath->Automatic,\
ControlPlacement->Automatic,ControlType->Automatic,DefaultBaseStyle->\
"Manipulate",DefaultLabelStyle->"ManipulateLabel",Deinitialization:>\
None,Deployed->False,Evaluator->Automatic,Frame->False,FrameLabel->\
None,FrameMargins->Automatic,ImageMargins->0,Initialization:>None,\
InterpolationOrder->Automatic,LabelStyle->{},LocalizeVariables->True,\
Method->{},Paneled->True,PreserveImageOptions->True,RotateLabel->\
False,SaveDefinitions->False,ShrinkingDelay->0,\
SynchronousInitialization->True,SynchronousUpdating->Automatic,\
TouchscreenAutoZoom->False,TouchscreenControlPlacement->Automatic,\
TrackedSymbols->Full,UnsavedVariables:>None,UntrackedVariables:>None} \
*)


I can use Options for a specific parameter, i.e.,

Options[Manipulate,ControlType]
(* {ControlType->Automatic} *)


But this doesn't tell me what the possible allowed values are for this option. Checkbox, Setter etc. Is there a command I can use to find the allowed values of an option?

Unfortunately, there is no command which tells you that. There are several reasons for that. First, the possible option values are context dependent. This means, e.g. the option Method can be set to different values depending on whether you use it in NDSolve, FindRoot, etc..

Second, as you see with "Elements" or "ImageList" options of Export, options are not always symbols, but usage messages cannot be applied to strings and documentation to string options rarely exists as separate page.

Therefore, the only way you find out about possible option values is the documentation. Note, that you often have two places to look

1. You want to know what the special option ControlType of Manipulate does, then you first check out the help page of Manipulate
2. For general information about the option, if it is a symbol, you check out the help page of the symbol itself.
• Thanks, found the info i needed in the documentation but just wasn't sure if there was a command i could use to get the info i needed, would be good if such a command existed but i can see how this is context dependent. Thanks for answer. Feb 13, 2013 at 12:30
• and it's not always in the docs, either...
– acl
Feb 13, 2013 at 23:56
• Since new version of Mathematica has popup hit menu when mouse over an option, just like this link shows mathematica.stackexchange.com/questions/52406/… So I wonder there must be a database somewhere contains information about available option value for different Functions. But I cannot figure out how to find this Mar 26, 2017 at 3:06
• @matheorem Yes, the database is under $InstallationDirectory/SystemFiles/Components/AutoCompletionData/Main/OptionValues/. Mar 26, 2017 at 3:50 • Wow, amazing! I am really curious about how do you find it? And another problem is that the information in a single file is not complete. For example, there are only three options contained in DensityPlot.m file: MaxRecursion, PlotPoints, PlotTheme. So there must be other files contains the information of relations and hierarchy of different function, so mma can look up option in other related functions' m files. Mar 26, 2017 at 5:54 What follows is merely @halirutan's answer expressed in Wolfram Language: Fetch symbol names and options: symbolNamesWithOption@opt_ := Quiet @ Cases[ {#1, Options/@Unevaluated/@#2}& @@@ ({#, ToExpression[#, InputForm, HoldComplete]}&/@Names@"*") // ReleaseHold , {symbolName_, {___, (opt -> _) | (opt :> _), ___}} :> symbolName]  Assemble names of files to search in: notebooksToSearchInForInfoOnOption@opt_ := FileNameJoin @ {$InstallationDirectory
, "Documentation", "English"
, "System", "ReferencePages", "Symbols"
, # <> ".nb"}& /@
Prepend[symbolNamesWithOption@opt, ToString@opt]


(could probably be done smarter with a proper use of Documentation)

With a basic formatting…

justSomeGrid@optString_String :=
Grid[
Prepend[#, Style[#, Bold]& /@
{"Reference notebook", "Values for "<> optString}]
, Alignment -> Left]&


…show the results:

tableOfExamplesForOption@opt_ :=
With[{optString = ToString@opt}
, { Button[FileBaseName@#1, SystemOpen@#1
, Appearance -> "Palette", ImageSize -> Automatic]
, Row[#, ","]& @
Cases[#2
, RowBox[{optString, "\[Rule]", val_}] |
RowBox[{optString, " ", "\[Rule]", " ", val_}] :>
DisplayForm@val
, \[Infinity]]}& @@@
DeleteCases[
{#, Quiet@Import[#, "NB"]}& /@
notebooksToSearchInForInfoOnOption@opt
, {_, \$Failed}] // justSomeGrid@optString ]


An example:

tableOfExamplesForOption@Extension


Notes:

• please check symbolNamesWithOption@Method with Quiet omitted from its definition before trying the whole thing. There could be side-effects, and they may be version-dependent. From my experience, it's safe to run on 8.0 but I had to add an use at ou own risk warning
• pattern for search could be improved
• some searches are very slow in this implementation (try tableOfExamplesForOption@Method — I personally haven't yet had enough patience to wait for its result)
• reference notebooks called with buttons will stay at (and thus, may mess with) your recent files history
• using special contexts in Names one could search in definitions for examples values not covered in documentation
• symbolNamesWithOption@_String` comes as a nice bonus

Still, I hope it adds something to the description in natural language.

Ideas on improvements are very welcome.