Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [syntax-highlighting]

For questions about highlighting document source code in your editor.

3
votes
1answer
36 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
69 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 ...
0
votes
0answers
24 views

How to force or allow line breaks in \tcolorbox no listings mostly just on word or expression

Hello Community Fellows, I just want to highlight little Code snippets in my document as well and as lookalike like here with the tcolorbox (<- best example) but the line breaks will not appear, ...
1
vote
1answer
50 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
490 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
59 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}\...
1
vote
2answers
65 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
37 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
34 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 ...
2
votes
0answers
88 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
56 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
122 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
35 views

Highlight gnuplot syntax in Kile

gnuplottex allows for writing gnuplot source code directly into the LaTeX file. By default, Kile (or better to say Kate) doesn't know this environment and highlights it as LaTex code, which looks very ...
0
votes
0answers
25 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
158 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
78 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
92 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 ...
0
votes
0answers
65 views

TeXworks doesn't show red lines under wrongly spelled words, when using customised sytax pattern

I have customised the file syntax-patterns.txt on my computer (included below). Almoast everything works as it should, exept for the spell check. The pre-defined pattern works fine, but for all my ...
2
votes
1answer
264 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 ...
2
votes
1answer
239 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?
0
votes
0answers
75 views

LaTeX problem with listings highlight syntax

I expect full XML syntax coloring in UTF8, I noticed that Polish characters do not appear only in the identifier while in other works. Do you know the answer to my question? I would like to continue ...
3
votes
1answer
59 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
0answers
124 views

Changing default highlight colour selection in TeXShop

I am customising the colour-scheme in my TexShop (on Mac OS) using the following commands via the terminal: defaults write TeXShop commandgreen 0.5 defaults write TeXShop background_G 0.9 to change ...
0
votes
1answer
154 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
196 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
1k 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
200 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
49 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.
1
vote
0answers
359 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....
0
votes
0answers
151 views

mcode package with java code

I'm using mcode.sty package to show Java source code in my article. But as I see it, the code highlight doesnt realy work how I want : How can I customize it in order to color special word like ...
0
votes
0answers
124 views

Java and XML Hightlighting in one document

I would like to implement in my latex document two hightlightnings for Java and XML, but only one works. Here my latex code. \usepackage{color} \definecolor{dkgreen}{rgb}{0,0.6,0} \definecolor{gray}{...
1
vote
1answer
511 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 ...
2
votes
1answer
118 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 ...
7
votes
1answer
594 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 ...
1
vote
1answer
120 views

How to make this fancy highlight?

Nowadays websites show inline computer-code/files in a nice fancy way, with a background color, and rounded box around it, see e.g. the example below. How can I reproduce this in Latex? Thanks ...
1
vote
0answers
174 views

Make lstlisting more colorful [closed]

I find the result of lstlisting is not very impressive. Take C++ for example, it fails to distinguish keywords and typename, or variable names and namespace. Open any well-established code editor, ...
0
votes
1answer
786 views

Listings: Correct syntax highlighting for bash // Use minted package with a box

Since i can't use the listingspacket to display my bash script (because of the wrong syntax highlighting by using i.e. language=bash) i have to use the minted package. So i have two questions: Does ...
0
votes
0answers
159 views

Highligt HTTP headers in Latex

I am looking how to define HTTP headers highlighting in Latex by using lstlisting or any other library. The highligh style should seperate GET/POST/DELETE update statements (by color) and distinguish ...
0
votes
0answers
308 views

Texstudio is not highlighting last change in pdf preview

If I do changes for example, my name of the thesis on the frontpage, the preview Windows on the right shows me the new content of my pdf. Normally after I compile (F6) or build and view (F5) , I ...
1
vote
1answer
217 views

Feynman diagrams using tikz-feynman package

I am using the following piece of code to draw a Feynman diagram using the tikz-feynman package. \begin{equation*} \feynmandiagram[layered layout, medium, horizontal=a to b] { a [particle=...
5
votes
4answers
728 views

Latex Equations: Colour all instances of symbol

I (and most humans) find equations a lot easier to read when certain variables are highlighted. For example: $$ 0 = \frac{\partial}{\partial\color{blue}{z_l}}\big(\|h(z_{l-1})\cdot w_l-\color{blue}{...
1
vote
0answers
179 views

Customized color for a specific command in Texstudio or in another editor

I need to obtain a custom color for the text inside the \sepfootnotes command (which I defined as \xnote using \newfootnotes{x}), just to appear green like the one inside the \nameref command, but it ...
1
vote
0answers
143 views

Cannot obtain proper command highlighting with Texstudio and tex.qnfa

I'm trying to obtain a custom highlighting for the \xnote command in TexStudio editor, and I'm following these instructions, but when I add the lines to tex.qnfa as suggested it highlights the entire ...
2
votes
1answer
259 views

TexStudio highlighting

I'm using a number of \Sexpr statements in my Rnw file. They contain $ symbols and this results in e.g. The result is very messy green highlighting in inappropriate places and a hard to read file. ...
1
vote
0answers
150 views

Unrecognised inputted commands highlighted [closed]

\documentclass[a4paper]{article} \input{header} \begin{document} \maketitle ... I have made a file known as "header.tex" which contains a lot of new commands and what not that I've made to make it ...
0
votes
1answer
228 views

Tex Studio: Why is my preamble orange?

In Texstudio's preamble section where I declare my packages, I have noticed that some of the texts are highlighted as orange. There are no errors when compiling the document. Can someone explain ...
2
votes
1answer
1k views

Add keyword to language in minted

I use minted to highlight some javascript code. I use \documentclass{article} \usepackage{minted} \begin{document} \begin{minted}{js} const mySchema = new Schema({ name: String, is_true: ...
2
votes
1answer
288 views

Colour text to match the colours in \inputminted

I use \inputminted to include snippets of C code in my document. These snippets are nicely coloured. I know I can write e.g. \textcolor{red}{foo} but instead of red I want to say "the same colour ...
3
votes
1answer
394 views

How to use minted code syntax highlighting on 2 columns document?

The code is not wrapped and overlaps over the second column of text, as shown in the next image. Currently I'm just using it as follows: \begin{minted}{smalltalk} \end{minted} Is there any easy way ...
1
vote
0answers
120 views

Package listing: colorizing assembly listings

Assembly numbers are usually hexadecimal (A-F), and if the number is started on A..F, 0 is prepended, like: 123h, 0A12h, etc. Also, "h" must be present at the end. Also, regular decimal numbers are ...