Questions tagged [syntax-highlighting]

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

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

$ContextAliases and symbol color

The example below shows that the symbol test`MyFunction is still in blue, which suggests that it is not defined. The color is defined in menu Edit > Preferences&...
ScotMartin's user avatar
9 votes
1 answer
538 views

Is it possible to make a custom syntax coloring for "=", "==", and "==="?

I have made this type mistake so many times: Which[a=b,expr1,True,expr2] as opposed to the intended but still correct syntax ...
Craig Carter's user avatar
  • 3,968
0 votes
0 answers
38 views

Syntax highlighting like Function?

I'd like to define a symbol that behaves similar to Function. Specifically, I want to define a new symbol symmetricFunction that ...
JEM_Mosig's user avatar
  • 2,953
5 votes
1 answer
219 views

Incorrect syntax highlighting? "Variables made special by use in arguments" not working

This example is obviously not useful on its own, but it will cover everything I actually need to know for a more complicated function I'm making. The example is to recreate the ...
Lucas Mumbo's user avatar
1 vote
1 answer
52 views

ClearAll required twice on a symbol with SyntaxInformation

SyntaxInformation[f] = {"ArgumentsPattern" -> {}}; f[] := 0; After one ClearAll[f] or ...
H.v.M.'s user avatar
  • 1,073
6 votes
1 answer
159 views

How to detect unused local variables?

I have some code (that I did not write) that has many unused local variables in Modules. I would like to clean this up. Is there any automated way to do this or to make it more clear that a local ...
Kvothe's user avatar
  • 4,197
2 votes
0 answers
61 views

Syntax highlighting for own functions only for certain symbols

For simplicity, let's say I have defined my own function f that takes in exactly one input argument which is of the Symbol type ...
bern's user avatar
  • 71
0 votes
0 answers
23 views

Delete exit comment on the left, and increase menu letter size,Any way to solve the problem?

I have 2 problems, I need to delete the output comments of a special calculation and also see if there is a way to please the letters of the MMA menu, I have searched and read but it has not been ...
BeTDa's user avatar
  • 480
0 votes
3 answers
766 views

Saving a notebook as PDF not working

I'm trying to save the notebook as PDF with working. I tried all methods in old threads but nothing works. Does anyone know how to make this work? (version 12.0.0.0, windows 64-bit) ...
emnha's user avatar
  • 2,411
1 vote
0 answers
38 views

Syntax highlighting for Symbolized variables in Solve

This is a duplicate of Syntax colouring when using Symbolize, but that post is almost eight years old and hasn't been active in almost four years. Is it possible to get normal syntax highlighting for ...
Matt Murphy's user avatar
11 votes
1 answer
239 views

Proper Syntax highlighting for multi-argument With?

For the case of Block and Module one can choose to define values in the body for the variable names being scoped. So there is no ...
user13892's user avatar
  • 9,113
1 vote
1 answer
394 views

Is it possible to make a notebook behave like text editor such as Sublime Text with regard to code formatting?

Can Mathematica, natively or otherwise, behave more like a conventional text editing tool such as Sublime Text or Notepad++ when it comes to code formatting and syntax highlighting? I have seen some ...
user27119's user avatar
  • 2,480
19 votes
1 answer
172 views

Why does setting SyntaxInformation add a definition to DefaultValues

Before setting any definitions to the symbol f, the DefaultValues of f is empty: ...
QuantumDot's user avatar
  • 19.5k
2 votes
1 answer
126 views

How can we change the Highlighted elements to a specific color?

edit I don't want highlighting, only font color. Sorry. I want the Highlighted elements to be Blue Font. I can't understand this suggested previous post. When I ...
Fred Daniel Kline's user avatar
2 votes
1 answer
52 views

Code not working when I'm breaking it up into different lines

The following code works perfectly For[i=1,i<4,i++,Print[i]] However, when I break this into different lines, it stops working. Moreover, the braces appear to ...
freebird's user avatar
0 votes
0 answers
129 views

Syntax-coloring specific to function heads

I've been playing around a lot with making a new style sheet with corresponding syntax colorings in the past few days, but I'm finding the default options pretty lacking. While you can use the ...
KHAAAAAAAAN's user avatar
2 votes
0 answers
75 views

Multiple lines of text are being highlighted every time I click

I've had this weird/annoying problem appear a few times now in Mathematica 10.4 where whenever I click, it highlights everything from the bottom of the cell to my cursor. If I click outside a cell, ...
cmm0052's user avatar
  • 195
2 votes
1 answer
110 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 ...
acoustics's user avatar
  • 1,699
5 votes
1 answer
148 views

Dynamic InputField with syntax highlighting?

I'm trying to create a notebook where a user can enter a Mathematica expression, and its syntax is analyzed (number of tokens, compressed size, etc.). Trying this answer, ...
lirtosiast's user avatar
1 vote
1 answer
53 views

Variable refactoring and multi-selection

In IDEs like PyCharm for Python, I can select a variable name or method name and it will highlight to show where all I have used it. Also its easy to refactor the names under a given text selection. ...
Rene Duchamp's user avatar
  • 1,419
5 votes
1 answer
109 views

How to set "SymbolContextStyles" for `$Context` symbols?

How to change the font colour of symbols defined in the current context (e.g. $Context) from black to some other colour, say purple? There is a ...
Edmund's user avatar
  • 41.7k
3 votes
0 answers
82 views

Installing pygments to be able to use lexer & highlighter for Mathematica

I'd like to try the lexer and highlighter for Mathematica that's based on Pygments, but I'm lost in a morass of getting Pygments installed. Here's what I have so far. I'm using MacPorts python37 (...
murray's user avatar
  • 11.8k
1 vote
2 answers
124 views

Input editor does not like my Thread over Circle expression

I am using Mathematica 11.3.0.0, 64 bit. Here is my code: Graphics[Thread[Circle[{{-1, 0}, {0, 0}, {1, 0}}, {0.5, 1.0, 0.5}]]] Here is code as it looks in a ...
vasili111's user avatar
  • 1,163
4 votes
0 answers
97 views

Highlight selected text everywhere?

Notebook++ has a very useful feature which highlights all occurrences of certain text once it has been selected with the mouse cursor in one spot: It is very useful in order to jump between different ...
Kagaratsch's user avatar
  • 11.9k
5 votes
0 answers
55 views

Reset SyntaxInformation completely

As was pointed out here clearing the SyntaxInformation isn't trivial to do. The best I was able to come up with for clearing it was: ...
b3m2a1's user avatar
  • 46.6k
11 votes
1 answer
212 views

Syntax information for pure functions

Mathematica's help on SyntaxInformation does not rule out syntax information for pure functions. SyntaxInformation[f] gives information used to generate syntax coloring and other advisories when f[…...
Hector's user avatar
  • 6,428
2 votes
1 answer
192 views

Why are `Control` variables indicated as undefined in the frontend?

Inside Manipulate, symbols defined in controls that are created by hand with Control are given "undefined" syntax coloring. For ...
orome's user avatar
  • 12.8k
4 votes
1 answer
127 views

Why does SyntaxInformation "ColorEqualSigns" color like wrong options?

In my copy of Mathematica 11.1, SyntaxInformation[f] = {"ColorEqualSigns" -> {1, 1}} colors like wrong options: How do I make it not color like wrong options?...
QuantumDot's user avatar
  • 19.5k
6 votes
2 answers
165 views

How to prevent front end from suggesting Symbol option names (when actually String), and from adding them to Global` context

