[Tugindia] Wrapping long numbers

cvr at river-valley.com cvr at river-valley.com
Thu Mar 15 17:51:14 CET 2007


> On Thu, 15 Mar 2007, CV Radhakrishnan wrote:
>
>>> Hello,
>>
>>> How could I 'wrap' a long number (> 120 digits) into multiple
>>> lines without having to insert spaces manually ? I have to typeset
>>> a lot of numbers like this.
>>
>> Here is a quick and dirty solution:
>>
>> \breaklonglines takes two arguments, first is the number of digits
>> after which you want to insert a space and second is your long
>> number.
>
> Another solution (for ConTeXt, I do not know how hard it will be to
> port it to LaTeX or plain) posted by Hans Hagen on the ConTeXt mailing
> list.
>
> http://archive.contextgarden.net/message/20051221.175234.ad13a601.en.html

Following Hans' logic, here is the modified version of the \breaklonglines:

\def\breaklongline#1{%
     \@tfor\@breakchar:=#1\do{%
      \@breakchar\allowbreak}%
      }

\breakline takes only one argument of the long numbers which it scans
every digit and adds an \allowbreak after each digit which will makes it
possible to typeset without any hassles.

Best

Radhakrishnan




More information about the tugindia mailing list