Questions about highlighting for Mathematica input in the Mathematica front-end, and Wolfram Workbench.

learn more… | top users | synonyms

3
votes
1answer
58 views

Why does syntax highlighting in `Set` and `Rule` not color pattern names on the RHS?

The mathematica front-end colors x on the right hand side of x_ :> x and f[x_] := x but ...
7
votes
0answers
102 views

Is there a syntax coloring type that highlights only when not in a list?

How do I define the syntax coloring of local variable of function myfunc so that it only colors the variable that is not in a ...
11
votes
2answers
164 views

How to correctly implement in a new function the scoping behavior of Table, Sum and other commands that use Block to localize iterators?

It is documented that "Block is automatically used to localize values of iterators in iteration constructs such as Do, Sum, and Table." Therefore the dummy index (iterator) in a Sum is shielded ...
3
votes
1answer
205 views

Is it possible to change the fontsize when printing a notebook in the working environment?

I want to print a notebook that owns syntax color,I use the Szabolcs's method SetOptions[$FrontEndSession, PrintingStyleEnvironment -> "Working"] Then I can ...
4
votes
2answers
125 views

Syntax highlighting in text cells

I want to write some documentation for a notebook using text cells. Now, I can select parts of the text within such a text cell and set its style to "Input". This does change its font, but there is no ...
1
vote
3answers
55 views

Can highlight an expression in mathematica in an expansion?

I ask mathematica to make an expansion of some expression. Is there a way to ask mathematica to highlight all terms that, say, goes by x^3 since it is really hard to find them? E.g. ...
28
votes
3answers
856 views

Highlighting Mathematica code in $\LaTeX$ document

I was thinking about the best way to include Mathematica code in a $\LaTeX$ document with a nice syntax highlighting. I have tried the packages listings and minted (with pygments), which both claim ...
22
votes
0answers
266 views

What is ColorEqualSigns and how does one use it?

I'm setting up the SyntaxInformation for a package I'm writing and I'm struggling to understand what the "ColorEqualSigns" ...
38
votes
4answers
2k views

Saving a notebook as PDF, preserving syntax highlighting

Currently, one may save notebooks as PDFs from the menu by Save As... and then selecting PDF (on a Mac, I imagine it is similar on other OSs). However, the ...
6
votes
1answer
96 views

How to recognize variables like built-in functions?

Many built-in functions can recognize variables. For example, function 'Table' makes its iterator change color. How can I implement a function that has a similar behavior? In this function, I can pass ...
5
votes
1answer
50 views

SyntaxInformation and Options

I wonder if the following behaviour of SyntaxInformation is a bug: I want a function f to accept one argument and options, so I ...
6
votes
1answer
91 views

Update/refresh notebook variable color on clear

By default, Mathematica displays variable names already assigned as black while new variables are displayed in blue. When executing Clear["Global`*"], variables ...
0
votes
0answers
39 views

Option ItemAspectRatio in GraphicsGrid has weird behaviour in MMA 10.3

Has anybody noticed that the Option ItemAspectRatio in GraphicsGrid is no longer valid? It ...
13
votes
1answer
742 views

High Contrast Syntax-Highlighting

I have a neurological disorder which causes me to have migraines if I look at a white computer screen. To combat this, I have put the following at the top of all of my Mathematica notebooks: ...
6
votes
2answers
80 views

Nested list of patterns in SyntaxInformation “ArgumentsPattern”

I have a function with the following input structure: f[{{a1, n1}, {a2, n2}...}, {i1, i2,...}] The first argument is a List ...
65
votes
3answers
2k views

Syntax highlighting for your own functions

