Message Boards Message Boards

1
|
7751 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

What is "Code" format for a cell?

Posted 9 years ago

On opening the window with Format|Style there is something called "Code" between "Text" and "Input". Could someone illustrate me on its meaning?

-Tomas

POSTED BY: Tomas Garza
4 Replies

In regular Mathematica one would normally use Input cells.

Code cells are used in package.m files. They contain the code for the routines, not Input cells. You can switch between the two cell types by selecting the right hand cell bracket and using Alt+8 (for Code) or Alt+9 (for Input}. Old inactive code can be saved as Input cells in packages. It is sometimes useful to swtich package usage Code cell to Input for editing. I find that switching from Code to Input cells for editing regular code is a problem. Maybe it's the disparity in AutoIndent. But one can use Returns and spaces to pretty print Code cells and maybe higher magnification.

Also remember that one can use Title, Section and Text cells in package files so they can be well organized and formatted.

Thank you, Dave. As always, your comments are extremely valuable.

POSTED BY: Tomas Garza

Thanks a lot, Nasser. Most helpful.

POSTED BY: Tomas Garza

As far as I know, the only difference between code cell and input cell (the default) is that in code cell, it has AutoIndent->False, InitializationCell->True,PageWidth->Infinity. I only use code cell when I want free formatting (i.e. no AutoIndent). But you can change the input cell options actually and change this option if you want.

Basically, if you use code cell, it acts the same as input cell (except for those 3 differences above).

POSTED BY: Nasser M. Abbasi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract