1
vote
2answers
54 views

Change space style using listings package

I'd like to make all space characters in the code gray. Is there an easy way to do this? Is there something like spacestyle (I've commented it)? \documentclass[a4paper, 10pt]{book} ...
2
votes
0answers
31 views

lstlistings messes up spacing before subsequent section headings [duplicate]

I'm typesetting a grammar specification for a programming language, which leads to many short snippets of grammar and example code interleaved in the document text. The issue I observe is that an ...
6
votes
1answer
139 views

Keywords with spaces in Listings

I want spaced keywords in listings (that is, keyword, with spaces in between). Now, there are some questions in this site already answered, like this one, where the official answer is that “it is not ...
2
votes
1answer
94 views

How can I insert a thin space (\,) in a listing?

Is it possible to create small space in listing? I tried / and \, but it doesn't work in listing environment \begin{lstlisting}[caption={Inicializace ELM327.}, label={lst:initELM},captionpos=b] ...
0
votes
1answer
43 views

Strange spacing when using lstlisting

I am trying to use the lstlisting package in order to show some code in my document. However, it aligns it to the right of the page, as opposed to left as expected. \begin{lstlisting}[frame=single] ...
5
votes
2answers
86 views

Problem with spaces in listings package and hyphenation

I use the listings package and there is a space that is inserted when the line breaks and the code goes to that new line. Why is this space inserted in the new line? How can I remove it? ...
9
votes
1answer
247 views

How do I get rid of the extra blank line at the end of my listing?

I have the problem that I use a lstlisting inside an itemize. This leads to the problem of an extra line in my source code block which I'm not able to delete. I already tried nearly every parameter ...
13
votes
1answer
194 views

Tabs vs spaces in listings: what's the difference and should I care?

This is a follow-up question to Problem with Listings package concerning line breaking and wrong alignment. Why do I experience problems when I copy and paste code inside the lstlisting environment? ...
5
votes
2answers
114 views

Best way to deal with overfull inline listings

I am typesetting inline code listings using the listings package. Since I'm using C# syntax, oftentimes listings contain long words (type names/variable names). Since words in listings won't be ...
5
votes
2answers
279 views

Manually break lines like auto-breaking in lstlisting

I would like to decide where the long line should break, but with actions pre-/postbreak and without advancing in line numbering. I've tried that one: \documentclass{article} \usepackage{color, ...
5
votes
1answer
253 views

Fixing vertical spacing after \captionof as a custom caption

I'm trying to get a single caption after two columns of code. For two columns, parcolumns is the only method I've found that allows a page break in the middle and is my current favorite. Using ...
7
votes
1answer
129 views

Equal spacing for figures and listings

I want to include figures and listings in my document and I want them to have the same spacings to text and captions. \documentclass[a4paper,12pt,openany,parskip,oneside,ngerman,headsepline]{scrbook} ...
0
votes
0answers
24 views

Suppress extra inter-character horizontal space in lstlistings [duplicate]

When I use the lstlisting environment from the listings package, there is a bit of extra space between characters, even in a monospaced font. For code, I use a monospaced font (basicstyle=\ttfamily), ...
2
votes
1answer
124 views

2 column: how to squeeze line numbering closer, shift code over in Lyx

I'm using 2-column in otherwise-default Lyx, with several program listings. Some of them have line numbers. Due to the 2-column layout, the line numbers take a good chunk of the gutter between ...
3
votes
1answer
816 views

How to reduce Program-Listing line spacing in LyX

Using LyX 2.06. I have a standard document with 1.5 line spacing, but I want my program listings to use 1.0 line spacing. Is there a simple way to do this?
6
votes
2answers
2k views

Copy-pasting leading whitespace and blank lines in listings package (pdf) [duplicate]

I'm trying to use the listings package to typeset some code in a PDF document, in a way that allows me to copy-paste the resulting code. This mostly works well, if ...
3
votes
1answer
69 views

How can I use \vfill in a lstlistings environment?

