I see from the documentation that seqsplit is supposed to work in mathmode.

However, I have the following:

Since we know $1000! = \seqsplit{4.0238726007709377354370243392300398571937486421...105933983835777939410970027753472e^{2567}}$, we can represen...

And get this error:

! Missing { inserted.
<to be read again> 
l.487 ...15933983835777939410970027753472e^{2567}}
                                                  $, we can represen...
! Missing } inserted.
<inserted text> 
l.487 ...15933983835777939410970027753472e^{2567}}
                                                  , we can represent...

It's not clear to me which part of this is underspecified in { or }. Is it fighting with the e^{}, thinking these are closing seqsplit?

What's strange is the output is correct, but I still have to answer the prompts.

  • \seqsplit can break sequences of characters; just place e^{...} outside it.
    – egreg
    Commented Nov 6, 2018 at 7:45
  • you would get essentially the same error if you did {1} {2} {^} {2567} which is more or less what you are asking seqsplit to turn your input into. Commented Nov 6, 2018 at 7:58
  • 2
    irrelevant but notice that $4.12..e2567$ or $4.12..E2567$ or $4.12...\cdot 10^{2567}$, or etc... are all better than $4.12... e^{2567}$ which is mathematically unsound notation as it raises confusion about whether $e$ is Euler's constant.
    – user4686
    Commented Nov 6, 2018 at 9:51
  • Thanks, jfbu, I actually noticed that too after posting and that was my true solution, switching to capital E and no power, but left the question up to understand the mechanics. Commented Nov 6, 2018 at 15:39

2 Answers 2


I propose a different macro:


  \int_step_inline:nnn { `0 } { `9 }
    \char_set_active_eq:nc { ##1 } { __mittenchops_activenumber_##1: }
  \char_set_active_eq:nN { `. } \__mittenchops_activeperiod:
\int_step_inline:nnn { `0 } { `9 }
  \cs_new:cpn { __mittenchops_activenumber_#1: }
    \mspace{0mu plus 2mu}
\cs_new:Npn \__mittenchops_activeperiod:
  \mspace{0mu plus 2mu}


Since we know $1000! = \longnumber{4.023872600770937735437024339230
we can represent...


Each digit is turned into a macro that typesets the digit followed by a glob of zero glue, but stretchable up to 2mu, and by a penalty that allows a line break. The period, however, removes the penalty, so there is no allowed break before and after it. There is no problem with the exponent, because penalties there do nothing.

enter image description here


It would be a pity to hardcode your 1000! in the LaTeX source.

\usepackage{amsmath}% provides \mspace

\usepackage{xintfrac}% provides \xintFac, \xintREZ

% We assume input will expand to some (long, *positive*) integer
   % first we handle trailing zeros
   % (unfortunately xint does not provide auxiliaries to get the A, B, C
   %  from the \xintREZ output A/B[C])
   % attention that \xintLen expands its argument but treats it as a
   % number to normalize, so it removes leading zeros, and they may
   % occur as we have trimmed the leading digit. So we use \xintLength
   % but some \expandafter are needed.
   % compute the final exponent
   \ITSF@lead.\mspace{0mu plus 2mu}%

\def\ITSF@parseinput #1#2/#3[#4]{%
% make global definitions to keep possibility to reuse the
% parsed integer afterwards without recomputing it
  % we assume here #3 is 1 with no error checking...

\def\ITSF@loop #1{%
  \if#1\relax\else#1\mspace{0mu plus 2mu}\penalty0 \expandafter\ITSF@loop\fi

Since we know that $1000! = \IntToSplitableFloat{\xintFac{1000}}$, we
feel that much happier.

enter image description here

I deliberately do not use e^{..} notation, see my comment

  • if required we can also obfuscate the middle digits into dots (but we needed some computation first to get the number of them; we can always get both exponent and leading digits via \xintFloatFac with suitable \xintDigits float precision, but to get the trailing digits is more difficult without some exact computation of the whole thing).
    – user4686
    Commented Nov 6, 2018 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .