Questions tagged [syntax-highlighting]

For questions about highlighting document source code in your editor.

Filter by
Sorted by
Tagged with
1
vote
0answers
27 views
+50

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
53 views

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

%--------------------------------------------------------------------------------------------------------- % \documentclass[english]{book} %-------------------------------------------------------------...
0
votes
1answer
14 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
14 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
41 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
25 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
15 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
114 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
35 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
37 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
24 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 ...
2
votes
1answer
155 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 ...
1
vote
0answers
309 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 ...
0
votes
0answers
31 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
14 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
69 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} ...
2
votes
2answers
127 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
60 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
32 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
235 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
84 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); \...
0
votes
0answers
102 views

lstlisting syntax for .config file

In my document I want to list a configuration file, but I can't find a proper syntax highlighting. What I have is: \begin{lstlisting}[language=?] [postgresql] dsn="postgres://..." [redis] url="redis:...
0
votes
0answers
49 views

TexStudio syntax highlighting for \newcommand like commentTodo

TexStudio has a syntax highlighting section for todocomments (todo comments are highlighted in the editor). Is it possible to define similar syntax highlighting for custom commands defined with \...
0
votes
0answers
21 views

TexStudio autocompletion stopped working for macros

So I recently created macros (.sty files), which are remotely loaded at in my preamble. There are various points in these macros where I've defined a new command; for example: \def\remark#1#{\...
3
votes
1answer
45 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
56 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
679 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
201 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
55 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
2k 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 ...
0
votes
0answers
83 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
178 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
109 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
139 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
38 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 ...
0
votes
3answers
3k 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
187 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
95 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. ...
0
votes
1answer
213 views

How to syntax-highlight an own language / unpopular language?

How can I syntax-highlight an unpopular language that is not supported for lstlisting? The language is called "Cypher" (for the graph database Neo4j) und I would like to highlight words like "RETURN",...
1
vote
2answers
139 views

AucTeX issue with BVerbatim in newenvironment

I have the following newenvironment command: \newenvironment{code} { \VerbatimEnvironment \begin{mdframed}[ backgroundcolor=black!70, leftmargin=1, rightmargin=1, innerleftmargin=4, ...
1
vote
1answer
455 views

Adjust top and bottom margins using minted

I've been using the listings package with the following setup to produce a compact layout of code samples: \lstset{ basicstyle=\footnotesize\ttfamily,breaklines=true, framextopmargin=50pt,...
4
votes
1answer
196 views

Parse key-value pairs within delimiters and color each token differently in lstlisting

Here is my code: \documentclass{article} \usepackage{xcolor} \usepackage{listings} \lstset{ basicstyle=\ttfamily, moredelim=*[s][\color{gray}]{[}{]}, keywords=[0]{a,b,foo,baz}, ...
1
vote
1answer
120 views

Default Color for User Defined Macros in Emacs

When writing tex documents, I often create and include a file that contains a number of user defined macros, e.g., \newcommand{\pstar}{\ensuremath{\mathcal{P}^\star}}. I'd like to set up emacs syntax ...
2
votes
1answer
364 views

Can I change the color of the whitespace markers in the TeXstudio editor?

I'm using a couple custom settings for syntax highlighting in the TeXstudio editor, but I'm running into a problem, and I'm not sure whether this is down to me not finding the correct settings and ...
6
votes
1answer
517 views

How to embedded source code on-demand into PDF?

I wondered if its possible to embed source code of some software you are writing about into the PDF but not displayed by default. E.g. you have a long script I would be nice if the user/reader could ...
0
votes
1answer
156 views

Commands inside lstnewenvironment not ignored

I am using an lstenvironment to make sure the code is on one page: \lstnewenvironment{mycode}{}{} \usepackage{etoolbox} \BeforeBeginEnvironment{mycode}{\par\noindent\begin{minipage}{\linewidth}\...
2
votes
2answers
726 views

Restoring default color scheme of TexStudio

After getting help from her: Current line highlighting in TeXstudio to change the color scheme of the texstudio editor, I ran into a problem: Those features not marked with color as default, are ...
0
votes
1answer
190 views

minted - how to highlight html also, when language “twig” is selected

I use minted and I try to format twig-Code. But when I select twig as the code-language, it does highlight the twig code but it doesn't highlight html-code! This looks like this: Is there any way to ...
1
vote
0answers
136 views

TexWorks syntax custom highlight for text within curly braces

I would like to have the text between curly braces appear highlighted in lightpink in my TexWorks editor. I don't have a cs background, and this is as far as I've got. I've added the following to my ...
3
votes
0answers
430 views

Syntax highlighting of (Cisco) terminal

I want to highlight a complete terminal flow, mostly for the Cisco CLI, but Bash would be nice, too. As for now, the result achieved with the package lstlisting looks as follows: I achieved that with ...