Questions on changing Mathematica expressions of one type or format to another, for example date formats, Boxes and other typesetting representations, or different units of measurements.

learn more… | top users | synonyms

25
votes
2answers
1k views

How do I extract the contents of a selected cell as plain text?

My aim is to extract the contents of an Input cells as plain text. Ideally I would like to be able to select one or more Input cells and press a button which would then extract the text from these ...
22
votes
8answers
4k views

How to express an integer number in English words?

How do I convert a number to a readable string? I would like to implement a function, inWords[], inWords[n_]:= ? which ...
18
votes
2answers
314 views

Understanding evaluation and typesetting

Background So, one could be surprised by the fact that: Hold @ Grid[{{1, 2}}] (*or*) Hold @ Graphics @ Disk[] This issue and methods of prevention are ...
15
votes
3answers
761 views

How to convert between various ItemSize/ImageSize units?

How can one convert between the implicit units used by Grid (ems and line height for horizontal and vertical dimensions) and printers points (in ...
14
votes
2answers
615 views

How to convert Graphics3D object into an Image3D object?

How does one convert a Graphics3D object into an Image3D object? E.g., start with ...
12
votes
2answers
707 views

Exporting notebook to HTML, using conversion rules

The idea is to export the whole notebook to HTML with all the math equations in latex form. In this way we can add the mathjax script and it will take care of the math. Suppose we have the following ...
12
votes
1answer
785 views

Exporting numbered equations to HTML/TeX using conversion rules

This question is a follow up from this one. It may also be considered a duplicate since I have already asked this question in stackoverflow almost a year ago. For a background on using numbered ...
10
votes
4answers
410 views

Built-in way to convert Integer to Ordinal String

Is there a built-in way to convert an integer into its ordinal string representation (as per this page). That is, something akin to ...
10
votes
1answer
91 views

Arrows from GraphicsComplex not converted to Normal form correctly

Bug introduced in 7.0 or earlier and persisting through 10.4.0 Show @ Graph[{1 -> 2, 2 -> 3}, Frame -> True] Normal @ % Is this a pure bug, or have ...
9
votes
2answers
295 views

Working with Java hashmaps from Mathematica

I'm using J/Link to access data from an external Java program. The data are represented as a ConcurrentHashMap (see the official specification here). ...
9
votes
1answer
275 views

How can I convert the dates returned by FinancialData into decimal representation?

I'm trying to run a regression using Fit on the output of FinancialData["SPY", "Jan. 1, 2011"]. However, the dates returned ...
8
votes
3answers
242 views

Graphics in Notebook Different from Graphics Expression?

Consider the expression TreeForm[a+b^2+c^3+d] which displays as This is a nice Graphics object, as I can prove by typing ...
8
votes
3answers
4k views

Converting Mathematica to $\LaTeX$

Is there a Mathematica-to-$\LaTeX$ converter, so that I can place Mathematica code, including things like A // MatrixForm, just as they are in the console straight ...
8
votes
3answers
240 views

Incompatibility of Row and TeXForm

Bug introduced in 9.0 and persisting through 10.1.0 or later Update: Since no one has been able to give a reason for this change in behavior or provide a solution I am tagging this as a bug. ...
8
votes
2answers
87 views

Reading Cells or Boxes expression by expression

Let's say we have a cell: (*newline*) (*newline*) Plot[ x, {x, 0, 1} ] (*newline*) Plot[x, {x, 0, 2}] How to read it expression by expression? ...
8
votes
0answers
173 views

TeXToBoxes and BoxesToTeX BoxRules options

A recent question has gotten me to look more into the tex conversion rules. Consider the following latex string: ...
7
votes
6answers
4k views

Convert a string into a list of numbers

I got the following problem I don't know how to solve or if it's at all possible to solve(I'm quite new to Mathematica and don't have an IT background, so please explain slowly if possible:)) I'm ...
7
votes
2answers
264 views

Programatically adding/retaining comments within a nested list

Is it possible to convert the following list of strings to computable numbers with the comments preserved? ...
7
votes
1answer
125 views

ToExpression and ToBoxes aren't inverses of each other?

Applying ToExpression and ToBoxes repeatedly to Hold[1/1] gives many ...
7
votes
2answers
2k views

How to convert a string of number into real numbers without precision loss

I searched and did not find similar answers which can resolve the 'no precision loss' issue. A sample string is: ...
7
votes
2answers
411 views

Revert FullForm-ed text to prettyprinted

Sometimes strings in a notebook/package file end up garbled due to some unknown/unintentional conversion of the expression/cell/notebook. I could not find a way to revert such unreadable text to its ...
7
votes
1answer
106 views

How to convert arbitrary raw boxes directly into String?

This question is motivated by the recent question about searching inside of the NB files. According to the Documentation, ToString expects a high-level WL ...
7
votes
1answer
415 views

How to write aligned equations and export them HTML/TeX

This question is mainly about exporting to HTML/TeX. For those of you who do not know how to write aligned equations in Mathematica please see this answer. Lets assume that you modified your ...
7
votes
1answer
114 views

How to replicate v9's color conversion to LAB under v10

Mathematica 10(.0.0) appears to use a different flavor of the LAB color space, but I would like to emulate the same behavior observed in version 9(.0.0). v9 ...
7
votes
2answers
98 views

