Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Integers with many digits

22 views
Skip to first unread message

Frank Seaton Taylor

unread,
Dec 12, 1997, 3:00:00 AM12/12/97
to

In one of the tables for my dissertation, I have some integers that
have too many digits to print on one line. Is there some standard (or
common) way to ``hyphenate'' numbers?

I currently print my integers in math mode. I believe they look the
same in non-math mode. If so, I suppose I could put a discretionary
hyphen every three digits.

Another alternative is to write $123456789012345678901234567890 \cdot
10^50 + 12345678901234567890123456789012345678901234567890$, but that
strikes me as unaesthetic.

Any suggestions would be appreciated.

David Carlisle

unread,
Dec 12, 1997, 3:00:00 AM12/12/97
to Frank Seaton Taylor

> I have some integers that
> have too many digits to print on one line.

if you look in ctan in contrib/supported/carlisle you'll find comma.sty
which gives you a \commaform which is a new counter format, like
\roman or \alph it puts a comma every three digits by default, but
can be customised to put something else there, eg a space, which would
then allow line breaks.

David

Robin Fairbairns

unread,
Dec 12, 1997, 3:00:00 AM12/12/97
to

In article <87vhwvq...@dcarlisle.demon.co.uk>,

Err.... Does that mean he has to find a TeX implementation with
counters that run up to 10^100?

Seems excessive: presumably comma.sty's technique can be employed to
process a text string just as well as the output of printing a
counter?
--
Robin (Campaign for Real Radio 3) Fairbairns r...@cl.cam.ac.uk
U of Cambridge Computer Lab, Pembroke St, Cambridge CB2 3QG, UK
Home page: http://www.cl.cam.ac.uk/users/rf/robin.html

Paul L. Allen

unread,
Dec 12, 1997, 3:00:00 AM12/12/97
to

In article <87vhwvq...@dcarlisle.demon.co.uk>
David Carlisle <da...@dcarlisle.demon.co.uk> writes:

> if you look in ctan in contrib/supported/carlisle you'll find comma.sty
> which gives you a \commaform which is a new counter format, like
> \roman or \alph it puts a comma every three digits by default, but
> can be customised to put something else there, eg a space, which would
> then allow line breaks.

Hmmmmmm. Some countries use commas to separate digits and full stops
for decimal markers, others do it the other way around. That's why
the current recommendations for scientific work are to use a space to
group digits and then whether a comma or period is used for the decimal
marker it doesn't cause confusion. If possible, though, a thin space is
better than an ordinary space as the digit separator.

--Paul

Richard Kaszeta

unread,
Dec 12, 1997, 3:00:00 AM12/12/97
to

"Paul L. Allen" <p...@sktb.demon.co.uk> writes:

> > if you look in ctan in contrib/supported/carlisle you'll find comma.sty
> > which gives you a \commaform which is a new counter format, like
> > \roman or \alph it puts a comma every three digits by default, but
> > can be customised to put something else there, eg a space, which would
> > then allow line breaks.
>
> Hmmmmmm. Some countries use commas to separate digits and full stops
> for decimal markers, others do it the other way around. That's why
> the current recommendations for scientific work are to use a space to
> group digits and then whether a comma or period is used for the decimal
> marker it doesn't cause confusion. If possible, though, a thin space is
> better than an ordinary space as the digit separator.

Note that the above-mentioned comma.sty allows you to change the digit
separator. To do a thin space,

\renewcommand\commaformtoaken{\,}

--
Richard W Kaszeta Graduate Student/Sysadmin
bo...@me.umn.edu University of MN, ME Dept
http://www.menet.umn.edu/~kaszeta

Paul L. Allen

unread,
Dec 13, 1997, 3:00:00 AM12/13/97
to

In article <y6xoh2m...@bofh.me.umn.edu>
Richard Kaszeta <kas...@me.umn.edu> writes:

> "Paul L. Allen" <p...@sktb.demon.co.uk> writes:
>
> > > if you look in ctan in contrib/supported/carlisle you'll find comma.sty
> > > which gives you a \commaform which is a new counter format, like
> > > \roman or \alph it puts a comma every three digits by default, but
> > > can be customised to put something else there, eg a space, which would
> > > then allow line breaks.
> >
> > Hmmmmmm. Some countries use commas to separate digits and full stops
> > for decimal markers, others do it the other way around. That's why
> > the current recommendations for scientific work are to use a space to
> > group digits and then whether a comma or period is used for the decimal
> > marker it doesn't cause confusion. If possible, though, a thin space is
> > better than an ordinary space as the digit separator.
>
> Note that the above-mentioned comma.sty allows you to change the digit
> separator. To do a thin space,
>
> \renewcommand\commaformtoaken{\,}

I've not checked, but won't that result in a thin space where the line
cannot be broken, which was the point of the original question?

--Paul

David Carlisle

unread,
Dec 13, 1997, 3:00:00 AM12/13/97
to p...@sktb.demon.co.uk


> I've not checked, but won't that result in a thin space where the line
> cannot be broken, which was the point of the original question?

True, but you could do either of these:

\documentclass{article}
\setlength\textwidth{8cm}
\setlength\parindent{0pt}
\setlength\parskip{10pt}

\usepackage{comma}

\makeatletter
\newcommand\xxx[1]{{\let\number\@empty\@commaform{#1 }}}
\makeatother

\begin{document}

\renewcommand\commaformtoken{\linebreak[0]\,}
\xxx{123456789012345678901234567890123456789012345678901234567890}

\renewcommand\commaformtoken{%
\discretionary
{\hbox{ Continued on the next line\ldots}}%
{\hbox{\ldots\ }}
{\,}}
\xxx{123456789012345678901234567890123456789012345678901234567890}

\end{document}


David

PS to Robin.
Er you were right about the upper limit, but not quite for the reason
you said, see the \let above:-)

Paul L. Allen

unread,
Dec 14, 1997, 3:00:00 AM12/14/97
to

In article <87btylr...@dcarlisle.demon.co.uk>
David Carlisle <da...@dcarlisle.demon.co.uk> writes:

> > I've not checked, but won't that result in a thin space where the line
> > cannot be broken, which was the point of the original question?
>
> True, but you could do either of these:

[...]

> \renewcommand\commaformtoken{\linebreak[0]\,}

That was the point I was getting at. Sometimes it's not at all easy
to do something like this when the package author wasn't expecting anyone
to want something out of the ordinary.

--Paul

0 new messages