Questions tagged [syntax-highlighting]
For questions about highlighting document source code in your editor.
153
questions
0
votes
0
answers
20
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
\...
1
vote
1
answer
40
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 ...
0
votes
0
answers
17
views
TeXstudio not recognizing standard commands imported via custom package
I organize my long LaTeX documents (in the document class book) by splitting them into various files in a common folder:
A .sty file that contains all the RequirePackage and custom commands.
chapter....
0
votes
0
answers
46
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 ...
1
vote
0
answers
27
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 ...
1
vote
0
answers
50
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 ...
0
votes
0
answers
27
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 ...
1
vote
1
answer
79
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}
\...
1
vote
1
answer
50
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 ...
0
votes
0
answers
50
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 ...
1
vote
1
answer
192
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{...
1
vote
1
answer
180
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 ...
5
votes
0
answers
130
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 ...
4
votes
2
answers
313
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}...
0
votes
0
answers
45
views
Highlight \iffalse ... \fi as comment in VSCode LaTeX Workshop
I write LaTeX documents in VSCode using the LaTeX Workshop extension and occasionally I use \iffalse ... \fi statements to comment out larger blocks of text.
Is there a way to tell LaTeX Workshop to ...
2
votes
1
answer
112
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 | ...
0
votes
1
answer
119
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 ...
2
votes
2
answers
237
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 ...
0
votes
0
answers
136
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 ...
0
votes
0
answers
31
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 ...
1
vote
0
answers
140
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 ...
0
votes
0
answers
976
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\...
0
votes
1
answer
130
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
...
1
vote
1
answer
142
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*} ?
...
0
votes
1
answer
223
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 ...
1
vote
0
answers
238
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 ...
0
votes
1
answer
37
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\...
2
votes
1
answer
678
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
...
0
votes
0
answers
96
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 ...
0
votes
0
answers
69
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://...
1
vote
1
answer
92
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 ...
0
votes
1
answer
110
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 ...
1
vote
1
answer
226
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 ...
1
vote
1
answer
364
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 ...
1
vote
1
answer
3k
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.
4
votes
1
answer
454
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 ...
1
vote
1
answer
464
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}
\...
0
votes
1
answer
279
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 ...
2
votes
1
answer
117
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.
...
1
vote
0
answers
126
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 ...
0
votes
0
answers
37
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 ...
0
votes
1
answer
293
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{...
4
votes
1
answer
69
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 ...
0
votes
0
answers
166
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 ...
0
votes
0
answers
77
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 ...
3
votes
1
answer
242
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?
1
vote
0
answers
74
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 -&...
0
votes
3
answers
346
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
%%% ...
1
vote
1
answer
104
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.
0
votes
0
answers
56
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 \...