How do I post Mathematica code in StackExchange properly? I read some instructions that told me I should copy the Mathematica code from the Mathematica notebook with Copy as > Plain text or Copy as > Input text, paste into the SE code editor pane, and put it between \$ \$,

When I did this I still did not get well-formated equations. For example, I got:

$ eq1[zz_, \[Beta]_] := 2*Subscript[\[Lambda], 1]*v1[\[Beta]]^2 $

So what did I miss?

Actually I still haven't found an answer. I followed the instruction in How to copy code from Mathematica so it looks good on this site

I did the following for a Mathematica cell that I wanted to post Mathematica.SE site. I convert the contents of the cell to Raw InputForm and then pasted intp SE editor between \$ $, like

$ eq1[zz_, \[Beta]_] := 2*Subscript[\[Lambda], 1]*v1[\[Beta]]^2 + 2*Subscript[\[Lambda], 2]*v2[\[Beta]]^2 $

Nothing, so I also tried to put between { }, like

{eq1[zz_, \[Beta]_] := 2*Subscript[\[Lambda], 1]*v1[\[Beta]]^2 + 2*Subscript[\[Lambda], 2]*v2[\[Beta]]^2 }

So I'm afraid I didn't understand the instructions in the referred post.

  • Welcome to Mathematica.SE! 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – user9660 Jan 6 '16 at 10:17
  • Let me try here, I convert the equation to : Raw InputForm, then past here between \$ $: $eq1[zz_, [Beta]_] := 2*Subscript[[Lambda], 1]*v1[[Beta]]^2 + 4*Subscript[[Lambda], 2]*v2[[Beta]]^2} $ or \{} {eq1[zz_, [Beta]_] := 2*Subscript[[Lambda], 1]*v1[[Beta]]^2 + 4*Subscript[[Lambda], 2]*v2[[Beta]]^2} – S.S. Jan 6 '16 at 10:46
  • Please look at my question, because I added. – S.S. Jan 6 '16 at 15:21
  • 2
    @S.S. I don't know where you saw you should the enclose code you copy from a notebook in \$ \$, but that is wrong and don't do it. – m_goldberg Jan 7 '16 at 0:11
  • Unless the code has special symbols or formatting, you can just copy it from your notebook and paste it into SE. If it is just a short piece of code, you can include it in a line of text by surrounding it by backquotes, as in x + y. However, it is a longer piece of code or you wish it to stand alone on a line, paste it into a blank line, highlight it, and click the {} symbol about the SE code editor box. (Equivalently, separate it from text by a blank line and indent it four spaces.) In this case, do not surround it by backquotes. Do not surround it by dollar signs unless you want LaTex. – bbgodfrey Jan 7 '16 at 3:45
  • On the other hand, if you have code with complex formatting, convert it to input form by using the Mathematica InputForm command, and then copy and paste the result. This leaves Greek letters to format properly. For many web viewers, use Halirutan's editor. See also my earlier question. – bbgodfrey Jan 7 '16 at 3:54
  • Thanx for the replies. – S.S. Apr 22 '16 at 18:25

Browse other questions tagged .