Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [syntax-highlighting]

For questions about highlighting document source code in your editor.

Filter by
Sorted by
Tagged with
3 votes
0 answers
77 views

TeXstudio and highlighting of units syntax (ex, em, mm, cm, pt, ...)

I am moving from TeXnicCenter to the TeXstudio and wondering, if there is a way, how to make a custom syntax color for units like (pt, in, mm, cm, ex, em) in TexStudio. TexnicCenter has option for ...
Joseph Hallenbeck's user avatar
1 vote
2 answers
149 views

Loading xparse explicitly required for syntax coloring in emacs?

I was surprised to discover that it is necessary to put \usepackage{xparse} in the preamble in order for syntax coloring to work for LaTeX3 macros in emacs -- or a package that loads xparse such as ...
sgmoye's user avatar
  • 8,711
0 votes
0 answers
40 views

TeXstudio Highlighting Issue with \input

I have an auxiliary .tex file with commands, packages and the like, which I reference with \input{...}. However, TeXstudio doesn't recognise the commands in that auxiliary file. A MWE can be made in ...
Sam OT's user avatar
  • 1,339
1 vote
1 answer
137 views

Minted styling not working : no pygstyle file created

I want to start this post by telling that I already know the answer to the question. I just came here to post the solution I found so it hopefully helps someone without having to spend an hour ...
Allemand Instable's user avatar
10 votes
2 answers
926 views

Looking for a good Emacs/AUCTeX setup for LaTeX3

I'm trying to switch my editor from vscodium (telemetry free VS Code) to Emacs. So far, I've installed AUCTeX and tried some things in a testdocument. For regular LaTeX code everything is fine. But ...
lukeflo's user avatar
  • 1,597
0 votes
0 answers
24 views

How to preserve minted's foreground color while highlighting code sections with \colorbox

I'm currently working on highlighting specific sections of code snippets in my LaTeX document. To achieve this, I followed the example provided in the documentation for the minted package, ...
Átila Gama Silva's user avatar
0 votes
0 answers
37 views

(minted) pygtex file contents being output to PDF instead of formatted source code?

When I compile my tex doc, instead of getting correctly formatted code, I get what appears to be the contents of the *.pygtex files in the _minted-* folder. There are no errors with compiling. I am ...
41d3n's user avatar
  • 1
0 votes
0 answers
24 views

Listings XML highlighting problems - values between tags

I'm using a custom style to get syntax highlighting for XML in Listings from this thread but I'm having issues in regards to values between tags getting wrongly targeted. The styling I have is \...
Zaxvert's user avatar
1 vote
1 answer
89 views

Correct Elixir Syntax Highlighting

I am currently writing a thesis in which I frequently need to add Elixir code snippets. I am not very experienced with LaTeX, but after a bit of searching I found this solution. The problem is that ...
Astarno's user avatar
  • 111
0 votes
0 answers
62 views

How can I align code listing with a propotional font?

I'd like to typeset some code with a proportional code with alignment. How can I do it? The capabilities of listings to align are limited, and I was using tabbing, but it causes problems because every ...
matj1's user avatar
  • 109
1 vote
0 answers
36 views

How do I highlight C libraries in listings?

I am using the listings package to typeset the following C code in Latex #include <stdio.h> #include <stdlib.h> int main () { printf("Hello World!\n"); return 0; } Here ...
PhoenXHO's user avatar
1 vote
0 answers
82 views

**texstudio** identifies correct syntax as mistake

In texstudio 4.5.1, I recently noticed it's highlighting all correct syntax as latexSyntaxMistake in an orange background. Anyone know why this would be happening? Syntax checking is enabled in the ...
Greg. Kelemen's user avatar
0 votes
0 answers
61 views

Syntax highlighting for autotools (autoconf/automake/m4)

I'm writing beamer slides showcasing how to use the autotools and would like to highlight my configuration examples. listings and minted (pygments) don't seem to support any of the possible names for ...
Dettorer's user avatar
  • 123
1 vote
1 answer
137 views

Syntax highlighting doesn't work after percent symbol %

I'm trying to highlight my R code using minted package. However, after %, a few lines didn't get highlighted. When I delete % problem disappears. My code: \documentclass{article} \usepackage{minted} \...
Sawyer Shu's user avatar
1 vote
1 answer
105 views

Concise way of stepping through code in beamer

This question is similar to Using Beamer to step through an algorithm written in pseudocode. but not tied to any particular environment. I prefer minted, but any other similar environment that can ...
Gaslight Deceive Subvert's user avatar
0 votes
0 answers
103 views

How to configure cwl to provide verbatim highlighting for custom code?

I am trying to customize cwl file to provide verbatim highlighting. I am trying to get assistance from TeXstudio : User manual, and my cwl file contains the following \basoom{verbatimSymbol} This is ...
Al-Motasem Aldaoudeyeh's user avatar
1 vote
1 answer
771 views

