Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- begin{lstlisting}[]
- Test1: 33b7a2f7c4cc93c46dd4ee2ed81aa1eb-9409135542c79d1ed50c9fde07fa600a_cce5a2fe76bfbd0c48d79fb43a7106f0_263e9a8711c1400fb2a716a1b820ac9a
- Test2: 33b7a2f7c4cc93c46dd2423423423423-9409135542c79d1ed50c9fde07fa600a_cce5a2fe76bfbd0c48d79fb43a7106f0_263e9a8711c1400fb2a716a1b820ac9a
- end{lstlisting}
- begin{lstlisting}[breakatwhitespace=true, literate={-}{}{0discretionary{-}{\}{}}]
- ...
- end{lstlisting}
- begin{lstlisting}[language=TeX,breaklines]
- ...
- end{lstlisting}
- makeatletter
- {obeylinesgdefbt@eol{^^M}}
- newenvironment{breakabletexttt}
- {ttfamilyhfuzz=0.4em
- list{}{leftmargin=2em
- itemindent=-leftmargin
- listparindent=-leftmargin
- parsep=0pt}
- itemrelaxobeylinesbreakable@texttt}
- {endlist}
- defbreakable@texttt#1{%
- ifx#1end
- expandafterend
- else
- expandafterifxbt@eol#1%
- #1%
- else
- string#1hskip1sp
- fi
- expandafterbreakable@texttt
- fi}
- makeatother
- begin{breakabletexttt}
- <long line 1>
- <long line 2>
- ...
- end{breakabletexttt}
- makeatletter
- {obeylinesgdefbt@eol{^^M}}
- newenvironment{breakabletexttt}
- {ttfamilyhfuzz=0.4em
- list{}{leftmargin=2em
- itemindent=-leftmargin
- listparindent=-leftmargin
- parsep=0pt}
- itemrelaxobeylinesobeyspacesexpandafterbreakable@texttt@gobble}
- {endlist}
- defbreakable@texttt{futurelet@let@tokenbreakable@texttti}
- defbreakable@texttti#1{%
- ifx@let@tokenend
- expandafterend
- else
- expandafterifxbt@eol@let@token
- par
- else
- string#1hskip1sp
- fi
- expandafterbreakable@texttt
- fi}
- makeatother
- begin{breakabletexttt}
- line
- ...
- end{breakabletexttt}
- % Source : http://forum.mathematex.net/latex-f6/forcer-le-retour-a-la-ligne-dans-texttt-t13246.html#p127511
- documentclass{article}
- makeatletter
- newcommandbreakabletexttt[1]{texttt{breakable@texttt#1@nil}}
- def@gobble@fi#1fi{fi#1}
- defbreakable@texttt#1#2@nil{%
- #1hspace{0pt plus 0.1pt minus 0.1pt}%
- ifxrelax#2relax
- %
- else
- @gobble@fibreakable@texttt#2@nil
- fi
- }
- makeatother
- begin{document}
- catcode`_=11
- breakabletexttt{33b7a2f7c4cc93c46dd4ee2ed81aa1eb?9409135542c79d1ed50c9fde07fa600a?cce5a2fe76bfbd0c48d79fb43a7106f0?263e9a8711c1400fb2a716a1b820ac9a}
- catcode`_=8
- end{document}
- % Sources :
- % * http://forum.mathematex.net/latex-f6/forcer-le-retour-a-la-ligne-dans-texttt-t13246.html#p127511
- % * https://tex.stackexchange.com/questions/33465/changing-the-catcode-of-in-one-command
- documentclass{article}
- makeatletter
- newcommandbreakabletexttt{begingroupcatcode`_12 breakabletexttt@i}
- newcommandbreakabletexttt@i[1]{texttt{breakable@texttt#1@nil}endgroup}
- def@gobble@fi#1fi{fi#1}
- defbreakable@texttt#1#2@nil{%
- #1hspace{0pt plus 0.1pt minus 0.1pt}%
- ifxrelax#2relax
- else
- @gobble@fibreakable@texttt#2@nil
- fi
- }
- makeatother
- begin{document}
- breakabletexttt{33b7a2f7c4cc93c46dd4ee2ed81aa1eb?9409135542c79d1ed50c9fde07fa600a?cce5a2fe76bfbd0c48d79fb43a7106f0?263e9a8711c1400fb2a716a1b820ac9a}
- end{document}
- lstset{various options,
- breaklines=true,
- literate={-}{}{0discretionary{-}{}{-}},
- various other options}
- documentclass{article}
- usepackage{listings}
- usepackage{xcolor}
- makeatletter
- def@tempA#1#2@end{%
- @tempA@{#1}%
- ifxrelax#2relax
- else
- @tempA#2@end
- fi
- }
- def@tempA@#1{{noexpand#1}{{char`noexpand#1 allowbreak}}1 }
- edef@tempB{noexpandlstdefinelanguage{logfile}{%
- columns=fixed,%
- keepspaces=true,%
- breaklines=true,%
- literate=@tempA 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!()*+,-./:;<=>?@[]_|`^"'&$\~#%{}@end
- }}
- @tempB
- makeatother
- begin{document}
- newlengthlstbasewidth
- settowidthlstbasewidth{ttfamilysmall X}
- lstset{
- basicstyle=ttfamilysmall,
- language=logfile,
- breakindent=4lstbasewidth,
- basewidth=lstbasewidth,
- postbreak=llap{scriptsizetextcolor{blue}{$hookrightarrow$}kern0.25em}
- }
- begin{lstlisting}
- !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./
- 0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?
- @ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~
- end{lstlisting}
- end{document}
Add Comment
Please, Sign In to add comment