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

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,
rulesepcolor=\color{gray},
xleftmargin=20pt,
framexleftmargin=15pt,
keywordstyle=\color{blue}\bf,
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}


• Welcome to TeX SX! You might use the \seqsplit command, from the homonymous package. – Bernard Oct 16 at 21:26
• How you use it with the \lstinputlisting{ejemplocfdv3.xml} command? The only way I see to use the \seqsplit is writing the code inside a \begin{lstlisting} ... \end{lstlisting} but the command \seqsplit can not be execute inside . Also the break line inside it display a white line. – Diego Olvera Oct 17 at 0:45
• Take a look at this link: tex.stackexchange.com/questions/140637/… – Alan Xiang Oct 17 at 1:49
• @AlanXiang the link does not solution my problem. The post states that lstlisting does not break line if the character is a letter. It only break lines when a character of the category other is found (see the line with only a + and / character on the picture above). The link only specifies how to prevent break line with other characters by adding them to the letter category using alsoletter. The problem is to split long sequence of characters in base 64 alphabet. The user @TakingItCasual address this problem asking for a breakanywhere option in lstlisting. – Diego Olvera Oct 17 at 18:07