listings

[LaTeX] Math symbols in listings

Hi, I have a problem with Latex -- I don't know how to put mathematical equations and symbols in listings. I use --listings-- package and it's offers great looking listings, but it doesn't allow math symbols in $ .. $. Another package --algorithms-- allows math, but listings doesn't look as good as in --listings-- (the problem is that -...

[LaTeX] How to change title in listings?

Hi, I have a question about --listings-- package. Do you know how to change it to get sth like this "Algorithm " rather than casual "Listing " in the title line? Thanks for reply ...

Supress title of listings created with the LaTeX listings package

I'm using LaTeX in conjunction with the listings package and I'm trying to suppress the title of a listing such that it is neither viewed below the actual listing nor in the list of listings. Setting the option title to title="" or title= does not work. It only leads to the suppression of the listing in the list of listings. However, in...

LaTeX, Two columns, Listings and Numbers

Hi, I'm trying to get a report done and I have a small problem with the twocolums and the line numbering in listings. The document is on two columns : \documentclass[8pt,[...],a4paper,twocolumn]{article} The listings can end up either on the left or the right column. The problem is: if I put \lstset{numbers=left,frame=tb,[...]} ...

LaTex, Problem with Beamer and Listings

Hi, I'm trying to add some code in a presentation made with LaTex. I used beamer, added some frames without problems but once I add the listing, I can't compile the presentation anymore. \begin{frame}{Code} \begin{lstlisting} Sample Code \end{lstlisting} \end{frame} The error I pdflatex gave me is: Package Listings Warning: Text dro...

Use LaTeX Listings to correctly detect and syntax highlight embedded code of a different language in a script

I have scripts that have one-liners or sort scripts from other languages within them. How can I have LaTeX listings detect this and change the syntax formating language within the script? This would be especially useful for awk within bash I believe. Bash #!/bin/bash echo "hello world" R --vanilla << EOF # Data on motor octane rati...

Using special characters as keywords in latex listings package

Hi, I am using the listings package for latex. I am using the SQL language definition and am adding some new keywords that I need, using morekeywords=. I have trouble defining some special characters as keywords, for example, I need [], <>, &, and -> to be considered as keywords and use the keyword style. I have tried adding these ...

Latex: vertical line in lstlistings

I want to have a vertical line for indentation in the lstlisting environment, similar to what one can get in algorithm2e. I tried doing something like the code below, but the the |'s are not contiguous and the result is ugly. \lstset{ ... showtabs=true, tabsize=3, tab=\hfill$|$\hfill, ... } ...

Latex: Make \listoffigures look like \listoftables or \lstlistoflistings

I've got a list of listings at the end of my document following my list of tables and my list of figures. The thing that is really annoying me is that they look the same except the list of listings doesn't leave a line gap between chapters. I've had a good google around and people have asked the same question but don't seem to have had ...

Center Latex lstlisting

This is driving me crazy. I want to center a lstlisting in LaTeX. After 3 hours attempting here's some code: \lstset{ % caption=Descriptive Caption Text, label=lst:descr_capti_text, basicstyle=\ttfamily\footnotesize\bfseries, frame=tb, linewidth=0.6\textwidth } \centering\begin{tabular}{c} \begin{lstlisting} print...

[LaTeX] \listingname won't change its content

I am using the listing (NOT listings) package and have been trying to use \renewcommand{\listlistingname}{Índice de código} \renewcommand{\listingname}{Código} in order to change the "List of listings" and "Listing" text which appear in the document, since I'm writing in Spanish. However only \listlistingname seems to work, \listing...

How to create a white-on-black style for LaTeX listings...

I've been looking at Philip Bunge's post on how to create a "Tango" style with LaTeX listings, and trying to adapt this to make the default text style white and the background black (this is for slides, not an article!). This is what I added: \definecolor{Black}{gray}{0.0} \definecolor{White}{gray}{0.9} ... \lstset{ basicstyle=\color{...

latex listings caption

Hi all, I'm using the listing package with this \begin command: \begin{lstlisting}[caption=blabla, label=amb] This yields a nice code listing with a caption like ”Listing 1.1 blabla”. Is there a way to change the caption and have something like ”Code 1.1 blabla” ? I saw the ”title” command but it doesn't use a numbering system. Any ...

LaTeX: vertical alignement in a table containing a listing

In LaTeX, I'm using the listings package to display some code snippet inside a table. But it seems that when using this package, the vertical alignement of the cells is changing. Here is some code : \documentclass[a4paper,11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern,textcomp} \usepackage[frenc...

Using listings, how do I maintain grouping of listing numbers?

I'm using the listings package for showing code, as well as algorithms in pseudocode. This is what I would like happen: Algorithm 1.1: myFirstAlgorithm() ... content ... Algorithm 1.2: mySecondAlgorithm() ... content ... Code 1.1: My First Code Block ... content ... Algorithm 1.3: myThirdAlgorithm() ... content ... Wh...

How to remove entry "Listings" from table of content (toc)

How can I use \lstlistoflistings to create a list of listings, but not have this list as an entry in the table of content? Normally, a star helps to hide things like that and I use memoir as document class which supports and helps hiding lists like \tableofcontents*, \listoffigures*, \listoftables*, ... But adding the star like that: \l...

LaTeX listings package: different style for constants/classes/variables

I'm using the listings package for syntax highlighting, set up with the following arguments: \lstset{ language=Java, captionpos=b, tabsize=3, frame=lines, numbers=left, numberstyle=\tiny, numbersep=5pt, breaklines=true, showstringspaces=false, basicstyle=\footnotesize, identifierstyle=\color{magenta}, keywordstyl...

Grayed listing environment with LaTeX

Form this LaTeX-workshop, I found I could make this listing style. by defining a new environment. \definecolor{mittelgrau}{gray}{0.85}% \lstdefinestyle{StyleCommand}{% style=StyleListingBasic, backgroundcolor=\color{mittelgrau}, prebreak=\mbox{\textbackslash{}}% } \lstnewenvironment{bevel}[1][1] {\lstset{style=StyleCommand,linewidt...

Font for programming source code with LaTeX

Listing style is normally used for source code listing, but to me the default font used is not so pretty for source code listing. Attached is a comparison between listing and verbatim. How can I use the font for verbatim when I use listing environment? What would be a good font for source code listing? ...

Is it possible to make "#pragma -" like member listing on javascript source in Xcode?

If you're using Xcode, you may know member listing menu of Objective-C. http://www.flickr.com/photos/47601728@N06/4832964826/ Xcode lists members of javascript too, but marking lines by #pragma - is now allowed in javascript. Is there any way to do this? ...