Questions tagged [listings]

{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.

Filter by
Sorted by
Tagged with
7
votes
1answer
1k views

Building keyval arguments using a macro.

I try to create the arguments for a package which uses keyval, with macro, but this does not work: Here is the demo code: \documentclass{minimal} \usepackage{listings} \lstset{language=Pascal} \def\...
7
votes
1answer
2k views

How do I remove keywords in package listings?

Sure enough, there is a morekeywords option, but suppose I need to remove some? A case in point is Pascal, in which Writeln is not (strictly speaking) a keyword, but rather a predefined procedure. I ...
2
votes
2answers
722 views

ignorespace and unskip in verbatim/listings?

I am writing a \bashDemo macro that will (a) execute its argument in a shell, e.g., bash, script, and (b) display the argument in a listings. So, \bashDemo ls -ls > myfiles \END will both run ls -...
4
votes
1answer
3k views

Listings package not correctly showing PHP strings

I'm trying to display some PHP code in a LaTeX document using the listings package. Other languages appear fine (HTML for instance) but PHP seems to be ignoring any strings within the code. The rest ...
8
votes
3answers
4k views

Using keywords including a dot in the name with the listings package

I am using the listings package which works like charm in most cases. I tried to define new languages for my needs with the help of morekeywords options in \lstset, but entering special keywords ...
4
votes
2answers
1k views

Error using \usepackage{listings}

If I include the package listings I can't compile my document anymore. There is an error saying: !No room for new \dimen.\ck ... \else \ermesage{No room...} File: \latex\sueprtabluar\supertabular.sty ...
5
votes
2answers
3k views

Listing over two columns - how to page break?

I have a two column article: \documentclass[a4paper, twocolumn]{article} Inside this is a bigger lstlisting which has a float=* to merge the two columns. However this listing needs a page break. ...
0
votes
2answers
859 views

How to hide LaTeX commands and keywords in a listing? [duplicate]

Possible Duplicate: How can I highlight some lines from source code? How to hide LaTeX command (keywords) in a listing? When I use for example \textbf{} in the listing it appears as \textbf{}. ...
6
votes
1answer
2k views

Remove\begin{Schunk} \begin{Sinput}

I am using Sweave to produce my tex. In addition I use lstlisting to highlight the source code as below. \begin{lstlisting}[caption={Computation $\widehat Y_4$ and its Residue},label=list:...
13
votes
1answer
20k views

LaTeX Listings Package, No Line Number for Comments

I am trying to get only the actual code to be line numbered rather than both code and comments. Example: \lstset{basicstyle=\footnotesize, xleftmargin=40pt, frame = single, numbers = left,caption = ...
1
vote
1answer
283 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} \usepackage[a5paper,margin=20mm]{...
1
vote
1answer
692 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. \def\...
1
vote
1answer
450 views

Program listing outputs text wider than usual

\documentclass[12pt]{article} \usepackage{listings} \lstset{basicstyle=\ttfamily} \begin{document} \texttt{int main(void)} is rendered tighter than in the listing. What lstlisting option would need ...
3
votes
1answer
3k views

Multiline listing in a table environment

I'm trying to simulate an effect that is very easy to do in WYSIWYG environments, namely having a table with some cells containing somewhat complex multi-line entities. For instance, consider the ...
3
votes
1answer
255 views

Shrink code chunks in a documentation

i'm making a documentation of a system, and i have a lot of code chunks that i want to explain, but some of them are too long. My questions if there are some way to automatically shrink those too big ...
14
votes
1answer
12k views

Using listing for displaying Matlab code

I'm trying to display matlab code in a LaTeX document and the comments are typeset with an ugly space between letters: \documentclass{article} \usepackage{listings} \lstset{language=Matlab} \lstset{...
6
votes
3answers
2k views

“Listing #” below listings without a caption

When not specifying a caption for a lstlisting nothing is shown below the listing while "Listing #: mycaption" is displayed as soon as I specify a caption. However, I'd like "Listing #" to be ...
8
votes
2answers
1k views

pass “global” options to minted/fancyvrb

Is there a way to override default options for the minted environment, rather than having to specify them for each and every snippet of code ? In other words, is there an equivalent to listings's \...
2
votes
1answer
244 views

Is it possible to load 2 or more languages at the same time in one document using listings.sty?

Assume in my book I am discussing two (or more) languages, e.g. PSTricks and LaTeX. Can I load these languages at the same time in my book document such that their keywords get proper markup?
1
vote
2answers
521 views

How to make a LTXexample-like environment by using the package listings.sty only?

For some reason, I am forced to create a LTXexample-like environment. The following is my effort, but it cannot work. :-) I don't know how to fix the problem. Thank you in advance. \documentclass[...
5
votes
1answer
550 views

How to get tex4ht to respect listings styling better ?

I've been producing PDFs and HTML from Latex sources, using tex4ht for the HTML (I'm on Debian/Lenny; so whatever versions are default on that). I'm using the listings package to include source code. ...
1
vote
1answer
4k views

change font color in a lstset [closed]

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
8
votes
1answer
3k views

Hiding code comments in listings

I'm using listings package and \lstinputstring command to insert code from a file. Is it possible to hide code comments in inserted code? I'm using a language in which # starts a comment and it lasts ...
9
votes
1answer
2k views

Package to indent and syntax highlight C++ code

I am looking for a package to have an environment for C++ source code, with options for syntax highlighting, automatic indentation, proper multipage behavior, etc. I read something about the listings ...
9
votes
1answer
2k views

how to colorize syntax using R + Sweave?

I'm writing a LaTeX document using Sweave (a Beamer presentation, really), which weaves R code and LaTeX. Is there a way to make my chunks of code and its output highlighted? I could use listings ...
6
votes
2answers
865 views

Which package for In-line and float algorithms?

I am using LyX to describe algorithms. A common scenario is that I have a snippet of pseudo code (in a float, for example) and a block of text which makes references to keywords in that pseudo code. ...
10
votes
3answers
1k views

Apply style to specific lines of a listings environment

I want to emphasize some lines in a listing environment by applying a special style on them (for example, a different background color). All custom styling seem to be content-based. I would like to ...
5
votes
1answer
394 views

Listings and continuation captions [duplicate]

In my document (KOMA script article) I use the listings package for code listings and the caption package for additional control over captions. My problem is that some listings flow over multiple ...

1
60 61 62 63
64