Questions tagged [syntax-highlighting]
Questions about highlighting for Mathematica input in the Mathematica front-end, and Wolfram Workbench.
101
questions
4
votes
1
answer
51
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&...
9
votes
1
answer
530
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
...
31
votes
1
answer
530
views
What is ColorEqualSigns and how does one use it?
Bug introduced in 9.0.1 or earlier and persists in 13.2.1
I'm setting up the SyntaxInformation for a package I'm writing and I'm struggling to understand what the <...
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 ...
12
votes
2
answers
220
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 ...
1
vote
1
answer
365
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 ...
5
votes
1
answer
196
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 ...
1
vote
1
answer
52
views
ClearAll required twice on a symbol with SyntaxInformation
SyntaxInformation[f] = {"ArgumentsPattern" -> {}};
f[] := 0;
After one ClearAll[f] or ...
6
votes
1
answer
148
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 ...
2
votes
0
answers
60
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 ...
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 ...
0
votes
3
answers
611
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)
...
1
vote
0
answers
37
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 ...
11
votes
1
answer
234
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 ...
26
votes
2
answers
1k
views
Colored marks appearing in notebook input text?
Bug introduced in 10, persisting through 11.0.1 or later
What is the causing these colored marks to appear in my Mathematica notebook? I'm particularly annoyed with the black ovals that occasionally ...
19
votes
1
answer
169
views
Why does setting SyntaxInformation add a definition to DefaultValues
Before setting any definitions to the symbol f, the DefaultValues of f is empty:
...
2
votes
1
answer
117
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 ...
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 ...
0
votes
0
answers
122
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 ...
2
votes
0
answers
63
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, ...
2
votes
1
answer
109
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 ...
18
votes
3
answers
2k
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 ↔ b" as follows:
...
5
votes
1
answer
140
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,
...
5
votes
3
answers
239
views
How can I make a stylesheet where inline cells are styled like input cells?
How can I make a stylesheet where inline cells are styled like input cells? By "similar", I mean the same font and syntax highlighting.
I have even tried copying all settings from ...
1
vote
1
answer
52
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.
...
5
votes
1
answer
99
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 ...
9
votes
1
answer
1k
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 ...
3
votes
0
answers
75
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 (...
1
vote
2
answers
123
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 ...
6
votes
4
answers
194
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 ...
8
votes
3
answers
540
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 ...
4
votes
0
answers
96
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 ...
6
votes
1
answer
137
views
Odd colourization for FourierParameters. UI bug?
The Mathematica UI colourizes the FourierParameters in the following
...
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:
...
11
votes
1
answer
211
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[…...
24
votes
4
answers
3k
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? ...
12
votes
1
answer
226
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 ...
9
votes
1
answer
252
views
Automatization of SyntaxInformation and argx?
Does anybody have a good way to automate the setting of SyntaxInformation for any custom function? I have a ton of functions for which I want to set SyntaxInformation, and doing it by hand seems a ...
4
votes
1
answer
122
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?...
2
votes
1
answer
187
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 ...
6
votes
2
answers
158
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 ...
12
votes
1
answer
203
views
Syntax information "ArgumentsPattern" for function of function?
Is is possible to write SyntaxInformation of "ArgumentsPattern" for functions of the form:
...
14
votes
2
answers
4k
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?
7
votes
1
answer
452
views
Syntax Highlighting for WL files in Atom/Sublime?
What packages do people use for syntax highlighting in Atom, Sublime Text 3, etc?
7
votes
1
answer
143
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 ...
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 ...
26
votes
1
answer
340
views
SyntaxInformation cannot reproduce syntax coloring of Block
Is there any way to have the same syntax coloring with SyntaxInformation that Block has?
...
5
votes
0
answers
257
views
Syntax colouring when using Symbolize
I need to use symbols with suffixes in order to make my code readable in relation to the Eurocodes. To do this I use Symbolize from the ...
1
vote
1
answer
127
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 ...
8
votes
2
answers
1k
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 ...