Questions tagged [syntax-highlighting]

For questions about highlighting document source code in your editor.

Filter by
Sorted by
Tagged with
0
votes
0answers
24 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
47 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
37 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
18 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
21 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
15 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
36 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
48 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, ...
3
votes
1answer
124 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
28 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
53 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
350 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
34 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
93 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
47 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
60 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
32 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
819 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
102 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
62 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
115 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
132 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
220 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,...
3
votes
1answer
145 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
105 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 ...
1
vote
1answer
232 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
507 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
123 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
393 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
116 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
100 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
314 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 ...
4
votes
1answer
139 views

Why does my regex code not work?

I've been trying to customize my syntax highlighting patterns on TeXworks recently, and I'm having a hard time figuring out how to deal with, for instance, content enclosed in \footnote{}. Sometimes I ...
2
votes
1answer
215 views

TeXstudio syntax highlighting for Tikz

How can I get in TeXstudio the same syntax highlighting of TikzEdt? Look at the red word (called operation in Tikz, I think) "circle". In TikzEdt: In TeXstudio:
0
votes
0answers
30 views

Why `\pdfstrcmp` shows unrecongnized command in texstudio? [duplicate]

I have used this \pdfstrcmp as in the following to set the different \makeatletter \newcommand{\setappendix}{Appendix~\thechapter} \newcommand{\setchapter}{Chapter~\thechapter~} \titleformat{\...
2
votes
1answer
643 views

Markdown code fragment inside latex document

I am writing a document in LaTeX and I need to add some Markdown code fragments with highlighted syntax. Right now I'm using listings library for all my code fragments but listings doesn't support ...
0
votes
1answer
390 views

Color of marked Text in TeXStudio

I created a darker theme for TeXStudio and have problems with the color of the text when I mark it with the cursor: The first line is marked and I cannot change its color. I searched every line in ...
1
vote
1answer
330 views

Code validation in minted package? How to disable it?

I'm using minted for inserting syntax highlighted HTML code in my document. But it isn't simple HTML (valid HTML I mean) and has some special characters and definitions (if you're interested, it's ...
2
votes
1answer
1k views

TeX Studio doesn't recognize certain amsmath commands even after loading packages

Here is my code: As you can see, TeX Studio doesn't recognize the proof environment. Nonetheless, I have activated the amsmath package in the preferences: So why isn't it working? I have tried ...
3
votes
2answers
806 views

Vim does not recognize math environment (but handles other math fine)

So on one of my pc's the vim install dos not recognize math environments such as align and equation Is there a way to turn this on?
3
votes
1answer
72 views

How can I avoid coloring tex followed by '$' in TexMaker, inside a minted?

I'm using minted for some parts of bash code inside my project. But when I write a $ inside of it, TexMaker just colors everything else of green. Is there a way to avoid that? Thank you
0
votes
1answer
226 views

In TexWorks, why does using a real apostrophe (’) break brace matching?

To get an apostrophe in LaTeX, one can type ' (straight quote mark) or ’ (apostrophe). While both are compiled into an apostrophe, using ’ breaks the syntax highlighting of curly braces in TexWorks. ...
3
votes
0answers
245 views

TeXstudio - Preventing syntax highlighting effects from LaTeX special characters in Lua code

Is there way to make TeXstudio ignore the contents of a \directlua command when performing syntax highlighting? Currently, it ends up causing highlighting like: Which is distracting when scanning the ...
3
votes
1answer
3k views

Keyword Highlighting not working in Python with listings

I am unable to get keywords to be highlighted in typeset Python. Latex source: \documentclass{minimal} \usepackage{listings} \usepackage{xcolor} \lstset{ language=Python, frame=single, numbers=left,...
4
votes
1answer
316 views

Using 'mintinline' inside 'tabu'

This is pretty much a '17 version of this question, since the solution provided does not work (anymore) in this case and neither does any of these other answers, because tabu has its own rules. The ...
0
votes
0answers
56 views

Bash Syntax Hightlighting in a Tex File

I've got the question if there is a possibility to auto-highlight Bash syntax in a compiled Tex File. Is there a package that has a function to accomplish that? Thanks in advance, ADDB.
2
votes
0answers
505 views

Texstudio + custom cwl: #include command ignored

Goal I am trying to derive my own class from memoir and would like to include all the auto-completiong from the original memoir class. Problem I wrote a customg .cwl file using #include:class-memoir....
1
vote
1answer
856 views

Sublime Text syntax highlighting sections titles as bold in the source

Currently the section commands are coloured blue (using the Monokai theme). I would like to add more emphasis to sectioning commands in the source code when open in Sublime Text 3, similar to the ...
1
vote
1answer
184 views

Syntax error colour for TeXstudio too light

I'm using TeXstudio 2.12.4 (hg 6476:3e5c3afa4719). The following code (intentionally) produces this: \documentclass{article} \begin{document} \s \end{document} As you can probably tell, the ...
8
votes
1answer
1k views

TeXstudio chemfig commands marked as unrecognized

I included the chemfig package to draw chemical stuff in LaTex. But the commands aren't recognized by TeXstudio. I even added the package to the autocompletion list in the settings to get recognized ...