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

time intervals in siunitx ?

1,599 views
Skip to first unread message

antony

unread,
Apr 6, 2010, 5:57:30 PM4/6/10
to
Hi,
I'm using the siunitx package (a very nice package!) very often, but
today I stumbled upon what looked like a missing feature to me: I
believe that currently, the only way of typesetting a time interval,
say 1h 23min 45s, is \SI{1}{\hour}~\SI{23}{\minute}~\SI{45}{\second}.
Probably some shorter notation would be great, I think...
Does anyone (e.g., the package maintainer :-)) has an idea about this?
Thanks in advance,
Antony

Dan Luecking

unread,
Apr 6, 2010, 6:16:55 PM4/6/10
to

No packahe can predict all possible requirements, but you
have \newcommand to fall back on:
\newcommand{\Time}[3]{%
\SI{#1}{\hour}~\SI{#2}{\minute}~\SI{#3}{\second}%
}
...
The time elapsed was \Time{1}{23}{45}...
...

But perhaps I have misunderstood your requirement.


Dan
To reply by email, change LookInSig to luecking

Joseph Wright

unread,
Apr 7, 2010, 1:53:42 AM4/7/10
to
On Apr 6, 11:16 pm, Dan Luecking <LookIn...@uark.edu> wrote:
> On Tue, 6 Apr 2010 14:57:30 -0700 (PDT), antony
>

I've been asked to look at pretty much this idea for siunitx version
2. The existing feature request includes days, but I'd imagine
something flexible should be available. Hopefully this will make the
beta version of siuntix 2 at the end of the month.
--
Joseph Wright

Joseph Wright

unread,
Apr 7, 2010, 3:49:04 AM4/7/10
to
On Apr 7, 6:53 am, Joseph Wright <joseph.wri...@morningstar2.co.uk>
wrote:

> I've been asked to look at pretty much this idea for siunitx version
> 2.  The existing feature request includes days, but I'd imagine
> something flexible should be available. Hopefully this will make the
> beta version of siuntix 2 at the end of the month.

Further to that, can I ask for some thoughts on input syntax. As I
said, I've been asked to cover "days-hours-minute-seconds" input, with
the initial suggestion:

\dhms{<days>;<hours>;<minutes>;<seconds>}

by analogy with \ang. I thing perhaps "\timeinterval" or "\timeperiod"
is a clearer function name, but other suggestions are welcome. On the
input syntax, I can go for either one argument (as above) or four:

\dhms{<days>}{<hours>}{<minutes>}{<seconds>}

I find the \ang syntax (using one argument) quite readable: other
opinions?

In terms of output, as well as

1\,day 2\,h 3\,min 4.5\,s

I've also been asked to do "astronomy style"

1^{d} 2^{h} 3^{m} 4.^{s}5

which should be easy enough. Any other things I should be aware of? (I
am pretty sure this will be in version 2: mainly a copy-paster of the
existing \ang code but with new options.)
--
Joseph Wright

antony

unread,
Apr 7, 2010, 4:22:49 AM4/7/10
to
I know that I can do this with a newcommand, so my previous message
was more a feature request than anything else :-)
I do like the \ang syntax, so I'd prefer something like
\timeperiod{d;h;m;s} -> d\,day h\,hour etc.
\timeperiod{h;m;s} -> h\,hour m\,min etc.
\timeperiod{m;s}
and then if you don't want seconds, perhaps something like
\timeperiod{h;m;-}? (if you don't want a "big" unit, omit it, if you
don't want a "small" unit, replace the value by a "-").
\dhms is fine too.

Antony

On Apr 7, 9:49 am, Joseph Wright <joseph.wri...@morningstar2.co.uk>

Danie

unread,
Apr 7, 2010, 5:46:34 AM4/7/10
to
On Apr 7, 9:49 am, Joseph Wright <joseph.wri...@morningstar2.co.uk>

wrote:
> On Apr 7, 6:53 am, Joseph Wright <joseph.wri...@morningstar2.co.uk>
> wrote:
>
> > I've been asked to look at pretty much this idea for siunitx version
> > 2.  The existing feature request includes days, but I'd imagine
> > something flexible should be available. Hopefully this will make the
> > beta version of siuntix 2 at the end of the month.

Joseph

Maybe a bit offtopic. What about a separate package for time and
dates? Every country has its own way of writing it and then you also
find scientific groupings such as the astronomical people that has
their own way of doing it.

There is the isodate package. Maybe you and Harald Harders can work
together and add time formatting to the package. It already contain a
lot of locale spesific formating.

I have also proposed a date kernel for Latex a long time ago

http://groups.google.com/group/comp.text.tex/msg/95dc97ca593e9b7f

This can add some date calculation and calender generation
capabilities to such as package. With eTeX it can be done a lot more
simpler than my original example

Regards

Danie Els

Joseph Wright

unread,
Apr 7, 2010, 2:50:37 PM4/7/10
to
On Apr 7, 10:46 am, Danie <dnj...@netscape.net> wrote:
> Joseph
>
> Maybe a bit offtopic. What about a separate package for time and
> dates? Every country has its own way of writing it and then you also
> find scientific groupings such as the astronomical people that has
> their own way of doing it.

Hello Danie,

It's a good question: I get some very "unusual" requests for siunitx,
and picking a good "line" is not always easy. As well as the time
question, I've also been asked to look at geographical co-ordinates
(which need leading zeros in numbers and N/S/E/W). Even if I do these
separately, I'd still like to have some of the "core" of siunitx
available (things like the printing routine). I'll have to think about
it.
--
Joseph Wright

Stefan Pinnow

unread,
Apr 9, 2010, 2:41:31 PM4/9/10
to
Hello all,

I agree to Antony's opinion that \timeperiod is a fine name and it should
follow the \ang syntax.
If the "upper" values (days, etc.) should not be needed the 2 possibilities
omitting (\timeperiod{m;s}) or leaving the arguments empty
(\timeperiod{;;m;s}) should be acceptable from my point of view.

Regards
Stefan


0 new messages