Questions tagged [syntax-highlighting]

For questions about highlighting document source code in your editor.

Filter by
Sorted by
Tagged with
3
votes
1answer
118 views

Syntax highlighting for semantex?

I don't know how to get syntax highlighting in TeXstudio (windows 10) with semantex. I found some guides on the internet but I'm not a programmer so not sure how to do it. Can someone help me?
0
votes
0answers
14 views

Is there a way to make $ and & have different colors in the TeXShop editor?

I'm using a lot of equations in a tabular environment, and it's hard to tell apart the $ math mode symbols from the & alignment symbols because they're both orange. In TeXShop -> Preferences -&...
0
votes
3answers
239 views

Listings: consistently colouring numbers

I have been using this solution found here at LaTeX Stack Exchange for colouring numbers in my code excerpts: \documentclass{article} \usepackage{listings} \usepackage{xcolor} \makeatletter %%% ...
0
votes
1answer
39 views

Define a new math-delimiter in Texstudio

Is it possible to define a new math-delimiter for texstudio syntax highlighting ? For example, I would like to indicate that the \begin{mblock}...\end{mblock} environment is a math-delimiter.
0
votes
0answers
45 views

Scrolling the Output Produces Highlighting of Various Syntax. Why?

I am using TexStudio 2.6.6 When I scroll the syntax, there is no yellow highlighting that occurs. However, when I scroll through the output, various paragraphs, as well as certain commands such as \...
0
votes
1answer
73 views

Dollar sign breaks syntax highlighting in Vim

The $ symbol opens inline math environment, unless it is used in verbatim enviromnent. However Vim can’t seem to detect that it’s in a verbatim environment, and as a result the dollar breaks the ...
1
vote
1answer
144 views

How to get F# syntax highlighting?

I'm using MiKTeX via pandoc to make a book that contains C# and F# source code. The C# source code gets formatted just fine. How do I make sure the F# code gets formatted also?
3
votes
1answer
64 views

minted escapeinside works for all supported languages except LaTeX

I want to add some math symbols into the escaped contents, minted works well for languages like Python, but not LaTeX. A sample code: \documentclass{article} \usepackage{minted} \begin{document} \...
0
votes
0answers
113 views

LaTeX listings package JSON formatting

I am using package listings for JSON data. I am following this example How to improve listings display of JSON files from this stackexchange answer. It generates the following output: I added caption ...
0
votes
0answers
33 views

How can I achieve correct syntax highlighting in TeXstudio with a custom style file?

I work in TexStudio and experience highlighting problems when using my custom .sty file. Trying to solve this issue I experimented by downloading a custom .sty file from the internet (called test.sty) ...
0
votes
0answers
40 views

Highlighting math mode in TeXShop

Is there anyway to highlight the content of mathmode in TeXShop? Right now only the $ sign is in a different colour. I would want the text content inside the $ $ to be highlighted. Like, for example, ...
1
vote
0answers
63 views

How do I use the MagicPython syntax highlighting with latex?

I would like to use the syntax highlighting from MagicPython with LaTeX - preferably with the listings package. According to the documentation for the listings package it should be possible to supply ...
2
votes
0answers
44 views

Coloring footnote syntax in vim

I would like LaTeX footnotes to have a different color in nvim, much like VS Code does it: I found this old question, which suggests putting this in after/syntax/tex.vim syntax match footnote "\...
0
votes
1answer
29 views

How do I remove the feature where newly written text in editor is highlighted?

Whenever I write something new in the overleaf editor on my laptop it highlights it (see attatched image below) and I have to manually click somewhere else in the editor in order to remove it. I haven'...
1
vote
0answers
41 views

Unrecognized unicode-math command in TeXstudio although unicode-math.cwl is activated

TeXstudio 2.12.22 shows some commands defined by unicode-math as 'unrecognized command' and highlights them in red although I've enabled unicode-math.cwl and unicode-math-xetex.cwl in TeXstudio. All ...
5
votes
2answers
126 views

Escaped percent sign is syntax-highlighted as comment by listings package

