The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

3

It's not clear how XML can be converted to JSON in a general way, because how would one deal with attributes? You happen not to have attributes in your XML, but that's just a special case. Luckily, Mathematica is a great language to write ad hoc parsers in. convert[XMLObject["Document"][{}, content_, {}]] := convert[content] convert[XMLElement[tagName_, _, ...


2

Regarding the commented example (it is wise to update your post with such things, for future reference) one would do something like the following: A=3; out[A_,function_]:=outfunc[A,function]; (*where outfunc[arg, argfunc] is the function based on arg and argfunc one would like to export*) outexporter[A_,function_,driveletter_]:=outexporter[A,function,...


1

I just checked the solution by Szabolcs and it kinda works for me, only the letter heights are wrong: {greekLetters, variantForms, archaicalGreekLetters} = {{\[Alpha], \[CapitalAlpha], \[Beta], \[CapitalBeta], \[Gamma], \[CapitalGamma], \[Delta], \[CapitalDelta], \[Epsilon], \[CapitalEpsilon], \[Zeta], \[CapitalZeta], \[Eta], \[CapitalEta], \[...


0

Check this http://www.ams.org/publications/authors/tex/amsfonts and Install "cmmi12", then Use in Wolfram "FontFamily -> "Computer Modern" " or You can check https://tex.stackexchange.com/questions/38632/image-with-axis JjSa


3

The Method suboption "BookmarkDurationMultiplier" (default value is 1.5) seems promising to play with to change the speed of bookmarks animation: Given Manipulate`Dump`$DefaultAutorunDuration 4 I would guess that changing the default value of 1.5 to 5 should give 20 seconds duration for the bookmark animation. Row[Labeled[Manipulate[x, {x, 0, 1}, ...


2

For your MWE the simplest solution is to dynamically redefine the Print function in the Block scope: Do[ Block[{Print := (Export[ToString[n] <> ".pdf", Echo@#, OverwriteTarget -> "KeepBoth"];) &}, externalFunction[n]; ] , {n, 1, 5}] This will print every output in the evaluation notebook and immediately Export it after this. With this ...


1

After some more time playing with this, I found this solution which seems to work. But I would be happy to accept a better solution. Instead of using PreviousCell, I should use NextCell, but also have to delete each output cell as it is generated for this to work. So the MWE now is SetDirectory[NotebookDirectory[]] << Rubi` CurrentValue[$FrontEnd, ...


3

I have defined a custom function that I find quite convenient fileName[base_, n_, r_] := StringJoin[{ base, "_", StringReplace[ToString[Round[n, r]], {"." -> "p", "-" -> "m"}], ".pdf" }] It replaces the decimal point with the letter "p" (for "point"). It replaces minus sign with "m". And you can truncate the number with r for rounding....


2

The idea expressed in kglr's comment is a good one. I recommend you follow that advice and also make some changes to your plot generating code to Remove some unneeded options from DensityPlot. Add a label to each plot so it can be distinguished in the final array. Make changes to the code that will improve it robustness. My recommended revisions to your ...


5

This has been a long-term annoyance when exporting graphics from Mathematica. The root cause is that non-Graphics notebook objects are exported in the "Printout" environment, which downscales to 80% by default. It is discussed here and in the MaTeX tutorial titled "Preparing Figures to Size". The symptom If expr is not Graphics or Graphics3D, then Export[...


4

You can use PreviousCell for this purpose. For example: Export["code.pdf", NotebookRead[PreviousCell[]]] should grab the cell contents of the previous cell, and save it to your file.


0

Numbers in your file are written as strings. data = Import["Data1.dat", "Table"]; ListPlot[ToExpression@data, PlotRange -> All]


2

The following should work: Export["list.txt", list, "Table", "LineSeparators" -> " "] The "Table" format also supports a "FieldSeparators" option to separate columns in 2D data, should you need it.


1

My take on it: list = {{1, 2, 3, 4, 5}} Export["list.txt", list, "TSV"] In TSV values in the same row are delimited by tab and values in the same column are delimited by newline.


10

It is as easy as follows using low-level Notebook programming: outputCells = Cells[CellStyle -> "Output"]; cellsWithGraphics = Select[outputCells, ! FreeQ[NotebookRead[#], GraphicsBox] &]; MapIndexed[Export[ToString[#2[[1]]] <> ".png", #1] &, cellsWithGraphics] This solution assumes that all your graphical objects are in "Output" cells.


Top 50 recent answers are included