I'd like to do something like this: \begin{lstlisting} public do(int whatever} { \vfill } \end{lstlisting} So basically, I want a method definition and then add spaces in the body of the method ...
4
votes
1answer
217 views

How to avoid double dash seem as a continuous line?

I'm using listings to show some source code (bash scripts) in my document but there is a problem, when using mono spaced fonts, the space between dashes is very small and in the printed document two ...
5
votes
2answers
125 views

Listings, Cleverref, and Appendix: Weird Alignment

I'm using the packages listings and cleverref in my thesis. When I put a listing in the appendix, however, it seems to be somehow indented: \documentclass{article} \usepackage{listings} ...
6
votes
3answers
412 views

Unwanted White Lines in listings environment

\documentclass{article} \usepackage{listings} \usepackage{color} \begin{document} \definecolor{light-gray}{gray}{0.95} \lstset{basicstyle=\ttfamily\footnotesize, ...
2
votes
2answers
728 views

How to preserve tabs and whitespaces in \parbox in latex

I am currently trying to insert a batch file programming code in my report. I am using the code listing. I am not able to preserve white spaces and tabs to format my code! I tried using \hspace but it ...
8
votes
1answer
129 views

Hyperref adds vertical space to listings

When I input a listing with \lstinputlisting from the listings package, I get an additional vertical space, when I use this in combination with the hyperref package. As the picture shows, a certain ...
6
votes
1answer
1k views

Problems with the lstlisting environment (margin and white line)

Consider the following example: \documentclass{article} \usepackage{listings} \usepackage{color} \begin{document} \definecolor{light-gray}{gray}{0.95} \lstset{columns=fullflexible, ...
7
votes
3answers
262 views

xelatex + frenchb introduce extra spaces before some characters in lstlisting blocks

When using babel 'frenchb' with xelatex, spaces are introduced before colons and other characters. This is great for prose, but this is also being applied to code snippets. This yields an unacceptable ...
5
votes
1answer
145 views

How to make letter spacing in verbatim/fancyvrb look like listings

I've just noticed that the spacing between letters is different in verbatim vs. lstlisting environments: Given that I add the option columns=flexible to the lstlisting environment, the spacing in ...
4
votes
1answer
89 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 ...
1
vote
0answers
82 views

spacing before scope resolution operator [closed]

I'm new to LaTeX and I have encountered a problem with the listings package, I have a space before the :: operator of C++ . after reading lstlisting with c++: spaces around scope resolution operator ...
3
votes
1answer
935 views

Removing small gaps between lines in LaTeX lstlisting output

Whenever I set a somewhat dark background color in a code listing it becomes obvious that there are small line separations, these of course stay white making the overall appearance not desirable. My ...
1
vote
0answers
40 views

\lstlistoflistings does not add spaces by chapter [duplicate]

I'm quite new in LaTeX and ended up with this problem: I'm using list of tables and list of lstlistings (\listoftables, \lstlistoflistings), both numbered by chapter. List of tables does add spaces ...
3
votes
1answer
518 views

LaTeX source code listing with less space between characters [duplicate]

I want to write shell Code in my LaTeX document. I'm using the listings package, with a code sample adapted from Tormod Fjeldskår: \documentclass{report} \usepackage{color} \usepackage{xcolor} ...
7
votes
2answers
115 views

How do I add a line automatically before a listing

I am using the listings package and I want to automatically add a blank line before every listing. Any idea on how to do this?
6
votes
1answer
563 views

Unequal letter spacing in 'listings'

I am wondering why in the pdf of the example below the letters of the word "function" and the word "sum" seem to have different spacing. This somehow looks ugly. Apart from that, I am wondering if ...
1
vote
0answers
27 views

Distance between text and \lstlisting [duplicate]

Possible Duplicate: Increase space between listings env. and surrounding text Is it possible to increase the distance between text and an \lstlisting? In my resulting PDF the listing ...
3
votes
1answer
152 views

Linebreak after \lstinputlisting

Is there any way for me to insert a linebreak after a \lstinputlisting? At the moment text proceeding the code in the lstinputlisting follows directly after but I'd prefer to have a linebreak but ...
6
votes
2answers
2k views

Increase space between listings env. and surrounding text

How can I set the space between a listing (lstlisting) and text that surrounds it? Is there a parameter I can set at the beginning of my document, that controls this? I tried framesep, but it just ...
2
votes
1answer
176 views

How to define different spaces below float and non float listing?

I am using listings from the listings-package. I'm having a problem with spaces below the listings. I use both, float- with h and non-float listings. The problem now is, that the spaces below the ...
3
votes
1answer
210 views

Headers and footers for listing environment?

What I need to be able to do is apply a header and footer when I use the listings environment. I have a few requirements: The header and footer should be outside the listing itself, i.e. they are ...
6
votes
1answer
890 views

Adjusting Vertical Spacing between a listing and its Caption

I am very new to LaTeX. I am inserting a listing as follows: \lstinputlisting[float=hk, caption=My Caption comes here, captionpos=b, ...
6
votes
1answer
4k views

Adjust bottom margin of a listing environment

I use the following settings for code listings. \usepackage{listings} \usepackage{textcomp} \lstset{language=Java, keywordstyle=\color{RoyalBlue}, basicstyle=\scriptsize\ttfamily, ...
3
votes
1answer
466 views

Strange spacing in inline listings (listings package)

I am using the listings package to typeset some code. I've defined a lstlisting environment, based upon the standard Haskell environment, and added a number of literate replacements, including: ...
7
votes
1answer
836 views

listings bug: space after literate replacement lost with spaceflexible/fullflexible columns

Problem with space being lost in listings immediately after a literate replacement when using columns=spaceflexible or columns=fullflexible (appears correctly with columns=flexible). A small example ...
3
votes
0answers
105 views

listings bug: space after quote collapsed when inlined with spaceflexible/fullflexible columns [duplicate]

Possible Duplicate: listings bug: space after literate replacement lost with spaceflexible/fullflexible columns I seem to have stumbled upon a minor bug in listings (version 1.4 as of ...
5
votes
1answer
1k views

Remove top and bottom margins around listings

When using the lstlisting environment, or similar ones from the listings package, there are paragraph-like margins above and below the actual text. This makes sense in a paper, but gets in the way if ...
3
votes
1answer
356 views

How to remove the skip after a listing when “\parskip” is increased with “\baselineskip”?

I've increased \parskip with \baselineskip to use the "skipped" paragrahs style instead of the default "indented" style. However, this causes all listings to automatically include a baselineskip ...
4
votes
1answer
577 views

lstlisting produces empty row when used inside a tabular

Is there any way I can get rid of the empty new row produced by lstlisting inside a tabular? Here's a minimum working example: \documentclass[11pt]{article} \usepackage{listings} \lstset{ ...
5
votes
2answers
3k views

How do I prevent LaTeX from showing a whitespace following a quote when in an lstlistings environment? [closed]

When I am inside the lstlistings environment, it seems that using a quote such as (') or (") will toggle on the showing of whitespace indicators (small little half rectangles). Am I doing something ...
4
votes
1answer
473 views

Listings, literate, and space at the start of the line.

I am trying to use the literate option to replace the prompt (>>>) and continuations (...) in python input with symbols that "hang" in the margin. I can almost do this with something like ...
5
votes
2answers
646 views

How can I set columns=fixed for lstinline globally?

I typeset my listings using listings with a proportional font. This looks good for the lstlisting environment. However, when I use \lstinline|code|, the spacing reverts to variable-width. I would like ...
2
votes
1answer
140 views

Increase listings spacing through the package listings or use figure instead?

This is more a conceptional question on how to use LaTeX in the right way. So far I have striven to customize only those things in LaTeX which are supposed to be without messing to much with print ...
7
votes
2answers
1k views

Grouping the list of listings by chapter

I am using the listings package. I want to print out a list of listings, which I can do. The thing is that in the other listings the typesetter "groups" figures/tables by chapter. Is it possible to ...