My code: \documentclass{article} \usepackage{listings} \usepackage{xcolor} \lstset{ language=[latex]tex, basicstyle=\ttfamily, commentstyle=\color{violet}, columns=fullflexible, ...
1
vote
2answers
66 views

How do I box (highlight) phrases so that all the boxes line up horizontally?

%--------------------------------------------------------------------------------------------------------- % \documentclass[english]{book} %-------------------------------------------------------------...
0
votes
1answer
16 views

Listing syntax highlighting of keywords after assignation

I am using the following snippet to define a custom language: \newcommand\mscript{customMATLAB} \expandafter\expandafter\expandafter\lstdefinelanguage% \expandafter{\mscript}{ alsoletter={:,=}, ...
1
vote
0answers
20 views

make Kile syntax highlight extension aware

Is is possible to make kile use a specific syntax highlight scheme for different kinds of files? I have a documentwith a .tex file as main file, but I also work with some sage script, and some sagetex ...
1
vote
1answer
544 views

VS Code - Latex Workshop - how to enable custom highlighting?

I'm finding the section subsection highlighting is not enough for me and I can barely see it. I think there is a way to customize things. You can see various entries in the repo for section.name and ...
0
votes
0answers
49 views

TeX source code is just black instead of including red/blue/green elements

I have a simple question. I am writing a document in the Overleaf editor with multiple chapters in different .tex files, and in one of the chapters the source code looks like this: However, in my ...
0
votes
0answers
16 views

Syntax Higlighting in source code with Texmaker

How can I customize the syntax highlighting for enviroments in the source code with Texmaker. For example \usepackage{verbatim} gives the enviroment \begin{comment}...\end{comment}, which does, that ...
4
votes
2answers
524 views

In Tex Studio, is there a way to get rid of “math command outside of math env” warnings?

When I use the mathpartir package, Tex Studio does not seem to identify that mathpar is a math environment, and highlights all my math mode commands in red. When I hover the mouse over them, it says "...
0
votes
0answers
82 views

Listing: custom syntax highlighting for JSON?

I created the following custom language definition for JSON, based upon the syntax highlighting offered by IntelliJ IDEA for JSON. % Custom colours \definecolor{numbers}{HTML}{0000FF} \colorlet{...
0
votes
0answers
42 views

Syntax Highlighting for XML in lstlisting environments

I'm looking for a good syntax highlighting for XML (the existing syntax highlighting for XML does not meet all requirements.). I've already created something there (below), unfortunately I'm still ...
0
votes
0answers
28 views

Is is possible to exempt a block of code from syntax highlighting in the TeXstudio editor?

Working with LaTeX documents in TeXstudio, I often write/use commands with nonstandard syntax (such as @egreg's most helpful answer to this question) that wind up looking like a dog's breakfast in the ...
3
votes
1answer
353 views

Sublime Text + LaTeXTools syntax highlighting for custom command?

I have a custom command which I use frequently to comment out chunks of a source file, defined as follows: \newcommand{\comment}[1]{} In Sublime Text (with LaTeXTools), this command throws the ...
2
votes
0answers
752 views

Highlight JSON code snippet with minted

I have a JSON code snippet that I like to include into my LaTeX document: "builders": [ { "type": "test", "image": "ubuntu:latest", "changes": [ "EXPOSE 123 ...
1
vote
0answers
59 views

Reporting python interactive mode examples as in the introduction

I would like to imitate the style used in the python introduction within my beamer slides. Essentialy, I would like an environment with some background that colors the python syntax of every line ...
1
vote
0answers
17 views

TexStudio: .pgf files highlight the syntax the same as .tex

I like to generate plots with matplotlib's pgf backend - the output file is .pgf (basically just .tex). I'd like to to keep the file extension as .pgf as it helps me differentiate a figure file. ...
0
votes
1answer
175 views

Why wont the `minted` package produce output?

I'm trying to write a document with code examples using minted \documentclass{article} \usepackage[a4paper, total={6in, 8in}]{geometry} \usepackage{minted} \title{Modelling stuff} \begin{document} ...
3
votes
2answers
268 views

Annoying syntax highlighting of unclosed group at \cs:w [closed]

So I was looking at my preamble, with Overleaf yelling at me for not putting a closing bracket after the piece of code attached below, which is strange, since that group is indeed closed. To confirm, ...
0
votes
1answer
79 views

How can I add code highlighting for listings with different colour lines?

How can I create a listing design in LaTeX, with numbers on the left, and each line separated with colours like in the picture? I could not find such listing style for LaTeX.
0
votes
0answers
41 views

Syntax highlights for variable names in declaration

I'm using a language whose pretty printing highlights variables when defined with their type. So if I write: Fun foo (a: int): Then Fun and int will be highlighted in blue (they are defined keyword),...
0
votes
1answer
376 views

How to adjust background colorbox size for inline code in pandoc markdown [duplicate]

This answer provides a nice way to add background colour to inline code snippets. Using that, my YAML header includes this: --- title: My title subtitle: \emph{Documentation last updated on \today} ...
2
votes
1answer
130 views

Why are strings interpreted wrong in MatLab code with listings

I am trying to include MatLab code in my document using the listings package, but it seems like strings are not interpreted correct. fprintf('ABC %s:\n', mystring); fprintf("ABC %s:\n", mystring); \...
3
votes
1answer
52 views

Prevent keyword syntax highlighting within moredelim

Code: \documentclass{article} \usepackage{parskip} \usepackage{listings} \usepackage{textcomp} \usepackage{xcolor} \lstset{ basicstyle=\ttfamily, columns=fullflexible, keepspaces=true, ...
6
votes
1answer
58 views

The listings package highlights “e3” in “20e3” as identifier

LaTeX code: \documentclass{article} \usepackage{listings} \usepackage{textcomp} \usepackage{xcolor} \lstset{ basicstyle=\ttfamily, columns=fullflexible, keepspaces=true, upquote=true, ...
4
votes
1answer
1k views

Combining multiple listings styles in a single \lstdefinestyle command

Here is my code: \documentclass{article} \usepackage{listings} \usepackage{textcomp} \usepackage{xcolor} \lstdefinestyle{style1}{ basicstyle=\ttfamily, columns=fullflexible, keepspaces=...
2
votes
1answer
385 views

Why is identifierstyle used for lstlisting with no language?

Here is my code: \documentclass{article} \usepackage{xcolor} \usepackage{listings} \lstset{ keywordstyle=\color{blue}, identifierstyle=\color{red}, } \lstnewenvironment{algol}{\lstset{...
0
votes
0answers
56 views

commands do not appear in blue anymore

I don't know what buttons did I hit that I am not aware of, but all of a sudden, I stopped seeing the LaTeX commands in blue anymore. I am talking about \begin{document}, \end{document}, \section, \...
2
votes
1answer
4k views

Dark mode in TeXstudio [duplicate]

I cannot seem to properly configure my texprofile in TeXstudio to change to dark mode. I have downloaded the .txsprofile from this website, but upon following the instructions (saving the current ...
1
vote
0answers
103 views

Are there any existing setups for Listings to provide syntax highlighting for Antlr4 (.g4) grammar files in LaTeX?

I have been using the Listings package for C and Java highlighting and I also need to highlight my Antlr4 grammar code, which is of the .g4 format. Are there any existing setups for this, preferably ...
0
votes
1answer
210 views

Beginner questions about extensions management on Visual Code Studio

I am using Visual Studio Code 1.33.1 and the extensions: Code spell checker, LaTex language support, LaTex Preview, LaTex Workshop, OMT & ODT. But the commands I am using, as \documentclass{...
1
vote
1answer
184 views

Syntax highlighting not working properly

I'm using TeXstudio and for a while now, every time I write in math mode using $...$ or \[...\], it highlights most of the commands as if they were syntax errors although it compiles just fine. For ...
2
votes
1answer
265 views

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} \...
1
vote
0answers
45 views

How to highlight word in listings that starts/ends with specified character?

I want to highlight function name in code, which is a word that ends with left parenthesis, like sqrt(), but don't want to highlight the parenthesis. Here is what I got so far, I learnt this from ...
1
vote
3answers
5k views

Can I type \LaTeX inside inline code in Rmarkdown?

I know I can use $$ to write \LaTeX in Rmarkdown documents like $\beta$. My goal is if this is possible inside inline code. I would do `$\beta$` or `$\\beta$`, but both do not work. In case it is ...
2
votes
1answer
254 views

Listing: XML keywords, strings, identifiers not recognized

I'd like to implement some XML code in my document. However, the syntax of my listings doesn't seem to be acknowledged. So my output looks like this right now: Obviously, that doesn't make any sense. ...
1
vote
0answers
126 views

gedit syntax highlighting issue

In gedit 3.28.1 in Ubuntu 18.04, I have syntax highlighting random problem : In the above image you can see that \linewidth (on line 24) highlights the way regular control sequences are set in green. ...