How to open and explore the codes of the system Palettes files

The built in Palettes of Mathematica are simply .nb files which can be found in the following place: ...
7
votes
1answer
841 views

Creating and editing new stylesheets

I'm trying to create a stylesheet, but the process has become painful. I'm sure that this has to do something with resetting something in Mathematica everytime I make changes to the stylesheet. To ...
6
votes
1answer
169 views

How convert old version 2.2 .ma files to .nb notebooks?

I have a lot of old Mathematica version 2.2 .ma files that simply crash the current (10.4.1) version of Mathematica if I try to open them. Is there some way to ...
5
votes
3answers
290 views

Converting between AbsoluteTime and Unix time

By trial and error, I've found that the following gives the current Unix time: AbsoluteTime[] - UPOCH where UPOCH can be defined in any of the following ways: <...
5
votes
2answers
101 views

How can DateObject handle calender weeks

I have dates given for a TimeLinePlot. These dates are in {year,week} format. DateObject ...
5
votes
2answers
353 views

How do I remove the subscript after calling BaseForm[]?

Say I want to convert some number $N$ to base $k$. Here, I might use the command BaseForm[N,k], e.g.,BaseForm[10,...
5
votes
1answer
2k views

Combine multiple PDF files into one document

I have multiple single page PDFs I'd like to join together into a single file. (Obviously I mean the file format and not the probability distributions here!) I'm aware of free online services such as ...
5
votes
1answer
95 views

How to get “one Cell - one line” code format inside of NB files?

The PageWidth option controls the way the Cell's content is displayed, not the manner it's written in a ...
5
votes
1answer
163 views

Why Base64 ends with a newline? (\n)

Why everything converted to Base64 has a newline at the end? It isn't one of base characters, is it? ...
5
votes
1answer
80 views

Custom rules for expressions in export to HTML(Fragment)

ExportString[Grid[{{a, b}}], "HTMLFragment"] ...
5
votes
0answers
122 views

WDF specification?

Motivated by a recent question on the meaning of all sorts of W* acronyms, I would like to get more information about the Wolfram Data Framework (WDF). On its web page http://www.wolfram.com/data-...
4
votes
5answers
147 views

Convert a list with three arguments {x0,x1, step} into an equidistant table?

How can I convert a list such as: a = {1, 2, 0.1} into sequence so that I can pass them into a function, e.g. I want to be able to do something like this ...
4
votes
2answers
584 views

Conversion of 3D plot to 2D Contour Plot

Is it possible for Mathematica to convert a 3D plot into a 2D contour plot without having to recompute the values for each point? I realize that looking directly down at the 3D plot will be similar to ...
4
votes
4answers
2k views

Convert Integer to Real [duplicate]

Is there a preferred way of converting an Integer to a Real? What I'm using at the moment is ...
4
votes
1answer
69 views

convert MeijerG to form Standard Functions in Mathematica

I'd like to convert MeijerG[{{}, {1., 1.}}, {{0., 0., 4.}, {}}, -1. T λ] to its Standard Functions (For example Bessel function or ...). Any suggestion?
4
votes
5answers
156 views

How can I convert a Piecewise into a nested If?

For later conversion into a programming language where if is the only conditional construct, I would like to convert a Piecewise ...
4
votes
3answers
491 views

Converting inequalities to intervals

I have an inequality, ie: 1.57116 < g < 14.1405 There will be a large set of similar inequalities, and I want to find the intersection of them all. I figured it would be easier to convert the ...
3
votes
2answers
152 views

What's real analogue for FromDigits?

FromDigits only works for integer strings. What's its real-number analogue?
3
votes
1answer
86 views

Converting path list to the nested list

I'm trying to convert the plain path list to the nested tree list like the following codes. ...
3
votes
1answer
151 views

ConversionRules and style inheritance

Take the LaTeX-Article stylesheet stylesheet = FileNameJoin[{"Article","LaTeX-Article.nb"}]; Compare these outputs ...
3
votes
1answer
69 views

Whitespace is lost during MathML -> XMLElement conversion

ImportString["<mtext> </mtext>", {"MathML", "XMLElement"} ] XMLElement["mtext",{},{}] while I'd expect: <...
3
votes
1answer
233 views

Inline cells and conversion rules

In the following link you can find the following about ConversionRules when exporting to HTML: specifies mappings from Mathematica cell styles to HTML elements, ...
3
votes
1answer
52 views

An issue regarding the use of CopyToClipboard with dynamic content

Please, consider the following code: ...
2
votes
2answers
64 views

How do I extract the value of a 'Style'?

I have a Style displaying an underlying Real value. For example I might have ...
2
votes
1answer
144 views

Convert frequency counts to long notation in Mathematica

I have a series of frequencies of values, e.g. 5 times 1, 10 times 2 and 5 times 3, as in list={{1,5},{2,10},{3,5}} and I would like to convert this to long ...
2
votes
1answer
97 views

Can one prevent $\TeX$ conversion from changing form of expressions?

This is similar to my previous question Can one prevent operators like `Factor` or `Apart` from changing full form of some algebraic expressions? but concerns $\TeX$ and I cannot figure out whether I ...