Questions tagged [syntax-highlighting]

For questions about highlighting document source code in your editor.

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 views

math syntax highlighting with auctex in emacs

I am using emacs and the package auctex to write my latex documents. I would like to improve syntax highlighting (or font locking in emacs' jargon) for mathematics. For example, at the moment ...
user avatar
  • 205
0 votes
0 answers
664 views

MiKTeX 22.3 TeXworks syntax coloring

How do I set the colors for TeXworks (in MiKTeX 22.3) to use for syntax coloring? My earlier installation of MiKTeX 2.9 had a file C:\Users\R\AppData\Local\MiKTeX\2.9\TeXworks\0.6\configuration\...
user avatar
  • 390
0 votes
1 answer
42 views

Syntax highlighting of numeric literals with the listings package

I'm working on a document that contains a lot of python code snippets, many of which have numeric literals in them. For example, something like: var_a = 3 var_b = 20000 var_c = 1.75e12 var_d = 0.1415 ...
user avatar
0 votes
1 answer
22 views

Highlight or underline answer in Latex when code is in begin/end{align*}

I normally write my solutions to mathematics problems in Latex using the begin/end{align*} feature. How does one highlight an equation, or answer in my case, when the code is in begin/end{align*} ? ...
user avatar
  • 35
0 votes
1 answer
27 views

Minted: no margin outside of frame when using background color

I am using minted with a background color and a frame (see MWE below) for displaying code with syntax highlighting in my document. How can I remove the space (see red arrows in image below) outside of ...
user avatar
  • 3
1 vote
0 answers
57 views

Python syntax highlighting

Is there already a standard way to highlight Python source code with high quality like within the IDLE (i. e. with the IDLE colors and highlighting rules)? solutions based on lstlistings (like ...
user avatar
0 votes
1 answer
31 views

Lightweight syntax highlighting: highlight keywords without using inline listings

I'm looking for a lightweight alternative to inline code listings that is able to make keywords bold. I'm imagining something like the following: \declarekeywords{if,then,else} \declarestylecommand\...
user avatar
2 votes
1 answer
226 views

How to highlight TeX code? [duplicate]

I want to highlight some TeX code listings, so I use lstlisting. \begin{lstlisting}[language=TeX] \begin{tabular}{ |p{4cm}|p{4cm}|p{4cm}| } \hline \multicolumn{3}{|c|}{Country List} \\ \hline ...
user avatar
  • 131
0 votes
0 answers
42 views

How to highlight the argument of a certain command as verbatim in TeXstudio?

I am trying to get the argument of \EscVerb to become highlighted as the argument of \verb. I added a custom cwl file with the following command \EscVerb{verbatimSymbol} But this only causes the ...
user avatar
0 votes
0 answers
31 views

TeXmaker syntax highlighting problems

can anyone tell me why TeXmaker is not coloring my code correctly? For some reason everything below my \newcommandline is in text-colour. When i paste my code into overleaf it works normally (https://...
user avatar
1 vote
1 answer
53 views

Why does `\@outputpage` read as text in the code? [duplicate]

I have been given a document with some existing code. I would like to have laternating textheight on odd and even pages (to account for different footers). I'm new to LaTeX and don't know exactly what ...
user avatar
0 votes
1 answer
63 views

Highlighting diacritical marks and making optional bounding boxes

For a specific selected diacritical mark within the word, how can you apply either all or one of the text formatting options below: highlighting coloring Underlining Changing to Bold Changing to ...
user avatar
  • 733
1 vote
1 answer
55 views

Standalone with verbatim - highlighting code with pygments

Issue: The width of the generated pdf does not match the width of the code The Python package Pygments is used to generate a syntactically highlighted code in LaTeX format. As an example, the input ...
user avatar
  • 607
1 vote
1 answer
95 views

Making TeXstudio syntax highlighting recognize a custom verbatim environment

I'm using TeXstudio for pretty much all my LaTeX needs. I sometimes have to include small code snippets in a document where employing the listings package would be overkill. Since I'd like for these ...
user avatar
  • 3,307
0 votes
1 answer
802 views

Rendering with text and code block

How to get, in Latex, this kind of rendering with firstly a text and just after a block of code with a shaded grey background ? I would like to get the same font for code block.
user avatar
4 votes
1 answer
194 views

Highlight PHP code with minted without <?php

Is there a way to tell minted, that it should highlight the code, without having <?php at the start? I want to highlight my PHP code with minted. But it only highlights, when I use <?php at the ...
user avatar
  • 43
0 votes
0 answers
24 views

How do I correctly define keywords in the \ lstdefinelanguage section?

I create my own language definition with the listings package. It's a mix of HTML and Javascript. Why are the tags <title>, <h1>, <li> not included in the syntax highlighting and how ...
user avatar
  • 49
0 votes
0 answers
48 views

When single dollar sign is used in minted affects code highlighting in TexMaker

I am writing a document that includes typescript code using the minted environment. In typescript, there is a variable naming convention that requires variable names that are observables to end in $. ...
user avatar
  • 634
1 vote
1 answer
162 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} \...
user avatar
  • 85
0 votes
0 answers
34 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 ...
user avatar
  • 1,175
0 votes
1 answer
144 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 ...
user avatar
  • 359
2 votes
1 answer
103 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. ...
user avatar
  • 11.4k
1 vote
0 answers
70 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 ...
user avatar
0 votes
0 answers
33 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 ...
user avatar
0 votes
1 answer
93 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{...
user avatar
4 votes
1 answer
47 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 ...
user avatar
0 votes
0 answers
96 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 ...
user avatar
  • 1,899
0 votes
0 answers
47 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 ...
user avatar
3 votes
1 answer
151 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?
user avatar
  • 15
1 vote
0 answers
33 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 -&...
user avatar
  • 11
0 votes
3 answers
310 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 %%% ...
user avatar
1 vote
1 answer
73 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.
user avatar
  • 955
0 votes
0 answers
51 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 \...
user avatar
2 votes
2 answers
466 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 ...
user avatar
4 votes
2 answers
394 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?
user avatar
6 votes
1 answer
241 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} \...
user avatar
1 vote
0 answers
1k 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 ...
user avatar
  • 111
0 votes
0 answers
78 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) ...
user avatar
0 votes
0 answers
105 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, ...
user avatar
  • 1,549
1 vote
0 answers
80 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 ...
user avatar
  • 11
3 votes
0 answers
81 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 "\...
user avatar
0 votes
1 answer
205 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'...
user avatar
  • 3
1 vote
0 answers
77 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 ...
user avatar
6 votes
3 answers
384 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, ...
user avatar
  • 2,897
1 vote
2 answers
75 views

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

%--------------------------------------------------------------------------------------------------------- % \documentclass[english]{book} %-------------------------------------------------------------...
user avatar
0 votes
1 answer
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={:,=}, ...
user avatar
1 vote
0 answers
30 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 ...
user avatar
  • 11
1 vote
2 answers
3k 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 ...
user avatar
  • 129
0 votes
0 answers
456 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 ...
user avatar
  • 1
6 votes
2 answers
1k 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 "...
user avatar
  • 952