1
vote
1answer
76 views

Listing linebreaking not working

got a listing where the code include a very long sequence of characters (letters, numbers & other). With linebreak=true, the sequence gets broken at non-letter characters. However I still got a ...
4
votes
1answer
101 views

What can I do if a listing is too wide to fit in my two-column document?

I am writing a IEEE document with a LaTeX template I downloaded from the IEEE webpage. I inserted some MATLAB code into the document through the mcode package. It looks something like this: ...
2
votes
1answer
42 views

Listing package showing newline after the last line of code

I haven't been able to suppress this newline only with configuration. In the listings documentation it is said that the showlines option if set to false won't let the newline appears, but that is not ...
4
votes
1answer
107 views

What, in the custom class I use, prevents line breaking in listings?

I have found how to wrap code inside lstlisting block. When my document has article class, everything works as expected. However, when I change the document's class to one I need in my work, lines do ...
5
votes
2answers
326 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, ...
2
votes
1answer
71 views

inline code listing runs into right margin

I am trying to typeset an inline C# code listing using the listings package. However, the chunk of inline code spans a few lines, so listings has to insert a coupe of line breaks into my code. So far, ...
1
vote
1answer
101 views

Why is lstlisting splitting my XML tags?

I have a little problem with this ambient. I have some XML to insert into my document and the thing that really bugs me is that the new line breaks a closing tag in two. I indicated to the environment ...
6
votes
1answer
107 views

Listings rule breaking into pieces when using xleftmargin=3pt,xrightmargin=3pt

I'm using the below coding in a Tex file and when I view the DVI output the frame rule for listings gets breakdown (please look into the screenshot below) Could some one help me in solving this ...
3
votes
1answer
63 views

Automatic line breaks of long numbers in listings

How can I automatically break long numbers in a listing? Redefining \lst@lettertrue doesn't work. \documentclass{article} \usepackage[T1]{fontenc} \usepackage{listings} \lstset{ breaklines=true } ...
3
votes
1answer
180 views

Listing / lstinline and line breaks

I'm using \lstinline among other things for writing file names of my source files. For example \lstinline{foofoo.pl} Then, sometimes I have the problem that some lines containing this string are ...
2
votes
0answers
155 views

How can I line-break a long string of numeric digits and hyphens?

