4
votes
1answer
67 views

Listings with keywords that contain both letters and numbers

I have a listing which needs to highlight keywords with both letters and numbers. Following the advice in this question I've used the otherkeywords to define the keywords which contain numbers. This ...
3
votes
1answer
44 views

Why don't those non-alphanumeric chars (*/_) get colored in blue, here?

Consider the following example: \documentclass{article} \usepackage{listings} \usepackage{xcolor} \lstset{language=R, morecomment=[l]{>}, commentstyle=\color{blue}, alsoletter={*} ...
4
votes
1answer
75 views

How can I highlight JSON string values but not attributes?

example { "name" : "alan", "alias" : "nala" } If I use morecomment=[s][\color{red}]{"}{"}, How can I highlight JSON string values (on the right side) but not the attributes (left side)?
5
votes
1answer
79 views

Correctly highlighting custom html tags in listings

Problem statement I have several code listings containing HTML markup in my latex files. These listings contain multiple custom html tags (created in combination with corresponding AngularJS ...
4
votes
0answers
70 views

(Clickable) cross-reference in lstlisting

To generate documentation for an 'application programming interface', I would like to have a syntax highlighted area (with the class declaration), which has clickable links to the documentation (which ...
2
votes
1answer
75 views

How to set different color in listing?

I want to split the listing into three different colors. How to do it? I have read Peter Grill's answer and apply it like this: \documentclass[12pt]{article} \usepackage[utf8]{inputenc} ...
7
votes
2answers
159 views

highlight line numbers in listings

I would like to highlight the line numbers of the lines I refer to with lstlistings. I use escape characters to define labels in my Listing to which I refer later in my document (e.g. see Line X of ...
2
votes
1answer
91 views

How to include program listings in C# with custom font and syntax highlighting in LyX?

I'm rather new to LaTeX and use LyX editor to create my documents. There are similar questions but none of them answer how to do that in LyX. I am wondering, how to include a program listing in ...
1
vote
1answer
43 views

error when using tcolorbox + listings for multipage source

I'm try to highlight source code with colored background, but I face a bit error. first image is created with listings only and that is what I need. You can see on the last image that basicstyle ...
1
vote
1answer
60 views

How can I highlight keywords with special characters or numbers in them?

In the following MWE the declared keywords te-st and 999 are not highlighted as expected: \documentclass{scrartcl} \usepackage{listings,xcolor} ...
3
votes
1answer
110 views

How can I highlight a keyword that contains a dash or a slash? [duplicate]

I have a Clojure listing and I want to colour certain keywords whereas I can only do for strings not including any dash ('-') or slash ('/). But I also need to consider keywords consisting of with ...
4
votes
1answer
106 views

How can I highlight SPSS Syntax code with the listings package?

I'm writing my master thesis at the moment and I want to add some code listings to the appendix. The code is written in "Syntax", the programming language of SPSS Statistics. Is there a way to ...
2
votes
1answer
63 views

Listings refuses to highlight identifiers such as 'intent–filter'. Why?

I have some xml code, which I want to look fine in my latexdocument. I am doing it this way: \documentclass[12pt]{scrartcl} \usepackage[ngerman]{babel} \usepackage[utf8]{inputenc} ...
3
votes
2answers
112 views

Listings problem with quotes in a string

A single quote occuring inside a listings string seems to be interpreted as ending the string. Is there a way to avoid this from happening? \documentclass[12pt]{article} \usepackage[top=0.3in, ...
3
votes
0answers
100 views

How do you best differentiate listings in different programming languages? [closed]

I am currently producing a new edition of an old book of mine; this new book will incorporate code samples from several different computing environments. I can using the listings package quite ...
5
votes
1answer
86 views

Why are my custom settings for listings not taken into account?

I would like some help to get my source code to look correct. The code is supposed to look like this: As you can see, some words should be purple and bold, some should just be bold, some should be ...
4
votes
1answer
103 views

How can I define a custom class of keywords in listings?

How can I define a custom class of keywords in listings? In the C# listing below, keywords, such as using, namespace, etc., get highlighted as desired. However, I would like to define a custom class ...
3
votes
1answer
75 views

Problems with spacing in lstlisting with escaped code

Consider the following code: \documentclass{beamer} \usepackage{listings} \begin{document} \begin{frame}[fragile]{title} \begin{lstlisting}[escapeinside={!*}{*!},] int add int !*\color{red}add*! ...
4
votes
2answers
177 views

Making an unfilled circle including a number in a table

I wonder is it possible to highlight a number enclosing with an unfilled circle next to a line in a listing or table like the image below? \documentclass[english,a4paper,12pt]{report} ...
4
votes
1answer
263 views

Can the listings package be set up to highlight Prolog code like minted does?

I am interested to know how listings can be customized to mimic the Pygments's Prolog lexer (i.e. make Prolog code represented by listings look the same as it is done with minted) I previously asked ...
6
votes
2answers
190 views

How can you highlight a C compiler directive spanning multiple lines?

In my \lstset{...} I have morecomment=[l][{\color[rgb]{0.1, 0.2, 0.8}}]{\#}, which I've seen used to give preprocessor commands colour. This works just fine but I'd like to get multi-line macros to be ...
8
votes
1answer
253 views

How can I automatically highlight SuperCollider symbols and environment variables?

This question led to a new package: sclang-prettifier I've been poring over the listings manual, trying to figure out how to get some very specific types of formatting for the SuperCollider ...
9
votes
1answer
948 views

How can I highlight YAML code in a pretty way with listings?

I'm trying to highlight simple YAML (the markup language, not the CSS framework) code. I know that there is a solution using pygments and minted, however, I would prefer a solution with ...
11
votes
1answer
213 views

How can I typeset LaTeX source code with this very specific syntax highlighting? [closed]

I want to put some LaTeX source code in my PDF output with the style like this: Color in text mode is white, in math mode is yellow and in comments is grey. For control sequences, I divide it into ...
4
votes
1answer
174 views

Color lines in source code that is embedded in LaTeX

I am looking for a way to mark some lines in a source code sample that will be integrated into my LaTeX code. I already found solutions to embed source code and have syntax highlighting like this ...
3
votes
0answers
152 views

Is TeX the only document creator with syntax highlighting? [closed]

Is there any other document creator software other than TeX (word processor, DTP, webapp etc.) that can include syntax highlighted source code in a number of programming languages? For me it seems ...
3
votes
1answer
2k views

lstlisting: Syntax highlighting for C++ like in Editor?

i want to insert some C++ code into my thesis and i tried tons of options to make the code look like in my editor. Here is what i have so far: \usepackage{listings} \usepackage{color} ...
1
vote
1answer
139 views

Syntax highlighting for SPARQL query in a listing? (works fine in minted environment but not in listing with mint)

I can do syntax highlighting in the minted environment, for any SPARQL query using this Pygments lexer thanks to this answer. My problem is how to get SPARQL syntax highlighting to work with mint in ...
2
votes
0answers
107 views

Deciding whether to end a line with a character or not in lstlisting [closed]

I need to write a document where there are written inputs and outputs of unix command line interface software (through bash). For example I need to show something like: $ git log --pretty=format:"%h ...
2
votes
1answer
492 views

listings doesn't print my keywords bold in lstlisting

I've got the following problem: I want to print a listing with the listings package and lstlisting: \documentclass{scrreprt} \usepackage{listings} \begin{document} ...
4
votes
1answer
273 views

lstlistings - How to highlight single quotes og keywords

I want to highlight some keywords in a listing. One keyword has an apostrophe. I searched and read already quite some time and found a couple of postings that textcomp could be very helpful for ...
9
votes
2answers
199 views

How to get listings that both feature line breaking of long identifiers and keywords highlighting?

I'm currently writing a book chapter in bioinformatics, and I would like to provide my readers some useful command lines to invoke recent software. To that purpose, I'm using the listings package to ...
1
vote
2answers
2k views

Syntax highlighting in listings for C# that it looks like in Visual Studio

Community, I want to get my C# listings syntax highlighted like in Visual Studio but I did not get it so far. Here's an image of the syntax highlighting of Visual Studio: Here is the code I have: ...
3
votes
0answers
108 views

Highlight LaTeX code and presenting results as in a manual [duplicate]

I would like to write a short guidelines of LaTeX for my students. In the spirit of some LaTeX manuals, I'd like to present the code and the result as follows, This example illustrate more or less ...
0
votes
1answer
263 views

Issues when including a tex file [closed]

I have this without any issues if I use it alone. However if I call it with input or include I get this Why?
3
votes
1answer
644 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} ...
3
votes
1answer
369 views

Markup Haskell sources in complex structured document with `lhs2TeX`

Simple task Suppose there is a example.tex file with Haskell listings: \documentclass{article} \usepackage{fancyvrb} \DefineVerbatimEnvironment{code}{Verbatim}{fontsize=\small} \begin{document} ...
7
votes
1answer
233 views

How can I highlight a keywordsprefix in listings?

Ok, so here's my problem which I'm repeatedly gnawing on, whenever I try to typset source code. To this day, I have not found someone on the internet asking for the same problem. I want to add a ...
4
votes
1answer
95 views

Ugly spacing in lstinline

I am using the listings package to typeset Erlang source code in my thesis. For short snippets, I use \lstinline. The result is often unsatisfying. Consider the following example, which contains ...
8
votes
2answers
306 views

How can I highlight an interactive GAP session just like so?

Suppose I want to typeset a screen session in some programming language (GAP in my case, but it could be Python, BASH, or something else with an interactive read prompt just as well). So on my screen, ...
2
votes
1answer
819 views

Syntax highlighting for different programming languages [duplicate]

In my paper I want to include some source codes with colored sytax. For syntax highlighting I use the listings package: \lstset{frame=tb, language={[Visual]Basic}, aboveskip=3mm, belowskip=3mm, ...
1
vote
1answer
254 views

Highlighting a Chunk of Code within a lstlisting by specifying the line number

This question in somehow related to http://stackoverflow.com/questions/1304315/highlighting-a-chunk-of-code-within-a-lstlisting but not exactly the same. I want to make some slides with animation ...
9
votes
0answers
459 views

Making Source Code Copyable with listings [duplicate]

I'm using listings to display some matlab code in my latex document but i'd like to have syntax highlighting. I've tried two ways of getting syntax highlighting and neither make the code copyable. The ...
0
votes
1answer
238 views

List a CMake file [closed]

Does anyone have/know of a style file for the listings package which would enable the correct syntax highlighting of cmake files in LaTeX?
8
votes
1answer
468 views

Highlighting double backslash using listings with texcsstyle

I've got a question (it's in the title) about listings that I do not believe have been answered anywhere (either that or my Google-fu isn't that sufficient). Before I knew of texcsstyle's star option, ...
2
votes
2answers
787 views

lstinputlistings syntax highlighting

I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like class MyClass(Yourclass): def __init__(self, ...
6
votes
2answers
211 views

Improving the POV definition in the listings package

I'm attempting to create a language definition in the listings package that mimics exactly the syntax highlighting in POV-Ray 3.6 for Windows (http://www.povray.org/download/). Here is a screenshot ...
4
votes
0answers
58 views

Highlighting keywords with spaces with the listings package [duplicate]

Possible Duplicate: How to emphasize within a listing two successive identifiers separated by a space? I am trying to highlight the following keywords with the listings package: over ...
2
votes
3answers
311 views

How can I highlight text before a character with listing?

All is in the title. I would like to add a color to the text before a character with listing package. For example, I would like to add a color to text between the beginning of a line and : or =, in a ...
5
votes
0answers
518 views

Advanced use of listings package [closed]

I am a PhD student in A.I. that is using the listings package to render its code snippets. I am trying to define a language environment for Drools - a quite famous Production Rules System - that is ...