Help! I am writing a package with a function which takes lots and lots of different options which are Strings. When used, the front end autocompletion is ...
QuantumDot's user avatar
  • 19.5k
7 votes
1 answer
455 views

Syntax Highlighting for WL files in Atom/Sublime?

What packages do people use for syntax highlighting in Atom, Sublime Text 3, etc?
M.R.'s user avatar
  • 31.2k
7 votes
1 answer
145 views

How to add a custom syntax error check

When Mathematica encounters a syntax error like a./b it generates a red bracket and highlights offending symbols with yellow background. I would like to add some ...
Ray Shadow's user avatar
  • 7,776
1 vote
0 answers
171 views

Demo for Pygments-Mathematica for static webpages? [closed]

Context So @rsmenon's pygments-mathematica looks awesome. Admittedly I still use minted for $\LaTeX$ documents... Anyway, I ...
SumNeuron's user avatar
  • 5,372
12 votes
2 answers
222 views

Customize syntax highlighting for a particular symbol

the comma in Chinese is different from that in English. But they are too similar. correct English comma incorrect Chinese comma As a non-English user, we have to switch the input quite often. If I ...
matheorem's user avatar
  • 17k
1 vote
1 answer
128 views

Saving a notebook as CDF, preserving syntax highlighting

My question is virtually the same as Saving a notebook as PDF, preserving syntax highlighting except that I'd like to save my file (a tutorial on Mathematica) as a .CDF file and thus keep the syntax ...
Sascha's user avatar
  • 8,399
3 votes
1 answer
109 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 ...
masterxilo's user avatar
  • 5,689
12 votes
1 answer
227 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 ...
QuantumDot's user avatar
  • 19.5k
11 votes
2 answers
257 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 ...
MaTECmatica's user avatar
2 votes
3 answers
483 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. ...
Marion's user avatar
  • 419
1 vote
1 answer
221 views

Mathematica code to $\LaTeX$ [duplicate]

...
zermelovac's user avatar
6 votes
1 answer
166 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 ...
Louis Yu's user avatar
  • 837
5 votes
1 answer
189 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 ...
Markus's user avatar
  • 51
0 votes
2 answers
127 views

Function input syntax [closed]

My functions are ...
Mary's user avatar
  • 359
14 votes
1 answer
517 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 ...
Szabolcs's user avatar
  • 233k
8 votes
3 answers
571 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 ...
Berg's user avatar
  • 1,059
2 votes
0 answers
81 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 ...
rhennigan's user avatar
  • 1,783
6 votes
4 answers
212 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 ...
halirutan's user avatar
  • 112k
7 votes
1 answer
174 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 ...
egwene sedai's user avatar
  • 2,305
4 votes
0 answers
61 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 after ...
Taiki's user avatar
  • 5,209
1 vote
1 answer
544 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 ...
Chris Chudzicki's user avatar
1 vote
0 answers
63 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 ...
Jacob Akkerboom's user avatar