9
$\begingroup$

Following on from this question: Is it possible to convert an expression to InputForm or StandardForm without losing the comments?

For example,

f[blah_] := Cos[blah] (* this is a comment *)
f[blah2_] := Cos[blah2] (* this is also a comment *)

selecting the cell and pressing Shift+Ctrl+N gives,

f[blah_] := Cos[blah] 
f[blah2_] := Cos[blah2]
$\endgroup$
5
  • 3
    $\begingroup$ Not that I am aware of, but there may be an undocumented function that does this. You never know. $\endgroup$
    – Mr.Wizard
    Feb 25, 2013 at 12:47
  • $\begingroup$ How would you format, for example, (Sum(* boo *))[x, x] in standard form? $\endgroup$
    – Rojo
    Feb 25, 2013 at 20:56
  • 1
    $\begingroup$ @Rojo I would like to turn it into a ToolTip :) $\endgroup$
    – Silvia
    Feb 26, 2013 at 3:18
  • 1
    $\begingroup$ @Silvia then we want to convert it into SilviaForm :). Tooltip of the big sigma? I'm just thinking that the specifications are not so automatic $\endgroup$
    – Rojo
    Feb 26, 2013 at 12:31
  • $\begingroup$ @Rojo TemplateBox[{"x","boo",ToBoxes[f[x]]},"commentedSum",DisplayFunction:>(RowBox[{TooltipBox[UnderscriptBox["\[Sum]",#1],#2],#3}]&)]//RawBoxes :) btw SilviaForm is a great name! I'll consider using it somewhere ;) $\endgroup$
    – Silvia
    Feb 26, 2013 at 18:57

1 Answer 1

2
$\begingroup$

If you highlight the code you wish to convert (one line at a time) and right click, then Convert To: this might be what your looking for.

$\endgroup$
1
  • $\begingroup$ Make Sure you do not highlight the comments. $\endgroup$
    – Bob Brooks
    Apr 22, 2013 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.