# listings: Break long hexadecimal in multiple lines

For our bachelor project, we are implementing an encryption algorithm. Our implementation is of course explained in a report written with LaTeX.

The encrypted cyphertext is a very long hexadecimal value. Just using \lstinputlisting[title=ciphertext]{encrypted_cyphertext.txt} will result in the text running off the right side of the page, as listings will only break on word separators; a hexadecimal value is treated as a single (very long) word.

Is there any way to break inside of words using the listings package?

• Please add a small compilable LaTeX document that illustrates your problem and that allows us to propose solutions. Just use the edit button left below your question. – gernot Sep 19 '16 at 12:34

\documentclass[]{article}
\usepackage{listings}
\lstdefinelanguage{encryption}
{morekeywords=X, %one keyword is needed ...
otherkeywords={1,2,3,4,5,6,7,8,9,0,a,b,c,d,e,f},
}
\textwidth=3cm

\begin{document}
\begin{lstlisting}[breaklines,breakindent=0pt,language=encryption]
546869732069732061206c6f6e67207465787420696e206865786164657a696d616c
\end{lstlisting}
\end{document}