minted: why are field variables colored and how can I change that for Java code?
As a minimal example I would want to highlight the following code:
(new Thread(() -> {
System.out.println("Hello");
})).start();
Given the MWE:
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
I get something like this:

where for some reasons, the field variables/functions are highlighted in red. I would like to remove this "highlighting-rule" or however it is being called.
Therefor I've been searching the minted docs(minted docs), but couldn't find any option to change the color of field variables
I've also been searching the pygment docs (pygment docs), but couldn't figure out yet what token identifiers belong to which specific rule.
I would be happy if I could stick to minted, as it is simple and seems to be quite smart, but also, if that's even possible, I would prefer answers using options that I can pass to the begin.. environment.
minted syntax-highlighting java
add a comment |
As a minimal example I would want to highlight the following code:
(new Thread(() -> {
System.out.println("Hello");
})).start();
Given the MWE:
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
I get something like this:

where for some reasons, the field variables/functions are highlighted in red. I would like to remove this "highlighting-rule" or however it is being called.
Therefor I've been searching the minted docs(minted docs), but couldn't find any option to change the color of field variables
I've also been searching the pygment docs (pygment docs), but couldn't figure out yet what token identifiers belong to which specific rule.
I would be happy if I could stick to minted, as it is simple and seems to be quite smart, but also, if that's even possible, I would prefer answers using options that I can pass to the begin.. environment.
minted syntax-highlighting java
1
Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) includingdocumentclassand the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.
– samcarter
6 hours ago
Thank you so much for your hint! I'll do my best to remember for the next time.
– marcoPolio
6 hours ago
1
The relevant line inborland.pygstyleseems to beexpandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}-- however I don't yet know how to influence this colour from within the document.
– samcarter
4 hours ago
wow, thanks a lot! actually putting that line before begin{document} was all I needed, as I wanted to change the behavior globally! if you want, you can post your answer so I can accept it :)
– marcoPolio
4 hours ago
Can you write a self-answer instead?
– samcarter
4 hours ago
add a comment |
As a minimal example I would want to highlight the following code:
(new Thread(() -> {
System.out.println("Hello");
})).start();
Given the MWE:
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
I get something like this:

where for some reasons, the field variables/functions are highlighted in red. I would like to remove this "highlighting-rule" or however it is being called.
Therefor I've been searching the minted docs(minted docs), but couldn't find any option to change the color of field variables
I've also been searching the pygment docs (pygment docs), but couldn't figure out yet what token identifiers belong to which specific rule.
I would be happy if I could stick to minted, as it is simple and seems to be quite smart, but also, if that's even possible, I would prefer answers using options that I can pass to the begin.. environment.
minted syntax-highlighting java
As a minimal example I would want to highlight the following code:
(new Thread(() -> {
System.out.println("Hello");
})).start();
Given the MWE:
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
I get something like this:

