Tag Info

Hot answers tagged

22

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 ...


15

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[]] := ...


14

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 ...


12

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


12

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 ...


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.


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

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

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

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

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

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

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

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

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]] }] ...


5

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


5

Here is one that should work in version 6 and later. The full code is at bottom. Here is what it looks like: {dateSetter[Dynamic[d]],Dynamic[d]} I did not incorporate the year here, but you could put it in a Tooltip or add it to the button's graphic. And when you click on the button you get Incorporate this into a Manipulate using ...


5

Does this answer your question? CreateDialog[SystemInformation[], WindowTitle -> "Mathematica System Information"] Another example man = Manipulate[Plot[#[k t], {t, 0, 10}], {k, 0.1, 10}] & /@ {Cos,Sin, Exp} // TabView Now you can put it in a dialog CreateDialog[man, WindowTitle -> "My manipulate"]


5

The problem is that on OS X the default appearance "style button" has a minimum size. Note below that Appearance has to be set locally within each button rather than in the Style wrapper. Style[ Grid[{{ Button["x", Null, Appearance -> None, ImageSize -> {10, 10}], Button["x", Null, Appearance -> None, ImageSize -> {20, 20}]}, ...


5

Following suggestions in the comments, here is a way to achieve what I want: Manipulate[ Row[{ Plot[Sin[x (1 + a x)], {x, 0, 6}], Plot[Evaluate@D[Sin[x (1 + a x)], x], {x, 0, 6}]}, BaseStyle -> ImageSizeMultipliers -> 2/3], {a, 0, 2, Grid[{{ Slider[##, Appearance -> Tiny], InputField[#, FieldSize -> ...


4

If you want something that displays in abbreviated from, you can do the following: Type Quantity[number, "unitstring"], for example Quantity[5, "m"]. Select that expression (pressing Ctrl. twice will do that if you haven't moved the cursor). Perform Evaluate In Place (CtrlShiftEnter on Windows and Linux, CmdEnter on OS X). This will give you something ...



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