3

I would modify CForm as follows: Unprotect[Power]; Format[Power, CForm] := pow Protect[Power]; Format[unquotedString[s_], CForm] := Format[s, OutputForm] Then: With[{e = expr}, ToString[HoldForm[unquotedString["double variable"] = e], CForm, PageWidth->80] ] "double variable = -((a*b*pow(y,2)*(-1 + z)*z*(1 + a*b + z))/pow(1 + a*b,...


2

I'm not sure that the code is clean, but once I had to make a graph that has a fixed size in all layers (except those with one node). I put it as is just for diversity reasons, may be it will inspire somebody. nList = {2, 7, 9, 1}; (* nodes by layers *) Main functions: nEmbed[nList_List] := Module[{list, nRagged, ragged}, nRagged[list_List] := ...


1

Thanks again Carl Woll for the push in the right direction with pursuing ContentPadding further. It turns out that ContentPadding does allow using a Framed/Pane to tightly wrap an expression, including within a Grid, if you have a couple settings specified. Solution: First, I needed to specify Spacings->{0,0} explicitly, instead of using Spacings->0. ...


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