Questions tagged [comment]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
4 votes
1 answer
74 views

Change color of text in comments inside Input cell

I've made my research in how to change the color of comments inside an input cell. I've tried it all and nothing seems to work as it should. First, I am using a Stylesheet, not the default looking ...
user avatar
0 votes
1 answer
294 views

Red Square Appears when Writing Asterisk

I am creating a new variable "t", and when I go to define it and then comment on what it represents, I type " t = 2 (* " and immediately after I type the asterisk, a red square ...
user avatar
  • 1
1 vote
0 answers
57 views

.m files saving with comments [duplicate]

So I have posted a few questions on loading packages, because it is so simple, yet always failing for me. I made a new file Streams.m in the directory ~/Library/Mathematica/Applications/, which is in <...
user avatar
  • 101
2 votes
0 answers
43 views

Why do comments sometimes become Null instead of being removed completely?

Consider the following definition: Piecewise[{{(*comment*)-1, x > 0}, {0, True}}] This is interpreted as intended, with the comment being simply removed, ...
user avatar
  • 6,942
12 votes
1 answer
523 views

How do I remove all comments in a Mathematica notebook?

Is there an option to delete every comment enclosed within (* *)s for a whole notebook? Or is it possible to do it with some string processing?
user avatar
  • 1,257
2 votes
1 answer
107 views

Syntax highlighting indicates I'm unable to comment properly in Mathematica using (**)

I wanted to "comment" some code so the input inside (* *) is ignored. I tried this but the last term z[3] looks like it is not ...
user avatar
  • 1,669
5 votes
1 answer
81 views

Does the position of a comment in a CompoundExpression matter for the result obtained with Out (%)?

I would like to understand what happens when we include a comment at the end of a line that ends with a semicolon. For example, if you execute ...
user avatar
  • 191
5 votes
0 answers
132 views

Is there any way to align both codes and comments?

a=4; (*length*) b=5; (*width*) s=a*b; (*area*) Is there any way to align the code above left and also align the comments? Now it looks ...
user avatar
  • 957
18 votes
1 answer
442 views

Add spaces to Mathematica comment delimiters?

Not exactly the world's most pressing problem, but one that has now exceeded my tolerance level. If I comment out a line of input such as f[x_]:=x+1; with Alt-/ (...
user avatar
  • 2,410
2 votes
1 answer
248 views

Select all text in input cell to comment out

I am wondering if there is any shortcut to select all text in the input cell to comment out. Normally to comment a line, I type all the line then use mouse to select all text and then press ...
user avatar
  • 2,419
3 votes
1 answer
75 views

Include comments in exported XML file

When exporting an XMLObject (using Export/ExportString), is there any way to include a ...
user avatar
  • 227k
5 votes
4 answers
829 views

Automatically use blue color for comments in input cell

Currently, when I type comments into input cell the comment has the same color or style as the function color/style as shown in figure number 1. I would like to automatically use blue color for my ...
user avatar
  • 2,419
1 vote
1 answer
1k views

What is Mathematica's comment-to-line-end token? [duplicate]

How can I make a full line of code into a comment by typing a single character inserted at start of the line? In other programming languages I can use characters such as ! , # and language processor ...
user avatar
  • 2,820
2 votes
1 answer
1k views

Adding code comments to a module [closed]

What is the best way to comment a long Module? For linear flowing calculations that need not be organised in modules, I usually mix text and math. But how can I do that inside a module, or block, or ...
user avatar
  • 16.1k
3 votes
1 answer
367 views

Tab in Input cell

Why is it impossible to use tab to indent e.g. an inline comment i.e. (* ... *) in an Input cell? However, I have seen that it is possible, if I use Cell>ConvertTo>TextDisplay. The cell remains ...
user avatar
7 votes
2 answers
181 views

Undo history cleared after removing comments - bug?

If I've written some code followed by a comment, like this: x(*y*) and I remove the comment by first removing the right delimiter and then the left, my undo ...
user avatar
  • 1,073
24 votes
4 answers
3k views

Why does a comma insert a line break in a comment?

I like to include capital letters and punctuation in my comments. But when I put a comma into a Mathematica comment of the (* ... *) type, it usually causes the comment line to break, with a new line ...
user avatar
6 votes
2 answers
142 views

Annotation specifier like :Author: and sectioning like ::Section:: in package code

In packages, there is a special way to make basic formatting and annotation within normal comments. Here is another question related to annotation. Package file headers usually contain information ...
user avatar
  • 111k
2 votes
0 answers
71 views

Is there any metadata-holding mechanisms in Mathematica programming similar to Java annotations?

I'm re-implementing some tools previously implemented in Java in Wolfram Language. Is there any metadata-holding mechanisms in Mathematica programming similar to Java annotations?
user avatar
  • 8,424
21 votes
1 answer
22k views

What is the comment shortcut?

I went to a Wolfram Technologies workshop a few weeks ago and the presenter showed us a keyboard shortcut that when a block of input is selected, the shortcut puts the block of selected input in ...
user avatar
  • 1,702
7 votes
2 answers
372 views

Behaviour of out (%%...%) with comments

Can please someone explain to me the diffrent behavior of this code (6 - 3); (5 - 3); (4 - 3); {%%%, %%, %} Out= {3, 2, 1} and this one ...
user avatar
  • 1,553
1 vote
1 answer
139 views

How to programmatically comment out multiple source files?

How to programmatically comment out the entire content of multiple .m source files assuming they start with correct Mathematica syntax? I need it to be robust so ...
user avatar
  • 8,424
4 votes
1 answer
186 views

Unexpected result when reading Cell with comment-lines by NotebookRead

Bug introduced in 9.0 and fixed in 9.0.1 When considering this question about re-formatting Cell (also this one), I encountered an issue which confuses me. I'll ...
user avatar
  • 26.7k
9 votes
1 answer
273 views

Converting to InputForm or StandardForm without deleting comments

Following on from this question: Is it possible to convert an expression to InputForm or StandardForm without losing the comments? For example, ...
user avatar
  • 3,643
3 votes
5 answers
685 views

How to write a function to remove comments from a .m source file preserving formatting such as line wrapping reasonably?

How to write a function to remove comments from a .m source file preserving formatting such as line wrapping reasonably? This means if I have ...
user avatar
  • 8,424
78 votes
4 answers
115k views

Is there a syntax for single-line comments for notebooks?

I'm aware that I can use (* ... *) to comment out stuff in a notebook. Many languages have a syntax for single-line comments, such as ...
user avatar
  • 6,228