0

I'm trying to show a url with a long parameter list, and I'd like to prioritize some breakpoints over others, eg:

http://example.com/endpoint/?longsequence=\seqsplit{[100,200,300,400,5000,60000,70000,80000,9000000,1000000000,110000000,120000000,13000000,14000000,1500000,1600000,1700000,1800000,19000000,2000000000]&another=asdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasad}

My problem here is that seqsplit is often choosing to break in the middle of the integers, just as frequently as anywhere else. I understand I can prevent this by using \seqsplit{[{100},{200},{300}...]} but for a long list, grouping manually becomes quite cumbersome.

Ideally, I could say something like:

\seqsplit[\& ,]{...}

To suggest that seqsplit prioritize the & and , as good breakpoints.

1

I can propose a different solution:

\documentclass{article}
\usepackage{xparse}

\ExplSyntaxOn
\NewDocumentCommand{\longstring}{O{}m}
 {
  \tl_map_inline:nn { #2 }
   {
    ##1
    \tl_if_in:nnTF { #1 } { ##1 } { \penalty -100 } { \penalty 0 }
    \skip_horizontal:n { 0pt plus 1pt }
   }
 }
\ExplSyntaxOff

\begin{document}

http://example.com/endpoint/?longsequence=\longstring[\&,]{[100,200,300,%
  400,5000,60000,70000,80000,9000000,1000000000,110000000,120000000,%
  13000000,14000000,1500000,1600000,1700000,1800000,19000000,%
  2000000000]\&another=asdasdasdasdasdasdasdasdasdasdasdasdasdasdasdasad}

\end{document}

A slightly stretchable space is added after , and \& in order to help filling lines.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.