1
vote
1answer
125 views
More sophisticated syntax highlighting of Prolog code
I'm wondering, does listings allow you to define your own syntax highlighting, and if so, how sophisticated is its system?
Here's a minimal example:
\documentclass{article}
\usepackage{listings}
...
5
votes
1answer
96 views
+50
“Isodat” language source code syntax highlighting
Isodat language is used for Mass-spectrometers from ThermoFisher Scientific®, which is used for Stable Isotope Mass-spectrometry.
Parts of the language's syntax highlighting has been explored in ...
2
votes
1answer
54 views
\textcolor within lstlisting?
I have some pseudo-code where I want to highlight some sections in a different color (this is why: in an assignment at university, I have some code given and have to adapt it. I want to highlight what ...
1
vote
1answer
50 views
XML with Listings: Different colors for attributes and elements
How can I make every attribute name in color X and every element name in color Y without adding keywords and stuff?
What I did so far:
\lstdefinelanguage{myXML}
{
morestring=[b]",
...
3
votes
1answer
88 views
lstlisting in a box?
My problem is that I am trying to write a document with coloured sections for examples. Examples can contain code listings. Somehow I can't seem to combine a background colouring with a listing, or ...
2
votes
0answers
55 views
Regular expressions in listings
I'm looking for a possibility to use regular expression in listings. I'd like to highlight each N thats followed by 4 decimal numbers for example N1234. How can I achieve that?
Here is an example:
...
6
votes
1answer
88 views
Adding words to lstlisting for Python langaue
I wish to add a few keywords to some python code inserted into a latex document. I want to make 'True' & 'False' appear yellow and also some module calls such as 'ttk' appear red. I have tried ...
1
vote
1answer
75 views
lstlisting: how to align highlighted code
I want to define a couple of new commands in order to highlight parts of my code (this is actually for a trace dump, not for a programming language).
My problem is that I can't seem to make the ...
4
votes
1answer
97 views
Why keywordstyle is not taken into consideration no bold, no red color?
When I have this code with .sty file from here
\begin{lstlisting}[language=Go, firstnumber=1, captionpos=b, caption=Golang, label=amb]
// You can edit this code!
// Click here and start typing.
...
5
votes
1answer
170 views
Listings package: coloring integers
I am using the Latex Listings package to include code in a document. I need to implemented syntax highlighting similar to what you see in a standard IDE.
I've been able to assign colors to comments, ...
6
votes
1answer
258 views
lstlisting border bug when breaking lines
I have a certain bug regarding listings. I have used the \lstset command to configure my lstlisting environment.
Somehow, when I have a line that is too long to fit into one row the listing breaks ...
5
votes
1answer
152 views
Creating new colors in xcolor for use in listings
I'm trying to include some code using \usepackage{listings}. However the default look is not very pretty, so I want to customize it a bit. I've read some of the other posts about changing the layout ...
4
votes
1answer
169 views
\lstinline & \colorbox
Why the command below don't work? How can I fix it?
\documentclass[11pt]{book}
\usepackage[dvipsnames]{xcolor}
\usepackage{listings}
\lstset{language=[LaTeX]Tex,
...
4
votes
1answer
729 views
Add another color at other keywords in listings
How can I add another color at other keywords?
For example:
morekeywordsA={RequirePackage,ProvidesPackage}=\definecolor{keywordsA}{HTML}{8A4A0B}
...
1
vote
1answer
205 views
lstaddons: Dynamic linewidth calculation
I use the package called "lstaddons" (creator, initial question) to get colored line backgrounds on listings.
I want to color the whole line to the frame.
What I miss there is a dynamic calculation ...
5
votes
1answer
298 views
How to render Android listings with syntax highlighting?
I need to include the source code of a bigger Android project in the documentation written with LaTeX. Do you recommend any particular package that is capable of highlighting Java code and which also ...
4
votes
1answer
293 views
How to add color to source code under the listings environment
I would like to color a few keywords in my slides under the listings environment
In the following contrived example, I would like to color the __shared__
word with orange and WIDTH with blue. How ...
4
votes
1answer
2k views
How do I add syntax coloring to my C++ source code in beamer
I have just learned how to insert source code into beamer with the listings package.
However I dont know how to go about adding any syntax coloring on the C++ source code.
How do I do that?
Here ...
2
votes
1answer
248 views
Background color in inline code listings with linebreak
I want to highlight code inline with a gray background. Preferably with listings.
This question is related to Colored background in inline listings.
But as my MWE shows it doesn't work with line ...
1
vote
1answer
321 views
Using colorbox in a Listing/minipage with underscore “_”
I am having some issues with using \colorbox{}{} in combination with an underscore.
The Listing will compile without issues and highlighting the text properly, but as soon as I have an underscore in ...
1
vote
1answer
182 views
Quotation mark in \lstinputlisting becomes white
How can I fix this issue with everything inside and including the "quotation mark" itself becomes white, in my case invisible due to the white background.
Thanks in advance.
I almost forgot that im ...
6
votes
3answers
434 views
Different background colors for lstinline
In the following code, I've decided to use the code from Colored background in inline listings so as to redefine \verb to have the possibility to use colors for the text and the background of the ...
4
votes
1answer
304 views
Avoid comment style for URLs in code listings
I using the following settings for code listings.
\usepackage{listings}
\usepackage{textcomp}
\lstset{language=Java,
keywordstyle=\color{RoyalBlue},
basicstyle=\scriptsize\ttfamily,
...
2
votes
0answers
85 views
lstlisting: how to color numbers in code [duplicate]
Possible Duplicates:
How can I change the color of digits when using the listings package?
Listings package: How can I format all numbers?
How to color digits with the listings package
...
9
votes
1answer
669 views
Remove keywords from code 'listings'
I tried to customize a code listing to support some pseudo-code format that suited me best. It was easy to add keywords using otherkeywords or morekeywords, but the opposite, the deletekeywords did ...
3
votes
1answer
856 views
Color \ , [], {} and / in listings environment
I tried to color a source code listing as follows.
I would like the \ to be the same color as the word that follows for example:
\documentclass in red including "\"
\usepackage in blue including "\"
...
3
votes
1answer
516 views
White horizontal lines in lstlisting
I'm having the following problem: I'm using the listings package to render what is supposed to look like a teminal screenshot. But the background colour is striped. In my other code snippets the ...
5
votes
1answer
2k views
Colored strings by listings package
I'm trying to type my C++ homework by LaTeX in order to prepare it as a pdf file.
I want to have my keywords in blue, my numbers in violet and my strings in reddish brown. I could do the two first by ...
2
votes
1answer
493 views
Using “listings” package to colorize the source code of ANTLR grammar file?
I use listings package in my diploma thesis for source code. Besides the mainstream languages like Java and C# I also need to include the sources of the language grammars (.g) which are pure mark-up ...
3
votes
1answer
322 views
How to color digits with the listings package
For my project, I've been using the listings package in order to color the keywords, comments, strings, and digits in the code.
The thing is, I've managed to color the keywords, comments and strings, ...
5
votes
2answers
451 views
How to mark whole line or part of line with background color in a listing (listings package)?
I want to highlight either a whole line of code in a listing, or a part of line (a subexpression) using background color (to not interfere with syntax highlighting).
I use lstlistings environment ...
12
votes
1answer
787 views
Coloring digits with the listings package
I'm trying to typeset some python code, and I would like integer literals to be highlighted. I've come up, after about two hours of fighting with the documentation and various other questions here and ...
2
votes
1answer
2k views
lstlisting: how to set code color and frame color
I am using lstlisting to show some code in my PDF. The problem is that when I use:
basicstyle=\fontfamily{pcr}\selectfont\footnotesize\color{red},
to change the code color (not only the language ...
3
votes
1answer
2k views
Fortran syntax highlighting in listings
I've got some Fortran 90 source code I want to put into my thesis appendix. For this I'm using the listings package. Is it possible to have colored syntax highlighting for the Fortran code?
13
votes
1answer
819 views
Listings package: How can I format all numbers?
I want to highlight all the numbers appearing in an input code of a certain program by, for example, coloring them. By numbers I mean integer, rational and floating point numbers. I am trying with the ...
4
votes
1answer
2k views
Is there a way to enable syntax highlighting coloring in Lyx for program listings?
I want to embed a small program listing and have used Insert -> Program Listing in LyX's menu for that.
The settings dialog supports selecting a language (Java), but I can't actually see any ...
9
votes
2answers
1k views
Colored background in inline listings
I would like to make inline code more distinguishable from the text surrounding it, and I thought that using a background might work (like it is done on the stackexchange pages.)
Since I use the ...
5
votes
2answers
990 views
Background overflows when using rounded corners for listings (package: `listings`)
I'm using listings to list code in my document, and I want the code to be displayed in a frame with rounded corners and a grey background color. But the background overflows the frame, as if the frame ...
4
votes
1answer
320 views
Listing, zebra effect and broken lines
In Creating a zebra effect using listings, I've found one solution to produce a zebra effect for listing.
Unfortunately, this only works if the lines are not broken. Is there a way to fix this?
Here ...
2
votes
1answer
154 views
Bug with framed, listings and xcolor are together
When using a combination of the packages framed, listings, and xcolor, that causes a strange bug, that I cannot manage to fix.
The problem is that, when a box (made with the framed package, and ...
8
votes
1answer
786 views
How can I change the color of digits when using the listings package?
I'm using the listings package and was already able to modify the color of the keywords and almost all elements I was interested in. The only thing that remains is the color of the digits. I'd like to ...
36
votes
1answer
1k views
Creating a zebra effect using listings
This question led to a new package:
lstlinebgrd (lstaddons bundle)
Friends, consider the following example using the listings package:
\documentclass{article}
\usepackage[T1]{fontenc}
...
7
votes
1answer
363 views
Problems with multi-page \lstlistings and \footnotes with the liuthesis document class
Using the liuthesis document class described at http://www.control.isy.liu.se/student/exjobb/liuthesis/liuthesis.html (download link: ...
1
vote
1answer
2k views
change font color in a lstset
Hi I need put java code to latex. I use \lstset and \begin{lstlisting}. I need change color of font in SOME part of code. How I can do this? Help pls
2
votes
1answer
951 views
operator highlighting using listings
How to color (using listings package?) C (or, well, any other programming language) operators? So that when I write
\begin{lstlistings}[language=C++]
int i = 0;
if(i > 1) {
// do ...