I have a cls file that contains a definition for source code: \lstnewenvironment{code}[1][] { \lstset{ basicstyle=\ttfamily\footnotesize, breaklines=true, ...
7
votes
1answer
249 views

Listings - break on whitespace+

I'm using listings for the first time, and have some rather long lines of code. I get that I can break lines automatically with breaklines=true, and I can break only on whitespace with ...
2
votes
0answers
86 views

break line at comma inside listings [closed]

I'm trying to do some listings environments, but I'm encountering problems. The ideal output is this: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,⤦ ⤷ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
3
votes
1answer
117 views

breaking lines in listings enviroment

I am trying to make listing enviroment brake lines. Unfortunately breaklines=true does not work for me. Here is my code: \usepackage{listings} \begin{document} ...
3
votes
1answer
199 views

Can't insert newlines in the code listing

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 add new lines to format my code! I have following code example yet: ...
9
votes
2answers
199 views

How to get listings that both feature line breaking of long identifiers and keywords highlighting?

I'm currently writing a book chapter in bioinformatics, and I would like to provide my readers some useful command lines to invoke recent software. To that purpose, I'm using the listings package to ...
0
votes
1answer
166 views

Long codes using listing or mcode which do not break into 2 pages

I'm using the mcode package for including my codes into my documents, but the problem is that when my codes are too long, and they need more than one page the program tries to keep them in one page, ...
4
votes
1answer
72 views

break line within mathescape in listing

How do I solve the evergreen problem of breaking a long equation into multiple lines but this time within the lstlisting[mathescape] environment. Attached is the minimum working example. ...
3
votes
2answers
229 views

Right-align the prebreak symbol in a listings environment

I’m using the breaklines and prebreak option with listings, but I find it visually not very pleasing that the prebreak-symbols are not vertically aligned. I’d prefer if they were all on the very right ...
5
votes
1answer
577 views

Line breaks in listings with long lines

This is a follow-up question to Line breaks in listings My MWE with a very long line demonstrate the problem: \documentclass{report} \usepackage{listings} \lstdefinelanguage{text}{} ...
2
votes
2answers
516 views

Multiline listing within multicolumn row

I have a problem putting a listing (using lstlisting package) within a table. The problem is that I want to put a multiline listing in a row taking 2 columns. The following minimal example shows ...
8
votes
1answer
220 views

Line breaks in listings

Is there a way like wrap the line after at most 60 letters but it should not break inside some commands like listings does? Example: \documentclass[a5paper]{article} \usepackage[T1]{fontenc} ...
1
vote
1answer
166 views

\lstinline break at punctuation

I need listing package (\usepackage{listing}) to break at punctuation namespace::subnamespace::class ^ ^ at either these two locations
5
votes
1answer
521 views

About autoindent and postbreak in the package listings [closed]

I am using the package listings to show my Matlab code. The code was pre-typed in a file and everything will be loaded from the file and a .tex file will be generated automatically to show the code ...
6
votes
1answer
781 views

Enforce a line-break inside \lstinline

I use \lstinline{foo} from the listings package to set pieces of code in regular text. To get automatic line-breaks I use the following options: \lstset{ breaklines=true, breakatwhitespace=true, ...
1
vote
2answers
170 views

\begin{lstlisting} is overflowing?

I have done everything correctly but my \begin{lstlisting} is overflowing and I did not find any method to stop it. Plz help \begin{enumerate}[(b)] \item To generate a 128bit WEP key. We have added ...
4
votes
1answer
73 views

Listings WriteFile adds additional line if content contains two spaces between words

I use the listings latex package to write/read the environment body to a file. But if in the environment are two spaces between some words, there is an additional linebreak added at the beginning (I ...
2
votes
1answer
162 views

Is it possible to change the font of the text from a listing?

I have a listing of my Java code currently the font is too big and the code runs off the page. Here is what my listing looks like:
7
votes
1answer
500 views

Append character at autobreaks in listing

I'm writing a LaTeX document for a hands-on workshop which uses shell/bash commands. I'm making use of the listings package to format the chunks of code. Some of the commands are rather long so I'm ...
2
votes
1answer
252 views

Long lines when using listings [closed]

First Issue I'm using the listings package to present some algorithms using pseudocode. The problem is that sometimes the lines of my pseudocode are too "long" and listings breaks them in 2 lines. ...
2
votes
0answers
39 views

listings breaklines not working [duplicate]

Possible Duplicate: How to deal with very long lines that do not contain spaces? When I use the listings package with breaklines, it doesn't seem to break lines properly if there is no ...
4
votes
1answer
417 views

listings: closing parenthesis as delimiter not matched when linebreaks=true

I want code in parentheses and in brackets to appear in different colors. In the following document, the words brackets again appear in green as intended, and outside again is black as intended, but ...
5
votes
0answers
140 views

Preventing line break at the start of a long name in `\lstinline`

This question has developed from How to deal with very long lstinline-phrases like long class names?. That question is about line breaking inside a \lstinline phrase. I have provided an answer which ...
9
votes
2answers
405 views

How to deal with very long lstinline-phrases like long class names?

According to this Question: listing: How to deal with very long lines that do not contain spaces? My problem is that my \lstinline-phrases does not contain any special character like "-". In my ...
3
votes
1answer
711 views

Background color in inline code listings with linebreak

I want to highlight code inline with a gray background. Preferably with listings. This question is related to Colored background in inline listings. But as my MWE shows it doesn't work with line ...
2
votes
1answer
155 views

Listings not breaking up

I have a code listing as shown in the picture (number 4) that goes a bit out of the margin although breaklines=true. When I try to break new line it gives me an error Listings Error: lstinline ended ...
2
votes
1answer
173 views

Listings package does not break with mwrep document class

I cannot get listings package to break lines with any of the methods described in previous questions: Listings package does not break, ...
10
votes
1answer
2k views

Listings package does not break

The following code does not break even though the breaklines and breakatwhitespace is set: \lstset{ language=XML, numbers=left, numberstyle=\tiny\color{gray}, stepnumber=1, ...
7
votes
1answer
1k views

Avoid line breaks after \lstinline

I'm writing a computer science paper with LaTeX and have a lot of inline code. Now, when this code is followed by a comma and is at the end of line, the line break is inserted before the comma, which ...
2
votes
1answer
224 views

listings ignore final newline

When I write listings in my LaTeX code I usually follow this format \begin{lstlisting} foo bar baz \end{lstlisting} and when I put this inside a normal LaTeX document, things look fine. But when I ...
5
votes
1answer
693 views

avoid linebreak in \lstinline if possible

By using \lstinline{mysourcecode} I put some code within my document. I would like to avoid that this code is broken to a new line, if possible. so, if the codeline itself is less long than a full ...
3
votes
1answer
746 views

How to set frame size in a listing

I'm trying to put a frame around my code, but the frame has the wrong dimension. How can I set them right? ...
3
votes
2answers
1k views

Why doesn't \newline work inside lstlisting?

I am new to LaTeX and am using a template provided by a friend: \subsection{P2P library} The library is implemented in C-Sharp and provides two basic facilities - maintaining a member list at every ...
6
votes
2answers
1k views

In listings, lines that are broken (option breaklines enabled) cause frame to be drawn badly. How do you fix this?

I have an lstlisting which has breaklines and frame enabled. The actual setting is as follows. \lstset{ basicstyle=\ttfamily, showstringspaces=false, breaklines=true, keywordstyle={}, ...
2
votes
1answer
330 views

Force minted to insert new space in code that won't fit on the page

Essentially I would like to have listings' breaklines option on minted. I can't seem to find it. I could manually insert new lines but it becomes difficult when the code comes from an external file.
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 ...
12
votes
3answers
1k views

How to deal with very long lines that do not contain spaces?

I have a problem with a lstlisting environment. I want to use it for displaying several very long lines that can not be reformatted. Independently of the option breakatwhitespace=true or false my ...
4
votes
1answer
642 views

How can I create my own listings style/format?

I'm trying to format some SQL statements using the listings package. It looks OK for small statements but the long ones look bad. select * from Customers where C_nID=10; to select * from customers ...
5
votes
1answer
455 views

Listing, zebra effect and broken lines

In Creating a zebra effect using listings, I've found one solution to produce a zebra effect for listing. Unfortunately, this only works if the lines are not broken. Is there a way to fix this? Here ...