Skip to content

Instantly share code, notes, and snippets.

@k16shikano
Created March 15, 2019 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save k16shikano/5b5a329f3b32f080764c1b8e6c5c2a7c to your computer and use it in GitHub Desktop.
Save k16shikano/5b5a329f3b32f080764c1b8e6c5c2a7c to your computer and use it in GitHub Desktop.
\def\seqinsert{\ifmmode\allowbreak\else\hspace{0pt plus 0.02em}\fi}
\def\seqsplit#1{\SQSPL@scan#1\SQSPL@end}
\def\SQSPL@scan{\futurelet\SQSPL@next\SQSPL@scani}
\def\SQSPL@scani#1{%
\ifx \SQSPL@end \SQSPL@next \def\SQSPL@process{\@gobble}%
\else \ifx \@sptoken\SQSPL@next \def\SQSPL@process{\SQSPL@sp@doprocess}%
\else \def\SQSPL@process{\SQSPL@doprocess}\fi\fi%
\SQSPL@process{#1}}
\def\SQSPL@doprocess#1{#1\SQSPL@insert}
\def\SQSPL@sp@doprocess{◇\SQSPL@scan}
\def\SQSPL@insert{\futurelet\SQSPL@next\SQSPL@doinsert}
\def\SQSPL@doinsert{%
\ifx \SQSPL@end \SQSPL@next \relax%
\else \seqinsert \fi%
\SQSPL@scan}
\def\HS{\space}
\DeclareRobustCommand{\breakablett}[1]{{\ttfamily\seqsplit{#1}}}
@k16shikano
Copy link
Author

Based on seqsplit implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment