Any Chance of Improving Code Display in Community Posts?

It can sometimes be cumbersome to decipher code that appears differently than it does in a Mathematica notebook. For example,

(-1)^k/Sqrt[1.5^k] Sin[(-1)^k Sqrt[1.5^k] t]

as compared to

dfg.jpg

Any chance that we will be able to post and view code on community posts exactly as it appears in Mathematica?

2 Likes

The Community code formating is a good balance between displaying code and being able to copy-paste it without errors into Mathematica or Wolfram Cloud notebook. For most of the cases Community code formating here does a good job. For the cases when more math-like formating is needed we recommend also (in-addition) using an image, as you did yourself. Or you can use MathJax and TeXForm and symbol $:

TeXForm[(-1)^k/Sqrt[1.5^k] Sin[(-1)^k Sqrt[1.5^k] t]]

\frac{(-1)^k \sin \left((-1)^k \sqrt{1.5^k} t\right)}{\sqrt{1.5^k}}

so using the above TeX between $ you get:

\frac{(-1)^k \sin \left((-1)^k \sqrt{1.5^k} t\right)}{\sqrt{1.5^k}}

More detailed information is in the tutorial that is linked from the top of main page:

READ FIRST: How to post and use Wolfram Community

2 Likes

I guess why the former is preferred over the latter is because the former is copy-pasteable, while the latter is not.
You can however add formulas in TeX:

(-1)^k/Sqrt[1.5^k] Sin[(-1)^k Sqrt[1.5^k] t] // TeXForm

and pasting that between dollar signs here:

\frac{(-1)^k \sin \left((-1)^k \sqrt{1.5^k} t\right)}{\sqrt{1.5^k}}

EDIT: strange I didn’t see the above post! Now it appeared!

1 Like