Mathematica has a useful feature that for functions and special constructs getting passed local variables (for example Minimize or ...
9
votes
1answer
157 views

SyntaxInformation: take allowed options from multiple symbols – possible?

Suppose I have a function like Options[f] = {foo -> 1}; f[opt : OptionsPattern[{f,g}]] := h@g[Sequence @@ FilterRules[{opt}, Options[g]]] I purposefully do ...
22
votes
1answer
3k views

Why are some function names red?

I need to evaluate Needs["GraphUtilities`"] before I can use functions such as GraphPath[]. When I do so, some functions get ...
15
votes
0answers
357 views

Colored marks appearing in notebook input text?

Bug introduced in 10, persisting through 10.2 What is the causing these colored marks to appear in my Mathematica notebook? I'm particularly annoyed with the black ovals that occasionally obscure ...
4
votes
1answer
128 views

Is there really a bug in the following code, taken from the reference documentation for PetersenGraph?

Bug introduced in 9.0.0 and fixed in 10.0.0 PetersenGraph[5, 2, EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"}] appears to evaluate perfectly, as ...
25
votes
1answer
321 views

StringCases is Confused with Patterns in Version 10.0.1

Bug introduced in 10.0.1 and fixed in 10.0.2 I observed the following with StringCases when trying to use rules/patterns. Here is a screenshot of the behavior: ...
14
votes
2answers
1k views

How can one define an infix operator with an arbitrary unicode character?

You can setup "UsefulFunction[a, b]" to use custom infix notation "a [LeftRightArrow] b" as follows: ...
1
vote
0answers
36 views

How to disable OperatorSubstitution in a style sheet without losing syntax highlighting for local variables

I'm trying to define a custom style sheet that has "OperatorSubstitution" set to false in order to keep fonts consistent. However, whenever I disable this, I lose ...
5
votes
3answers
94 views

Output code not highlighted when used as input

I have reported this issue: [CASE:3389542] Today, I accidentally found what I believe is an unwanted feature of the front-end, where input code is not appropriately highlighted and the dynamic ...
21
votes
3answers
1k views

How to program a F::argx message?

How useful is it to program a user-built function in a package to produce a red warning message F::argx if you give the wrong number of arguments to that function? ...
9
votes
1answer
470 views

Syntax Highlighting for Mathematica on a Blog

Every once in a while I want to paste Mathematica code on my blog. When I do, I would like it to be somewhat readable, and it would be nice to have syntax highlighting. So far all my searches have ...
4
votes
0answers
57 views

Mathematica doesn't italicise a function's argument in the function's body if it appears in the denominator and the denominator is edited. A bug?

Bug introduced in 10.0.0 and persisting through 10.1.0 or later I'm using Mathematica 10.0.2 for Mac. On a fresh kernel, I type this: a is not italicised ...
1
vote
1answer
58 views

Module and Manipulate: Why the Red Highlighting? [duplicate]

If I define a function that returns a Manipulate object, and the Manipulate has a local variable inside of it, the local ...
18
votes
1answer
1k views

What is available for editing Mathematica source code with Emacs?

I can find several Emacs libraries for Mathematica, but I'm not aware of a clear favourite, a definitive list, or of a library which is actively maintained and developed. None of these appear to be in ...
1
vote
0answers
43 views

Syntax highlighting of RuleDelayed involving Orderless symbols

I am using version 10.0.2 If I set SetAttributes[ol, Orderless] Then the following expression appears to be highlighted incorrectly after clicking in it (no ...
8
votes
0answers
68 views

Syntax information “ArgumentsPattern” for function of function?

Is is possible to write SyntaxInformation of "ArgumentsPattern" for functions of the form: ...
2
votes
1answer
71 views

Error with comments inside and expression

I found this strange parsing error with comments inside of an expression in Version 7. And example is {{1, x}, {1, y} (* {1, z (= 5+6)} *)}; It occurs depending ...
5
votes
2answers
114 views

How to robustly apply ToBoxes to a Dynamic expression?

Inserting a Dynamic object in a boxform expression messes up syntax colouring. See the following example. where the variable ...
4
votes
2answers
121 views
1
vote
1answer
67 views

Overloading ClearAll[] to take no arguments

I use the command ClearAll["Global`*"] so much that I thought it would be nice to have a function that called it. Since by default ClearAll requires an ...
2
votes
1answer
112 views

Having variables appear aqua in user defined function [duplicate]

In many of the inbuilt mathematica function, variables appear aqua like in: However, when creating your own function, variables no longer have that green coloring and are instead colored like an ...
8
votes
1answer
594 views

Solarized stylesheet and other goodies. Feedback welcome!

I was inspired by this post so I've made a Solarized stylesheet after mucking around with the text options and asking stupid questions on here. I know you can change the syntax highlighting by running ...
5
votes
2answers
225 views

Syntax highlighting conflict

I'm trying to syntax highlight this expression: x=$\sqrt{\pi }$//N and from various sources I've learned that x (the assigned symbol) belongs to context Global while the Pi and N belongs to System. So ...
0
votes
0answers
98 views

My “N” turned red randomly [duplicate]

For some reason my N function showed up in red even though I haven't noticed it in that color before. The color actually makes the code much more readable but I just don't know if I should be alarmed ...
4
votes
1answer
131 views

Highlight the same symbol throughout notebook

Once I saw people using Matlab use a keystroke shortcut that made all the same symbols as a selected symbol become blue. I am wondering is there is a function in Mathematica that is similar. If so, ...
8
votes
1answer
113 views

Does the syntax coloring I see indicate a real problem?

I need a behaviour provided by: x = 2; Block[{x = HoldForm[x]}, x] x FrontEnd marks ...
4
votes
1answer
829 views

What's the difference between variables with and without a subscript?

If I input $x = a + b$, the $x$, $a$ and $b$ are blue. When I hit Shif+Enter, the $x$ turns black, indicating the kernel now knows this variable. But when I input $x_r = a + b$, and hit Shift+Enter, $...
9
votes
2answers
2k views

Why is this semicolon in red?

I have a piece of code that works well, but when I put a semicolon after a plotting statement, the semicolon appears in red. What's the error?
1
vote
0answers
91 views

Why has my syntax coloring changed?

Local variables in Module are no longer specially colored for me, but other syntax coloring remains, for example iterators in a ...
1
vote
1answer
106 views

Custom highlighting in definitions

Suppose we defined a pattern with custom pattern name provided by user, like Quiet[myCustomPattern@terms_ := f[terms : (_[_, _])..]] for use in further ...
5
votes
1answer
101 views

Syntax formatting when Condition is used with Blank

Consider the following codes: x_/;x>y Condition[x_,x>y] Condition[Pattern[x,Blank[]],x>y] All the three codes are equivalent. As we can see, in the ...
1
vote
0answers
91 views

Is there any other built-in color scheme for highlighting text?

Blue variable name and black key words seem boring to me now. I find that the color scheme of this site is better. Can I apply that in my notebook?
13
votes
0answers
91 views

SyntaxInformation cannot reproduce syntax coloring of Block

Is there any way to have the same syntax coloring with SyntaxInformation that Block has? ...