{listings} is a package that extends LaTeX's {verbatim} features. A variety of syntax highlighting options are available. For general questions about {verbatim} or {highlighting} use the respective tag. For the unrelated concept of list structures, use {lists} instead.

learn more… | top users | synonyms

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} ...
1
vote
0answers
79 views

listings frame for multiple page code [closed]

My code is really long. And I really want to use the frame Shadowbox in my code. But the problem is since it is going over a single page, the box is actually completing at the end of the code ...
1
vote
1answer
165 views

\lstinline break at punctuation

I need listing package (\usepackage{listing}) to break at punctuation namespace::subnamespace::class ^ ^ at either these two locations
1
vote
0answers
34 views

Mixing multiple programming languages with different styles in same document [duplicate]

Possible Duplicate: Defining lstset parameters for multiple languages What's the easiest way to include code, using listings, from more programming languages? \lstset{ % language=Python, ...
1
vote
1answer
176 views

Combine listings package with my own enviroment [duplicate]

Possible Duplicate: How to use different lstset settings for listings? I have defined my own enviroment as: \newenvironment{codegui}[3]{% \def\tmplanguage{#1}\relax ...
1
vote
1answer
202 views

Using package listings with sciposter

Could you please provide a working example in which a source code delimited by listings environment word wraps its lines, without breaking the column layout of sciposter? Whenever I put a long line ...
1
vote
1answer
686 views

Code fails with Emergency stop, when using \expandafter\csname and such in listings

I am further working on my code for LaTeX Examples. I want to use the package showexpl for the simultaneus printing of code and results. Unfortunately I get an '! Emergency stop.' ...
1
vote
1answer
244 views

How to make my unusual environment accept one argument?

I cannot find a good title to express my question. Therefore, please parse the following code first. Minimal Code \documentclass[dvips,dvipsnames,cmyk,table]{book} ...
1
vote
2answers
826 views

Define a new environment to combine tikzpicture and lstlisting

I would like to define a new environment to combine the tikzpicture environment from package pgf/tikz and the lstlisting environment from package listings. The result would be to first produce the ...
1
vote
1answer
483 views

Without defining a new command for each setting, is it possible to pass the set of settings to the optional argument of lstinputlisting ?

Screenshot Scenario I want to define two sets of settings for \lstinputlisting--One setting for CSharp A and the other one for CSharp B. They are different only in the color settings. ...
0
votes
1answer
789 views

Standard single quotes for code in listings [duplicate]

In my code, I have curved quotes (see screenshot). Can I replace them with vertical quotes? This is my formatting code: \lstset{% % General design backgroundcolor=\color{lightgray}, ...
0
votes
1answer
157 views

Changing code in listings dynamically [closed]

I need to change dynamically the code in the listing by adding just one key word to the code. I tried to do it like this: \begin{lstlisting}[escapechar=|] class MyThread extends Thread { private ...
0
votes
1answer
237 views

\afterpage issue with \lstlisting

I have issue with \afterpage command and \lstlisting, it's add one blank page after beginning code listing, and after blank page is two of my command. \appendix \section*{APPENDIX A} ...
0
votes
1answer
383 views

Highlighting line ranges in listings

I've put here one adaptation for "no-beamer" documents of this code. Thanks a lot for the indications given below by Daniel. % Sources : % 1) ...
0
votes
5answers
750 views

How to prevent extendedchars=\true from producing a blank line?

My previous question How to suppress BOM effect in the output? has been solved by @Vaulty. Enabling extendedchars=\true, however, produces an unnecessary blank line at the first line as shown below. ...
0
votes
1answer
426 views

Align normal text inside a listing

I need a way to correctly align the escaped strings that I put inside of this listing. The problem is that they are presented right aligned. I want that this lines keep the indentation of the previous ...