where for some reasons, the field variables/functions are highlighted in red. I would like to remove this "highlighting-rule" or however it is being called.
Therefor I've been searching the minted docs(minted docs), but couldn't find any option to change the color of field variables
I've also been searching the pygment docs (pygment docs), but couldn't figure out yet what token identifiers belong to which specific rule.
I would be happy if I could stick to minted, as it is simple and seems to be quite smart, but also, if that's even possible, I would prefer answers using options that I can pass to the begin.. environment.
minted syntax-highlighting java
minted syntax-highlighting java
edited 6 hours ago
marcoPolio
asked 6 hours ago
marcoPoliomarcoPolio
255
255
1
Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) includingdocumentclassand the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.
– samcarter
6 hours ago
Thank you so much for your hint! I'll do my best to remember for the next time.
– marcoPolio
6 hours ago
1
The relevant line inborland.pygstyleseems to beexpandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}-- however I don't yet know how to influence this colour from within the document.
– samcarter
4 hours ago
wow, thanks a lot! actually putting that line before begin{document} was all I needed, as I wanted to change the behavior globally! if you want, you can post your answer so I can accept it :)
– marcoPolio
4 hours ago
Can you write a self-answer instead?
– samcarter
4 hours ago
add a comment |
1
Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) includingdocumentclassand the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.
– samcarter
6 hours ago
Thank you so much for your hint! I'll do my best to remember for the next time.
– marcoPolio
6 hours ago
1
The relevant line inborland.pygstyleseems to beexpandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}-- however I don't yet know how to influence this colour from within the document.
– samcarter
4 hours ago
wow, thanks a lot! actually putting that line before begin{document} was all I needed, as I wanted to change the behavior globally! if you want, you can post your answer so I can accept it :)
– marcoPolio
4 hours ago
Can you write a self-answer instead?
– samcarter
4 hours ago
1
1
Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) including
documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.– samcarter
6 hours ago
Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) including
documentclass and the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.– samcarter
6 hours ago
Thank you so much for your hint! I'll do my best to remember for the next time.
– marcoPolio
6 hours ago
Thank you so much for your hint! I'll do my best to remember for the next time.
– marcoPolio
6 hours ago
1
1
The relevant line in
borland.pygstyle seems to be expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}} -- however I don't yet know how to influence this colour from within the document.– samcarter
4 hours ago
The relevant line in
borland.pygstyle seems to be expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}} -- however I don't yet know how to influence this colour from within the document.– samcarter
4 hours ago
wow, thanks a lot! actually putting that line before begin{document} was all I needed, as I wanted to change the behavior globally! if you want, you can post your answer so I can accept it :)
– marcoPolio
4 hours ago
wow, thanks a lot! actually putting that line before begin{document} was all I needed, as I wanted to change the behavior globally! if you want, you can post your answer so I can accept it :)
– marcoPolio
4 hours ago
Can you write a self-answer instead?
– samcarter
4 hours ago
Can you write a self-answer instead?
– samcarter
4 hours ago
add a comment |
1 Answer
1
active
oldest
votes
thanks to samcarter, I found out that adding the line expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}} before begin{document} already did what I wanted (though not quite sure why)
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
The output,as intended, is:

add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482818%2fminted-why-are-field-variables-colored-and-how-can-i-change-that-for-java-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
thanks to samcarter, I found out that adding the line expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}} before begin{document} already did what I wanted (though not quite sure why)
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
The output,as intended, is:

add a comment |
thanks to samcarter, I found out that adding the line expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}} before begin{document} already did what I wanted (though not quite sure why)
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
The output,as intended, is:

add a comment |
thanks to samcarter, I found out that adding the line expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}} before begin{document} already did what I wanted (though not quite sure why)
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
The output,as intended, is:

thanks to samcarter, I found out that adding the line expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}} before begin{document} already did what I wanted (though not quite sure why)
documentclass{article}
usepackage{minted}
usemintedstyle{borland}
expandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}
begin{document}
begin{minted}{Java}
(new Thread(() -> {
System.out.println("Hello");
})).start();
end{minted}
end{document}
The output,as intended, is:

answered 32 mins ago
marcoPoliomarcoPolio
255
255
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f482818%2fminted-why-are-field-variables-colored-and-how-can-i-change-that-for-java-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome to TeX.SE. It would be helpful if you composed a fully compilable minimal working example (MWE) including
documentclassand the appropriate packages that sets up the problem. While solving problems can be fun, setting them up is not. Then, those trying to help can simply cut and paste your MWE and get started on solving the problem.– samcarter
6 hours ago
Thank you so much for your hint! I'll do my best to remember for the next time.
– marcoPolio
6 hours ago
1
The relevant line in
borland.pygstyleseems to beexpandafterdefcsname PYGborland@tok@naendcsname{defPYGborland@tc##1{textcolor[rgb]{1.00,0.00,0.00}{##1}}}-- however I don't yet know how to influence this colour from within the document.– samcarter
4 hours ago
wow, thanks a lot! actually putting that line before begin{document} was all I needed, as I wanted to change the behavior globally! if you want, you can post your answer so I can accept it :)
– marcoPolio
4 hours ago
Can you write a self-answer instead?
– samcarter
4 hours ago