Linked Questions

1
vote
1answer
79 views

Equation overflowing overfull \hbox [duplicate]

I have a question about showing C++ code in LateX When I do the following, the C++ goes past the page. Is there a way to fix this? \documentclass{article} \newcommand{\dd}[1]{\mathrm{d}#1} \...
2
votes
1answer
12k views

Adding programing code on LaTeX

I need to put some code from Linux's configuration files and some JavaScript in a document. I have tried to use \texttt, it worked for some Linux's basic commands like sudo apt-get install XYZ, but ...
3
votes
1answer
518 views

Listings — make linebroken line comment a comment

So, I have listings wrapping lines in my code listing using the breaklines option. Fortunately, I can let the default breaks stand in most cases, as I am listing Python code which is fairly tolerant ...
1
vote
1answer
673 views

how to wrap a long terminal command without real line breaking?

this may look like a duplicate question to this one and many, but really I had a hardtime in finding the desired solution. The breaklines=true didn't work as it breaks the long command. Hence simple ...
4
votes
1answer
209 views

wrapping long python arrays in listings package

NOTE I have tried the following answer to a similar question , but it doesn't work: lstlisting line wrapping My problem is trying to put the following code in latex: import matplotlib.pyplot as plt ...
1
vote
1answer
459 views

Insert word, character, or symbol at beginning of all hanging indents in paragraph

In the same vein as this question (and somewhat similar to this question), I am trying to insert anything (e.g. a word, character, or symbol) at the beginning of each wrapped line in a paragraph. ...
3
votes
1answer
208 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 ...
0
votes
1answer
448 views

How to format an algorithm using lstlisting

I'm writing an algorithm using lstlisting : \lstset{language=C++} \begin{lstlisting}[frame=single,caption=Algorithme de la méthode "HOG+SVM"] HOGDescriptor hog;\\ hog.setSVMDetector(...
1
vote
0answers
475 views

Adjusting the text width of R listings in LaTex [closed]

Hi I have R codes that I am listing in my LaTex file with \begin{lstlisting}[language=R] R code \end{lstlisting} I have no specific listing setting in my preamble. My R code is very wide and ...
0
votes
1answer
53 views

Listings breaklines at predefined places

The code lines I write within a lstlisting sometimes are too long. So at the end a line break occurs. But sometimes these breaks are not well chosen and can make the code much more unreadable. Is ...
0
votes
0answers
57 views

Define new column type in which content is surrounded by an environment

Building on this example: \documentclass{article} \RequirePackage{longtable,nameref} \usepackage{amsmath} \usepackage{xcolor} \usepackage{listings} \lstset{ frame=single, breaklines=true, ...