Message Boards Message Boards

Why can't multiline comments be aligned in Mathematica notebook?

Posted 3 years ago

I'm very confused that why the multiline comments can't be aligned in Mathematica notebook. See the attached notebook for more information.

What is the problem with my settings and usage?

Regards,
HZ

Attachments:
POSTED BY: Hongyi Zhao
3 Replies

Regular comments seem to be formatted somewhat like input code. I sometimes do two different things when I wish to avoid this, which I, too, find rather dissatisfying.

  1. I type the comment in a text cell, select the cell bracket, copy the cell, and paste the cell between comment markers (* *).
  2. I put the comment in quotes: (*" comment... "*). This is the one I use most often.

See figure:

enter image description here

POSTED BY: Michael Rogers
Posted 3 years ago

You can devide the cell into two cells, the first one holding the URLs and the second on the calculation. Then you format the 1st cell as "text" and not as "input" -> the URLs are nicely aligned. Now you could also drop the comment statement and you get as benefit the possibility that you can now use the URLs for navigation just by clicking

POSTED BY: Michael Helmle
Posted 3 years ago

You could make each line a separate comment. Like this :

(* https://mathematica.stackexchange.com/questions/159808/commutator-of-gamma-matrices *)
(* https://mathworld.wolfram.com/DiracMatrices.html *)
(* https://en.wikipedia.org/wiki/Gamma_matrices *)
Table[Internal`DiracGammaMatrix[k, "Basis" -> "Chiral"] // MatrixForm, {k, 4}]
Table[Internal`DiracGammaMatrix[k, "Basis" -> "Dirac"] // MatrixForm, {k, 4}]
Table[Internal`DiracGammaMatrix[k, "Basis" -> "Majorana"] //  MatrixForm, {k, 4}]

If you copy this snippet to a notebook you have to add a line feed feed after each comment line.

POSTED BY: Hans Milton
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