ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Datenumber
@ 2007-11-27 16:49 Bart Wise
  2007-11-28  4:29 ` Datenumber Aditya Mahajan
       [not found] ` <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Bart Wise @ 2007-11-27 16:49 UTC (permalink / raw)
  To: ntg-context

LaTeX has a package called datenumber.  It basically allows you to several 
things: 1) convert a date into a number, 2) add and subtract from that 
number, in essence adding and subtracting days, and 3) converting a date 
number into a date string.  I use this package to create a yearly lesson 
schedule and various other similiar things.  However, I have spent a 
considerable amount of time trying to find the same functionality in ConTeXt 
with no avail.  Is there a solution for this?
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Datenumber
  2007-11-27 16:49 Datenumber Bart Wise
@ 2007-11-28  4:29 ` Aditya Mahajan
  2007-11-28 16:34   ` Datenumber Bart C. Wise
  2007-11-28 16:54   ` Datenumber Bart Wise
       [not found] ` <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com>
  1 sibling, 2 replies; 5+ messages in thread
From: Aditya Mahajan @ 2007-11-28  4:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Tue, 27 Nov 2007, Bart Wise wrote:

> LaTeX has a package called datenumber.  It basically allows you to several
> things: 1) convert a date into a number, 2) add and subtract from that
> number, in essence adding and subtracting days, and 3) converting a date
> number into a date string.  I use this package to create a yearly lesson
> schedule and various other similiar things.  However, I have spent a
> considerable amount of time trying to find the same functionality in ConTeXt
> with no avail.  Is there a solution for this?

Have you looked at a lua solution using LuaTeX?

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Datenumber
  2007-11-28  4:29 ` Datenumber Aditya Mahajan
@ 2007-11-28 16:34   ` Bart C. Wise
  2007-11-28 16:54   ` Datenumber Bart Wise
  1 sibling, 0 replies; 5+ messages in thread
From: Bart C. Wise @ 2007-11-28 16:34 UTC (permalink / raw)
  To: ntg-context

I have not looked for a LuaTeX-specific solution.  Since LuaTeX appears to be 
in beta, I feel the need to wait for it to become more stable before looking 
into a LuaTeX solution.

So, I'm still looking for a ConTeXt solution.

Bart

On Tuesday November 27 2007, Aditya Mahajan wrote:
> On Tue, 27 Nov 2007, Bart Wise wrote:
> > LaTeX has a package called datenumber.  It basically allows you to
> > several things: 1) convert a date into a number, 2) add and subtract from
> > that number, in essence adding and subtracting days, and 3) converting a
> > date number into a date string.  I use this package to create a yearly
> > lesson schedule and various other similiar things.  However, I have spent
> > a considerable amount of time trying to find the same functionality in
> > ConTeXt with no avail.  Is there a solution for this?
>
> Have you looked at a lua solution using LuaTeX?
>
> Aditya
> ___________________________________________________________________________
>________ If your question is of interest to others as well, please add an
> entry to the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context webpage  :
> http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________
>________


___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Datenumber
  2007-11-28  4:29 ` Datenumber Aditya Mahajan
  2007-11-28 16:34   ` Datenumber Bart C. Wise
@ 2007-11-28 16:54   ` Bart Wise
  1 sibling, 0 replies; 5+ messages in thread
From: Bart Wise @ 2007-11-28 16:54 UTC (permalink / raw)
  To: ntg-context

I have not looked for a LuaTeX-specific solution.  Since LuaTeX appears to be 
in beta, I feel the need to wait for it to become more stable before looking 
into a LuaTeX solution.

So, I'm still looking for a ConTeXt solution.

Bart

On Tuesday November 27 2007, Aditya Mahajan wrote:
> On Tue, 27 Nov 2007, Bart Wise wrote:
> > LaTeX has a package called datenumber.  It basically allows you to
> > several things: 1) convert a date into a number, 2) add and subtract from
> > that number, in essence adding and subtracting days, and 3) converting a
> > date number into a date string.  I use this package to create a yearly
> > lesson schedule and various other similiar things.  However, I have spent
> > a considerable amount of time trying to find the same functionality in
> > ConTeXt with no avail.  Is there a solution for this?
>
> Have you looked at a lua solution using LuaTeX?
>
> Aditya
> ___________________________________________________________________________
>________ If your question is of interest to others as well, please add an
> entry to the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context webpage  :
> http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________
>________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Datenumber
       [not found] ` <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com>
@ 2007-11-29 15:57   ` Bart Wise
  0 siblings, 0 replies; 5+ messages in thread
From: Bart Wise @ 2007-11-29 15:57 UTC (permalink / raw)
  To: Mojca Miklavec, ntg-context

On Thursday November 29 2007, Mojca Miklavec wrote:
> On Nov 27, 2007 5:49 PM, Bart Wise wrote:
> > LaTeX has a package called datenumber.  It basically allows you to
> > several things:
> >
> > 1) convert a date into a number,
>
> What number? What's the input and what's the output?

First you set the date:
\setdatenumber{year}{month}{day}
Example: \setdatenumber{2007}{1}{5}

Internally, this sets a counter called datenumber.
You print the date with \datedate.

Then, to increment by a week, you would add 7 to the datenumber and set the 
date as follows:  
\addtocounter{datenumber}{7}
\setdatebynumber{\thedatenumber}

I made a function that increments the date:
\def\IncDate{%
  \addtocounter{datenumber}{7}%
  \setdatebynumber{\thedatenumber}%
}%

Then, I created a table with the first column entries as follows:
\datedate\IncDate
\datedate\IncDate
\datedate\IncDate
\datedate\IncDate
\datedate\IncDate
...

The output would be:
Friday, 5 January, 2007
Friday, 12 January, 2007
Friday, 19 January, 2007
Friday, 26 January, 2007
Friday, 2 February, 2007

This way I do not have to put in anything except the first date and dates for 
the whole year are calculated and printed for me.

>
> > 2) add and subtract from that
> > number, in essence adding and subtracting days, and
> >
> > 3) converting a date number into a date string.
>
> The manual mentions this example
>     \date[d=17,m=11,y=2007][weekday,month,day,{, },year]
>
> or simply
>     \date[y=2007,m=11,d=27]
> or
>     \currentdate

As best as I can tell, this only sets the date.  I can see of no way to add a 
given number of days to calculate a new date.

>
> > I use this package to create a yearly lesson
> > schedule and various other similiar things.  However, I have spent a
> > considerable amount of time trying to find the same functionality in
> > ConTeXt with no avail. Is there a solution for this?
>
> There are quite some macros in tex/context/base/core-con.tex (&
> core-con.mkii) devoted to that. I didn't play with substraction yet,
> but I bet there is some simple way to do it.

I looked through the source code of core-con.mkii, core-con.mkiv and 
core-con.tex.  I don't see the functionality I need already constructed.  I 
was hoping that an existing solution existed without the need for creating 
new code.

>
> Mojca


Thanks for you help.  If I overlooked something, let me know.
Bart
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-29 15:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-27 16:49 Datenumber Bart Wise
2007-11-28  4:29 ` Datenumber Aditya Mahajan
2007-11-28 16:34   ` Datenumber Bart C. Wise
2007-11-28 16:54   ` Datenumber Bart Wise
     [not found] ` <6faad9f00711290335tebbb7e8kbddd5980b8d28add@mail.gmail.com>
2007-11-29 15:57   ` Datenumber Bart Wise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).