Tag Info

Hot answers tagged

24

If you want readline-like behavior you can of course use a readline wrapper. This works on all operating systems. On Ubuntu Linux (and other distributions I'm sure too) it can be installed easily through the package management. On Max OSX this can be installed using for instance MacPorts and I'm sure, there is an easy option on Windows too. Anyway, on all ...


22

I don't think you can do this. As an alternative, you can have a palette with all the Mathematica windows for easy switching. Something like this quick hack: CreatePalette[ Dynamic@Column[ Button[ "WindowTitle" /. NotebookInformation@#, SetSelectedNotebook@# ] & /@ Notebooks[]]] To remove the palette window itself from the ...


21

Date-picker implementation in Mathematica The following is my implementation of a simple date-picker. The current date is highlighted in LightBlue and the weekends are highlighted in LightGreen. The selected date is always highlighted in LightRed (the default selection is the current date). You can tap into this calendar by using the Dynamic values for ...


21

This code is not generalized. It has been written for a specific problem but you can take it and should be able to make it a more general function -- add flexibility (e.g. add grid options) or tailor it to your needs. ClearAll[frozenPaneGrid]; Options[frozenPaneGrid] = {"RowLabelSort" -> False}; frozenPaneGrid[tl_, tr_, bl_, br_, OptionsPattern[]] := ...


16

If you're on Windows: which command line interface are you talking about? The "math.exe" program is a console mode (i.e. "DOS prompt") interface to the Mathematica kernel. If you use that, you have access to the standard Windows console command-line editing; it is automatically provided by the OS to all console mode programs. You can use the arrow keys to ...


14

I found the solution. Mathematica is set up to use the font KLIpIqaDmey. The tip-off is in the UnicodeFontMapping.tr file referenced in the question. The header reads: @@resource UnicodeFontMapping Mathematica: Times Automatic Mathematica: (Times Courier) Automatic Mathematica: (Mathematica1 Mathematica1Mono) Automatic Mathematica: (Mathematica2 ...


13

Here is the summary: There is no shortcut (you can suggest here) Quick close/open labeled minimize below Disable from Top Menu >> Edit >> Preferences...


11

There's also a way to do it programmatically with LineBreakWithin SetOptions[$FrontEnd, LineBreakWithin -> False] Recover the original with: SetOptions[$FrontEnd, LineBreakWithin -> Automatic] Warning: This function has not been fully integrated into the long-term Mathematica system, and is subject to change.


10

You can also set option PageWidth -> Infinity for the Cell or Notebook, e.g.: SetOptions[EvaluationNotebook[], PageWidth -> Infinity]


9

This is because you are using = (the assignment operator) in the condition (not the body) of While. It is a typical beginner mistake to use = where == is meant, so Mathematica warns about this. Since you also use several ; in the condition, it gets a little confused and only highlights one of the = signs, not all of them.


9

I don't think the answer is related to choosing $OperatingSystem or SystemInformation as in Mr.Wizard's and F'x's answers (although both are cleaner than using $Version). I'm guessing you created your file on your PC and then opened it in your Mac. Tooltip then shows you the cached result from your PC. To make the tooltip refresh on your other machines, ...


9

The answer is that yes, you can affect the appearance of components of a control but the problem in this case is that your list of appearances appearances = {"DialogBox", "Palette", "FramedPalette", "Frameless"}; are only valid Button appearances and that is why they have no effect of ButtonBar or TabView. When you use valid appearances it works fine: ...


9

Writing games using dynamic interactivity in mathematica is an amusing subject! I will vote up your post for this. But I agree with others that it is hard to answer your question, you should work out minimal example for us first. Below I am giving my code for tetris. I recognize, it is a nonminimal answer, but it is working and can be useful for you. ...


9

Go to Format -> Edit Stylesheet Under "Choose a style" choose "Output" Select the cell bracket of the new cell that appears Press Ctrl+Shift+E (Command+Shift+E on a Mac) to show the cell expression Change Cell[StyleData["Output"]] to Cell[StyleData["Output"], ShowCellLabel -> False] Press Ctrl+Shift+E again Close the stylesheet window


8

Perhaps the simplest way is to introduce a global variable storing the Manipulate variables: Manipulate[ global = {A, f, p}; Plot[A*Sin[f*t + p], {t, 0, 2 Pi}, PlotRange -> {{0, 2 Pi}, {-1, 1}}], {A, 0, 1}, {f, 1, 10}, {p, 0, 2 Pi}] From now on, we can query global in a different cell any time. If wrapped into Dynamic, it will be updated as the ...


8

If you just want A, f, and p dynamically displayed all the time and printed when desired then: Manipulate[ Column[{ Row[{Button["print", CellPrint[ TextCell[Grid[{{"A =", A}, {"f =", f}, {"p =", p}}], "Text", ShowStringCharacters -> False]]], {A, f, p}}], Plot[A*Sin[f*t + p], {t, 0, 2 Pi}, PlotRange -> {{0, 2 Pi}, ...


8

Let's see if now I got it better... DynamicModule[{var = False}, Dynamic@Column[{PopupMenu[ Dynamic[var], {False -> #, True -> "Add another Menu"}], If[var, #0["new menu"], ## &[]]}]] &["one menu"]


8

I would say JLink is one of the fastest ways to do this. Just use the Runtime to start a process executing your command and collect the exit code too: << JLink` RunThroughWithExitCode[cmd_String] := JavaBlock[Module[{ireader, istream, runtime, process, reader}, LoadJavaClass["java.lang.Runtime"]; runtime = Runtime`getRuntime[]; process = ...


8

I don't know whether I interpret your question correctly but have you checked Preferences->Appearance? There you see what the colors of the syntax highlighter mean:


7

How to format Using AccountingForm : I show first the output of one function for your number n = 2.60152*10^-8 (*your number *) padIt[n, {15, 14}] (* +0.00000002601519 *) the first parameter is the number to format, then there is a list of 2 numbers. The first is the total number of digits you want in the field. The second number is how many digits ...


7

You can always create your own custom controls. This is a lot of work, but it also gives you unlimited flexibility. You can even create completely new kinds of control. Scroll down to the last section here to see an example. If you're aiming for a custom TabView-like control, I'd start with PaneSelector. Here's a primitive example (just a start, not ...


7

I think you've actually done a good job considering you are only using Manipulate. Here's a simplified snake game using Dynamic: snake = {{0, 0}, {0, 1}, {0, 2}}; dir = {0, -1}; directions = { "UpArrowKeyDown" :> (dir = {0, 1}), "DownArrowKeyDown" :> (dir = {0, -1}), "LeftArrowKeyDown" :> (dir = {-1, 0}), "RightArrowKeyDown" :> (dir ...


6

The list of recently opened notebooks (as shown in File > Open Recent) is saved in the NotebooksMenu option for $FrontEnd, arranged by ascending absolute time (i.e., most recent is last). So the most recent notebook can be opened with: Last[NotebooksMenu /. Options@$FrontEnd] /. HoldPattern[_ -> {file_, ___}] :> NotebookOpen@file Some ...


6

You could use this NumberForm[2.601519253*10^-8, {16, 16}, ExponentFunction -> (If[-10 < # < 10, Null, #] &)] (* 0.0000000260151925 *) Export into CSV format could be done as follows: Define a function numFormat[y_] := ToString@NumberForm[y, {16, 16}, ExponentFunction -> (If[-10 < # < 10, Null, #] &)] create a few ...


6

Some generic examples: DynamicModule[{var = 3, var2 = 1, var3 = "hello"}, Column[{ PopupMenu[ Dynamic[var], {1 -> "Display Popup", 2 -> "Display Input field", 3 -> "None"}], PaneSelector[{ 1 -> PopupMenu[Dynamic[var2], Range[4]], 2 -> InputField[Dynamic[var3]], 3 -> Spacer[0] }, Dynamic[var]] }] ...


6

As surmised by @Sjoerd in the question's comments, Manipulate combines all locators into a single LocatorPaneBox. We can see this if we inspect the boxes generated by the Manipulate expression: PaneBox[PanelBox[DynamicWrapperBox[PaneSelectorBox[{True->GridBox[{{ ... LocatorPaneBox[ Dynamic[{$CellContext`point1$$,$CellContext`point2$$}], ... ...


6

Very old thread but, since the question is formulated in a general way, I thought it could be updated with other approaches. It would be interesting to see more contributions to the topic. Below is my one cent. I have just extended the function that I have been using for a while to add some features I realised were missing (which brought me to look how ...


6

The expression that generates that GUI element is contained in the file: FileNameJoin[ {$InstallationDirectory, "SystemFiles", "FrontEnd", "TextResources", "ColorSchemeSelector.tr"}] After making a back-up you can edit that file as you see fit. I don't have time to dig into it now and make a nice improvement but I confirmed that editing works by ...


6

To open the help page just place the cursor somewhere within the function name and press F1. To get the template list use the following shortcut Ctrl+Shift+k. More keyboard shortcuts can be found here.


5

How about using $OperatingSystem? Typical values for $OperatingSystem are "Windows", "MacOSX" and "Unix". $OperatingSystem "Windows"



Only top voted, non community-wiki answers of a minimum length are eligible