TransWikia.com

How to fit long strings that goes out of page using lstlisting?

TeX - LaTeX Asked by Diego Olvera on February 24, 2021

I am finishing my thesis in Overleaf and need to add an XML file in the appendix. I use lstlisting package. The problem is that the file contains strings with many characters and does not fit in the page. The option breaklines = true not break large strings, only break lines between words. How can I display the file appropriately?

The code that generates the image below is

lstset{
language=xml,
tabsize=3,
%frame=lines,
caption= Archivo ejemplocfdv3.xml utilizado para generar los sellos,
label=code:sample,
frame=shadowbox,
rulesepcolor=color{gray},
xleftmargin=20pt,
framexleftmargin=15pt,
keywordstyle=color{blue}bf,
commentstyle=color{OliveGreen},
stringstyle=color{red},
numbers=left,
numberstyle=tiny,
numbersep=5pt,
breaklines=true,
postbreak=mbox{textcolor{red}{$hookrightarrow$}space},
showstringspaces=false,
basicstyle=footnotesize,
emph={food,name,price},emphstyle={color{magenta}}}
lstinputlisting{ejemplocfdv3.xml}

Example of lstlisting not breaking long strings

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP