Questions tagged [syntax-highlighting]

For questions about highlighting document source code in your editor.

Filter by
Sorted by
Tagged with
1
vote
1answer
64 views

Highlight the background of an equation in Beamer using package Tikz

Hi would like to simply highlight a part of a formula using the package tikZ but I am facing some difficulties in doing so. \documentclass{beamer} \usepackage{framed,multirow} \usepackage{bm} \...
0
votes
0answers
16 views

Behavior of brace match in TeXstudio

While I like the syntax highlighting for brace (and parenthesis, and dollar sign) match/mismatch in TeXstudio, I find it distinctly unhelpful that when the cursor is adjacent to a brace it makes the ...
0
votes
1answer
70 views

Syntax highlight for gmsh code (*.geo)?

I am looking for syntax highlighting packages (as listings or minted) for *.geo (gmsh input) and/or MSH file format version 2 or 4 *.msh (gmsh output). Example of content of *.geo file // Scale global ...
2
votes
1answer
94 views

latex3 - Full support grammar for editors - Not a technical question

It could be so useful to have a full grammar supporting all the built-in macros of LaTeX3. This would simplify the reading of codes by proposing special formattings for each of these built-in macros. ...
1
vote
0answers
27 views

Syntax Highlighting of Common Lisp User Defined Macros in Emacs [closed]

I would like to start writing a few simple Domain Specific Languages in Common Lisp and would like the names of macros I define to be highlighted as if they were Common Lisp functions or macros (in ...
0
votes
0answers
24 views

“Extra }” error when inserting quote mark " after string in tikz \overlay \node enviroment

thanks in advance for your precious help. I am trying to highlight non seriffed text commands inside a grey box ="easy here". Something like this: To get that in Latex, the following code ...
0
votes
1answer
22 views

How to caption a listing(?) environment, custom Python syntax highlighting environment

I am using this answer to add syntax-highlighted Python snippets to my document \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \usepackage{newtxtt} % Custom colors \usepackage{...
4
votes
1answer
34 views

UTF-8 Mu won't render inside custom environment

I just tried using this https://tex.stackexchange.com/a/83883/143861 for syntax highlighting Python in overleaf \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} % Default fixed font ...
0
votes
0answers
32 views

Minted's Haskell syntax coloring seems incorrect

The output of the following source code has the first fmap colored in blue (I think it's the keyword coloring) and the second in black (which should be "no coloring" for normal variable ...
0
votes
0answers
75 views

\inputminted can't find the source code file

I'm trying to import a Python script into my LaTeX document using \inputminted, but it only works if I use the absolute path. E.g. this works: \inputminted{python}{C:/Documents/example.py} This does ...
0
votes
0answers
19 views

Highlighting filenames in inline text (for revtex or latex)

I'm wondering if there are any recommendations or suggestions on how to properly highlight filenames written in the text, for example when mentioning source code files (frontend.py in the example ...
0
votes
0answers
35 views

Create custom listing for PowerShell. Colouring variables and parameters

I want to create a custom listing for Powershell. Example of what my listing looks like at the moment But I cant figure out, how to colour the variables and parameters. These starts with '$' or '-'! ...
0
votes
0answers
39 views

TexStudio doesn't register math mode for TikZ “matrix of math nodes”

In TexStudio, when I make a diagram with TikZ and use the matrix of math nodes option, it doesn't register that it's supposed to look like math mode... so it ends up having a bunch of highlighting for ...
3
votes
1answer
129 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?
1
vote
0answers
18 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
266 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 %%% ...
1
vote
1answer
53 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
50 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
182 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 ...
2
votes
1answer
241 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?
4
votes
1answer
132 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
544 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
43 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
61 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
74 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 ...
3
votes
0answers
59 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
48 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
58 views

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

TeXstudio 3.0.4 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 the ...
5
votes
2answers
206 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
70 views

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

%--------------------------------------------------------------------------------------------------------- % \documentclass[english]{book} %-------------------------------------------------------------...
0
votes
1answer
17 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
25 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
2answers
1k 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
183 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 ...
4
votes
2answers
827 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 "...
3
votes
1answer
520 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 ...
3
votes
0answers
1k 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
72 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
20 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
303 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
635 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
110 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
65 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
587 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
172 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
57 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
60 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
2k 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
530 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
65 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, \...