{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

0
votes
1answer
16 views

Listings internationalization (spanish): List of listings and caption labels not translated

I'm trying to make a latex document in spanish, I've successfully imported the babel package for the language, but the \listoflistings command does not get translated to spanish. Also captions for ...
2
votes
0answers
35 views

How to let minted break across pages but keep the caption together with the end of listing?

I want to create a listing using minted that has background colour and can be split across pages. The usual advice in that case is to use the mdframed environment and I have written a command that ...
2
votes
2answers
319 views

listings - highlighting additional keywords inside own delimiters (like Doxygen annotations)

According to listings - use different style for normal comments /* and doxygen comments /** I used listings package to set style for /** Doxygen comments */ as user defined delimiter moredelim = ...
1
vote
2answers
31 views

polish characters ą

I cannot get to work my special chars in listings, my texmaker is configurated to use utf8 in options, but I get error: ! Package inputenc Error: Unicode char \u8:�\lst@FillFixed@ not set up for ...
0
votes
0answers
50 views

inline listings line wrapping issues

I am having issues with inline listings line wrapping. As you can see in the linked image, the period ending the sentence is on the next line due to wrapping of the cite-website text. The listings ...
23
votes
7answers
11k views

Highlight text in code listing while also keeping syntax highlighting

I’m using the listings package for code listings. Now I try to highlight some part of the code using \hl from the soul package. Here’s an example of a resulting query where the injected part of a SQL ...
32
votes
4answers
10k views

How can I highlight some lines from source code?

I am preparing a presentation (using beamer) and I'll need to include many snippets of source-code. For including source code, I'll probably use listings package. (I know there is also minted package, ...
17
votes
1answer
193 views

How can I make a custom environment that wraps listings?

Thanks to this answer, I know it is possible to float and wrap text around a listing. I would like to setup an environment for mini-code snippets that always floats and wraps the same way. I can ...
2
votes
1answer
26 views

listings \def problem

When I complile the following code with xelatex, %\end{lstlisting} is a necessary line to prevent error. What is the problem? \documentclass[a4paper,11pt, onecolumn, openany,]{memoir} ...
4
votes
2answers
54 views

Document doesn't show the list of figures (LaTeX)

I have the problem that LaTeX doesn't show the List of figures and List of Listings. I don't know where the problem is. I'm working with TeXstudio and the code was defined as follows: ...
0
votes
0answers
38 views

Bug with luatexja-fontspec and tcolorbox [closed]

I found a bug with luatexja-fontspec and tcblisting of tcolorbox. Specifically, when I use "style=tcbstyle" and "\setsansjfont", I get a following error. ! Missing number, treated as zero. <to be ...
0
votes
2answers
70 views

Converting latex highlighted code listing to image

Does someone know how I could submit a paper to a journal which contains source code highlighting with minted https://github.com/gpoore/minted ? I really like the highlighting and don't want to go ...
12
votes
2answers
4k views

Inline code and short verb with minted

I it possible to use minted for inline code and to add a short verb sing for minted? Like \lstMakeShortInline| in listings.sty? \documentclass{article} \usepackage{minted} \newminted{tex}{} ...
4
votes
1answer
69 views

How can I display julia output in latex?

I've been able to typeset julia code using listings package as mentioned in the answer here. But I also wanted to display Julia output in my latex document, how can I achieve this ?
2
votes
1answer
38 views

Problem defining a new lstlisting environment

I'm relatively new to Latex and having a bad time using listings inside a beamer presentation. I know I have to use a [fragile] frame to get verbatim environment inside a frame, but for some reasons ...
1
vote
2answers
69 views

listingsutf8's option inputencoding=utf8/latin1 leads to latin1.def to be read each time a listing is used

Edit: inputencoding=latin1 option initially written should have been inputencoding=utf8/latin1 If the listingsutf8's option inputencoding=utf8/latin1 leads to latin1.def file to be read each time a ...
2
votes
0answers
45 views

Including C++ in AMS Book template

I've had a hard time incorporating my C++ code into a document which was formatted using the AMS book template. %----------------------------------------------------------------------- % Beginning of ...
1
vote
0answers
31 views

xparse verbatim argument removing multiple space

I am trying to define a command, using xparse that take as input some verbatim code and cite it using listing. However, the eventual multiple white spaces or tabulations at the beginning of a lines ...
3
votes
1answer
41 views

force at least two lines on a page in using lstlisting

I use the lstlisting package a lot in my theses. Unfortunately, it sometimes renders the caption (at bottom of the listing) on the next page or starts the listing at the end of a page, renders no line ...
4
votes
2answers
29 views

Space around escaped equations in listings?

I am using listings with mathescape=true to include some typeset output. However, I would like a little white space around that output. Currently I have \lstset{language=, keepspaces=true, ...
1
vote
0answers
46 views

Latex highlighting error for lstinline

it has been quite a while that I have this problem and I have searched everywhere online and couldn't find a solution. The problem is latex syntax highlighting doesn't work after this line: ...
3
votes
0answers
28 views

Syntax Issues with lstdefinelanguage

I have some issues defining a new language for the lstlisting package. The source code shall look like this in the end: And my latex definition looks like this atm: \documentclass[]{article} ...
3
votes
1answer
18 views

LaTeX listings Package Only gives Unbreaking Spaces when in tex4ht

I am trying to make a programming e-book, but the listings package is converting all of the spaces in the listings to non-breaking spaces. I have tried breakatwhitespace as both true and false, as ...
3
votes
1answer
88 views

LaTeX, two-column listing in an array

I am trying to display to codes side-by-side, using this: \begin{center} \begin{tabular}{c|c} \begin{lstlisting} while (x > 0) do x++; \end{lstlisting} & \begin{lstlisting} x = 0; ...
3
votes
1answer
39 views

New environment for Python source code

I am trying hard to create an environment for my source code. Here's my current state \documentclass[a4paper,fontsize=12pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} ...
2
votes
0answers
19 views

conflict using matlab-prettifier and LaTeX beamer [duplicate]

I was trying to use the matlab-prettifier package with the LaTeX beamer package, and I noticed I was getting errors when trying to compile. Mainly I was getting an error when trying to use ...
3
votes
3answers
258 views

ASCII + Unicode art in LaTeX lstlisting

I have a small ASCII diagram in my LaTeX document. \lstset{literate={↓}{$\downarrow{}$}{1}} \begin{lstlisting} -1---2----3-----| ---s---------s--| ↓ ↓ ---1*--------3***| \end{lstlisting} ...
1
vote
0answers
16 views

Get source code as it is from output [duplicate]

I am trying to display my XQuery code in a latex document as follows: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{listings} \title{code} \date{January 2016} \begin{document} ...
1
vote
0answers
58 views

How can I define a new language? [closed]

i need to insert code into my document which is written in ST (structured text) (PLL language). Couldn't find any existing solution in the web. How to add the language to the package to use it? ...
0
votes
0answers
41 views

Place the content in a block with shadow frame

I am using latex beamer and trying to put the content of the listing in a block with white background and just with a shadow of the frame as the one of google (madrid weather). I tried with ...
2
votes
1answer
52 views

shrink the size of the font size in the listing

I am using the latex beamer and trying to reduce the font size of the listing to display the whole JSON code without reducing the font size of the sentence before. How can I get it to work? Code: ...
2
votes
1answer
38 views

Using an overlay on lstinputlistings in latex

I want to have to multiple overlayed lstinputlistings on one slide in a presentation, created with latex and documentclass beamer. The only solutions I find are for lstlistings, but those don't work ...
5
votes
1answer
31 views

get all values of the JSON format red

I am using the latex beamer and trying to get the true value of the flag key in the JSON format red too but I am just getting it black as shown in the screen shot below. How can I get it red too? ...
3
votes
1answer
56 views

How to dump listings to a file?

I thought to share my solution to a problem I had. (This is one of those “answer your own question” things, plus, this way, people can improve upon it – dual-licence under The MirOS Licence please. ...
4
votes
1answer
42 views

Listings: Define new language from Emacs highlighting

In my document, I need to include code written in Macaulay2, which is not a predefined language in listings. To define it myself, I started looking for a list of keywords, and found the variable ...
0
votes
0answers
15 views

After using listings my country symbols moved to words front

So I used listings package to put my JSON script to a LaTeX file. Which looks like: \begin {1stlisting} { "wow": 30, išėjimas "nice": 1 kažkas }, ...
3
votes
2answers
37 views

“Figure” as name of listings in listoflistings with minted and newfloat

The following MWE gives me a List of Listings with "Figure" as name of listings. \documentclass{scrreprt} \usepackage{classicthesis} \usepackage[newfloat]{minted} \begin{document} ...
1
vote
0answers
56 views

Excessive vertical space after lstlisting

I have created a macro \piece to structure longer sections into smaller, numbered pieces. (I am using the macro in a set of lecture notes where I try to introduce one concept per piece.) The code, ...
5
votes
1answer
206 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 ...
5
votes
2answers
2k views

A line in the lstlisting environment cannot start with “\end{frame}” in a beamer presentation

I'm making a presentation about LaTeX using the beamer package (v3.10). I'm using the listings (v1.4) package to print pieces of latex source code and highlight the keywords. It seems that the ...
1
vote
1answer
42 views

Format code listing package

I am documenting a script which has almost 43+ keywords. The output I want is something on the below lines... and the latex code I have is \documentclass[a4paper, onesided]{article} ...
3
votes
2answers
117 views

Verbatim vs Listings for Thai Font

I have a problem about verbatim and listings. I need write some codes by using Thai font but it shows in picture \documentclass[12pt,a4paper,oneside]{book} \usepackage{verbatim} \usepackage{listings} ...
4
votes
1answer
26 views

Beamer: Section used before declaration

I'm creating a presentation using beamer and listings - when I end a section with a {lstlisting} call, the next section title appears in the slide. Is there a way that I can specify when the next ...
1
vote
1answer
67 views

Ignore errors in environments in latex-suite in vim

I use the latex-suite vim plugin, which shows me errors inline in my vim editor. However, I get false positives for certain environments like lstlistings. How can I configure latex-suite to ignore ...
1
vote
1answer
28 views

How to use lstlisting “moredelim” inside quoted text [RESOLVED, but with possible caveats for others]

update: Arun's answer, below, works for me, since I'm not using syntax highlighting anyway. Thanks! Here's my original question: I use the following setting to allow me to mark text as bold within ...
3
votes
1answer
34 views

Why does this listings command keep giving me this error?

\documentclass[titlepage]{article} \author{foobar} \title{foofoofoo} \usepackage{syntonly} \usepackage{verbatim} \usepackage{lipsum} \usepackage{listings} \begin{document} \maketitle \newpage ...
2
votes
1answer
28 views

lstinputlisting not recognizing comment character

I have some code which I like to incorporate in to my latex document. I have set up the aesthetic so the code is easy to read as follows \lstdefinestyle{numbers}{numbers = left, stepnumber =1, ...
1
vote
1answer
30 views

Setting different environment setup depending on the location in two column

I have a lstlisting environment that shows a line number either left or right side of the document. Setting up lstlisting environment by passing parameters Setting the ruby code in a two-column ...
1
vote
1answer
19 views

Setting different environment setup depending on the location in two column (also considering the figure environment)

I asked about using listings environment to put the line numbers left or right side according to the location. Setting different environment setup depending on the location in two column The code ...
5
votes
1answer
36 views

Conflict with subcaption and sublisting?

In the code below, partially derived from Split subfigures from pgfplots groupstyle, I am not able to compile my code when I include the sublisting environment. I need this listing for my Python code ...