Tag Info

Hot answers tagged

16

Declaration: This method for Windows is based on the .NET code from Todd Gayley's this wonderful answer. My .NET knowledge is absolutely ZERO, all credit goes to Todd. Code: The main idea is to extract the "Input"-style code string, convert it to the UTF-16 little endian form, which is the standard byte order in Windows, feed the bytes to system clipboard ...


11

A reliable approach would use the third argument of Reduce as variables to eliminate (see Behavior of Reduce with variables as domain) Reduce[{p == a b x + b^2 y + a c z, a b == 1, b^2 == 2, a c == 4}, {p}, {a, b, c}] p == x + 2 y + 4 z In the former editions of Mathematica (ver <= 4) Reduce used the third argument for eliminating another ...


10

Update It's probably easier to use Edit -> Copy As -> Bitmap from the menubar. Changing the magnification of the notebook will change the size of the image that gets sent to the clipboard Previous answer There's likely a better answer out there, but I use a hack of the SEUploader to do this. toclipboard2[] := If[ MemberQ[Hold[{}, $Failed, ...


10

Caveat: Since this uses hidden, undocumented functions, it will probably break at some point in the future. Also, I do not have any knowledge of how these functions work, except guesses from observed behavior. Some information is available via Information. Under the hood of TexForm is Convert`TeX`ExpressionToTeX, which in turn calls Convert`TeX`BoxesToTeX ...


9

Another approach: mark[s_, where_] := With[{n = ToString@s}, Row@{StringDrop[n, -where], Style[StringTake[n, -where], Red]}] Let's say you want to mark last 3 digits: mark[N[Pi, 45], 3] And a little bit more general approach: mark[s_, w_] := With[{n = ToString@s}, Row@MapAt[Style[#, Bold, Red] &, ...


8

Here is a very robust (!!) method expr = (z14 z43 (z01 + z03 + z12 + z32) + z01 z12 z43 + z03 z14 z32); StringReplace[ToString[expr, TeXForm], " " :> "\\times"] Using Ctrl+Shift+C to copy as plain text results in ...


8

The answer You create metafiles every time when you copy graphics from Mathematica FrontEnd and paste it in MS Word because it is native format for exchanging vector graphics under Windows. So your question is actually about corrupted metafiles in MS Word document opened on a machine without Mathematica fonts installed. This behavior is expected because ...


8

John Fultz alluded to using the Villegas-Gayley pattern. Since I believe that is the correct approach to this problem here is an implementation. mk : MakeBoxes[(Hold | HoldForm | HoldComplete | HoldPattern)[__], _] := Block[{$hldGfx = True, Graphics, Graphics3D}, mk] /; ! TrueQ[$hldGfx] I included HoldPattern to complete the Hold functions. This now ...


8

The following may be useful as starters: WolframAlpha["femme from french to german",{{"Translation:TranslationData", 1}, "ComputableData"}] (* {" Frau | Ehefrau", " Frau"} *)


7

x = E^-n (2 E^-1 + E^2) + E^n (2 E^-2 + E); x /. Times[a_, b_] :> Times[a, ExpToTrig@b] E^n (E + 2 Cosh[2] - 2 Sinh[2]) + E^-n (2 Cosh[1] + Cosh[2] - 2 Sinh[1] + Sinh[2])


7

Right, it doesn't work, but you can use this alternative: Grid[{{"The Thick Red Frame"}}, Frame -> True, FrameStyle -> Directive[Red, Thickness@10]]


7

Because Inactivate acts on Heads of expressions, replaces them with Inactive[h] where h is the Head of the expression and prevents them from evaluating. And in your case the Head of x y is Times: FullForm[x y] Times[x, y] So Inactivate[x y] Gives: Where the Times did not evaluate. Hence, the result you get when you apply TraditionalForm.


7

The following works in both v9 and v10: style = Directive[Thick, Black]; ContourPlot[y - x^2, {x, 0, 1}, {y, 0, 1}, ContourStyle -> Directive[Thick, Black, Opacity[1]], FrameStyle -> style, PlotLegends -> BarLegend[Automatic, Method -> {FrameStyle -> style}]] The idea to use the (undocumented) Method option comes from inspecting the ...


7

It sounds like you're merely looking for Row: Cp = 1.5; deltastar = 0.123; Row[{ "The value for ", HoldForm[Subscript[C, p]], " is ", Cp, " and the value for ", HoldForm[Superscript[\[Delta], "*"]], " is ", deltastar, "." }] If this does not work for you please clearly state how it fails so that those issues can be directly addressed.


7

Looks like StringForm can achieve this: Cp = 1.5; deltastar = 0.123; Then: StringForm["The value for `1` is `2` and the value for `3` is `4`.", HoldForm @ Subscript[C, p], Cp, HoldForm @ Superscript[\[Delta], "*"], deltastar]


7

Part a response, Because you do not show additional information and do not describe the problem with the code, I show one approach. First we construct some helpers : ClearAll["Global`*"] SetDirectory@NotebookDirectory[]; siz1 = 250; siz2 = 500; tex1 = "What a long and interesting and certainly necessary title for \ a panel of functions."; title = ...


6

If you have Mathematica on the Raspberry Pi (or Mathematica 10), you could use Association to store your data, which allows you to do these operations easily: With[{a = <|1 -> "this", 2 -> "that"|>}, a@Max@Keys@a ] (* that *) You can convert your list to an association as: Association @@ Rule @@@ {a, b}


6

See last paragraph in Scope:- http://reference.wolfram.com/mathematica/ref/ExponentFunction.html nFormat = NumberForm[#, {\[Infinity], 2}, NumberPoint -> ",", NumberSeparator -> ".", DigitBlock -> 3, ExponentFunction -> (Null &)] &;


6

I propose using HoldForm rather than strings etc. {a, -a, 3 a, -3 a} /. n_Integer s_ /; Abs[n] > 1 :> Plus @@@ HoldForm @@ {Sign[n] Table[s, {Abs @ n}]} Output: Not only does this format exactly like manual entry of this expression, you can release it: % // ReleaseHold {a, -a, 3 a, -3 a} If you want it to be automatically released when ...


6

x = {3, 1} y = {2, 5} a Defer[x] + b Defer[y] /. First@Solve[a x + b y == {7, 11}, {a, b}] (* x + 2 y *) Note that the output is usable as such: evaluate it and you'll get the combination result. If only integer coefficients are desired, changing the Solve to something like: Solve[a x + b y == {7, 11} && {a, b} \[Element] Integers, {a, b}] ...


6

Will a = -3; Print[Defer[\[FormalA] x + 5 + x^2] /. \[FormalA] -> a] -3 x + 5 + x^2 work for you?


6

Consider this: Inactivate[3*5 - 2 - 3] // FullForm Inactive[Plus][Inactive[Times][3, 5], -2, -3] RunnyKine is correct regarding the cause but he did not really explain the mechanism involved. Formatting rules typically apply to (sub)expressions with certain heads. This has nothing to do with evaluation per se, but rather the patterns in the ...


6

Here is a function that copies a Unicode string to the clipboard using JLink: Needs["JLink`"]; InstallJava[]; LoadJavaClass["java.awt.Toolkit", AllowShortContext -> False]; uniclip[s_String] := JavaBlock[ java`awt`Toolkit`getDefaultToolkit[]@getSystemClipboard[]@setContents[#, #]& @ JavaNew["java.awt.datatransfer.StringSelection", s] ...


5

You may find setting this font option improves the appearance in Word:- (* Take note of your original settings *) originalsettings = Options[$FrontEnd, PrivateFontOptions] (* Set not to use Mathematica-only fonts *) SetOptions[$FrontEnd, PrivateFontOptions -> {"OperatorSubstitution" -> False}] (* If you need to find your front end init file it ...


5

expr = 1/2 (-36 + \[Pi] + 65 ArcTanh[4/9]) // TrigToExp (* -18 + \[Pi]/2 + 65/4 Log[13/9] + 65/4 Log[9/5] *) MapAt[HoldForm, expr, {{1}, {2}}] // Simplify // ReleaseHold (* -18 + \[Pi]/2 + 65/4 Log[13/5] *)


5

The correct character encoding for Export may help. Export["hello.txt", str, "Text", CharacterEncoding -> "Unicode"] does the trick for me:


5

EDIT As rasher observes my answer does not answer your direct question. Tooltip wrapper does not appear to work for ListPicker items. I posted this answer in the event it achieves your aim or motivates your own answer. I am not certain what your ultimate aim is. I have modified your code (esp. avoid uppercase variable names to avoid conflicts with ...


5

Regarding your second question What I could not achieve as well was outputting raw LaTeX commands and to give you further insight, let me give you another possibility. To create a special LaTeX representation for a certain symbol you can simply call TeXForm[1]; (* initialise definitions *) System`Convert`TeXFormDump`maketex["foo"] = "\\foo" and now ...


5

A solution for the issue at hand Based on your comments I believe you are looking for ScriptLevel itself: expr2 = "\!\(\*FractionBox[\(\[Alpha]\),\(360 \[Degree]\)]\)"; expr2 = Style[expr2, Bold, 30, ScriptLevel -> 0]; Grid[{{#, Column[{#}]}}] & @ expr2 For application at the Grid/Column level one can use ItemStyle: {#, Grid[{{#, Column[{#}, ...


5

Adapting an example in the docs you could do it this way: table[pairs_] := Grid[pairs, BaseStyle -> {TextAlignment -> Left}, Alignment -> {Left, Automatic}] Then use LegendLayout -> table, to give you: Edit To reverse it just use Reverse: reversetable[pairs_] := Grid[Reverse@pairs, BaseStyle -> {TextAlignment -> Left}, ...



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