How to properly format an included docker-compose.yml file

How do I properly format and highlight a docker-compose.yml file when including a code snippet into a latex document. I want to do something like: \documentclass{article} \usepackage{listings} \lstset{...
NameVergessen's user avatar
1 vote
1 answer
274 views

How to avoid syntax error highlights on Overleaf with redefined meaning of \[, \], \(, \) commands? [closed]

I want to overwrite the commands listed in the title with \renewcommand{\(}{\left(} ... \renewcommand{\]}{\right]} I already tried it in Overleaf and when I click 'compile' it compiles ...
Dj Frixz's user avatar
7 votes
2 answers
251 views

LaTeX3 macro identification in TeXstudio

The LaTeX3 syntax is not recognized by TeXstudio, and I'm looking for ways to solve it. The problem comes from (IMHO) the underscores being taken as "separators"... Here is an example: The ...
3isenHeim's user avatar
  • 2,107
4 votes
2 answers
342 views

Why UM Typewriter font not working properly?

I compiled this code \documentclass{article} \usepackage{minted, fontspec} \setmonofont{UM Typewriter} %% <--- some problems here (see the next comment). To solve comment it out. \begin{document}...
miticollo's user avatar
  • 163
2 votes
1 answer
157 views

ConTeXt: Syntax highlighting of source code within XHTML documents

Background Looking to apply syntax highlighting to source code snippets embedded within XHTML code elements, demarcated with a class attribute to indicate the language. Using: mtx-context | ...
Dave Jarvis's user avatar
  • 11.9k
0 votes
1 answer
346 views

Make \hl include linebreaks

I am using soul package and \hl to highlight text in my Latex. However, it does not work when there is a linebreak or a new paragraph. I have a whole page to highlight. Is it possible to make \hl ...
Pankaj Singh's user avatar
2 votes
2 answers
373 views

Removing frames in the 'Python' environment

I use the Python environment from package pythonhighlight for highlighting code syntax. However, the code is always framed. Is there a possibility to switch off the frame around the code? Here is my ...
Martin Vesely's user avatar
0 votes
0 answers
307 views

Adding Vertical Lines for Indents with lstlisting (or other package)

I have some code that is formatted with the lstlistings package in LaTeX, which looks like: However, when putting in longer code it can be difficult (especially on page breaks) to know how far ...
Frederik's user avatar
  • 103
0 votes
0 answers
32 views

Import seems to fail with TexStudio after reinstallation. Why?

I reinstalled Texsudio on a new SSD yesterday. After that I only encounter problems, Nothing changed to my actual MikTex installation, which has always been on my boot disk. E.g. when I import my ...
Manuel ManUser's user avatar
2 votes
0 answers
216 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 ...
vap's user avatar
  • 225
0 votes
0 answers
1k 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\...
Rosie F's user avatar
  • 444
0 votes
1 answer
295 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 ...
realityChemist's user avatar
1 vote
1 answer
237 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*} ? ...
Stephan's user avatar
  • 245
1 vote
1 answer
468 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 ...
Benski's user avatar
  • 13
1 vote
0 answers
427 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 ...
user7427029's user avatar
0 votes
1 answer
41 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\...
MyComputer's user avatar
2 votes
1 answer
1k 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 ...
rGA145's user avatar
  • 131
0 votes
0 answers
137 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 ...
Al-Motasem Aldaoudeyeh's user avatar
0 votes
0 answers
106 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://...
MichaelS's user avatar
1 vote
1 answer
202 views

How to change TeXShop highlighting color during delimiter matching?

Could someone explain how to tone down the blood-red default background color that TeXShop uses during delimiter matching? Sadly it's driving me nuts and I need to change it to something more soothing-...
Dan's user avatar
  • 11
1 vote
1 answer
116 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 ...
Simon Probert's user avatar
0 votes
1 answer
155 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 ...
Silva's user avatar
  • 743
1 vote
1 answer
383 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 ...
John's user avatar
  • 667
1 vote
1 answer
619 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 ...
chsk's user avatar
  • 3,677
1 vote
1 answer
5k 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
753 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 ...
FelixSz's user avatar
  • 43
1 vote
1 answer
743 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} \...
Bibi's user avatar
  • 85
0 votes
1 answer
385 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 ...
Oromion's user avatar
  • 384
2 votes
1 answer
128 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. ...
projetmbc's user avatar
  • 13.4k
1 vote
0 answers
159 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 ...
Rama Lakshmanan's user avatar
0 votes
0 answers
39 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 ...
user30586's user avatar
0 votes
1 answer
485 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{...
minseong's user avatar
  • 487
4 votes
1 answer
82 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 ...
minseong's user avatar
  • 487
0 votes
0 answers
193 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 ...
Enlico's user avatar
  • 2,612