Hans Meine | 4 Jan 10:38
Picon

Calendar utility function: Improvement request

Hi,

I just tried to typeset a calendar.  AFAICS, the calendar libary would be even 
10 times better if \pgfcalendardatetojulian would not only accept a fixed 
offset behind the '+', but a weekday-dependent offset.

For example, I could specify to render a calendar sheet not starting with the 
first of the month, but with a complete line showing some days from the month 
before, if it was possible to say e.g. 2009-01-01<{Monday} (meaning it should 
go back to the previous monday.

The same feature could be used to specify holidays, e.g. 2009-24-12<{Sunday} 
to mean the fourth advent Sunday (in Germany, if that matters).

Also, a repeating appointment that happens on every second tuesday of each 
month could be specified e.g. using 2009-04-01>2{Tuesday}.

The syntax would be open for discussion, I just noticed that the above would 
be quite readable, but maybe you find something better.

Have a nice day,
  Hans
------------------------------------------------------------------------------
_______________________________________________
pgf-users mailing list
pgf-users <at> lists.sourceforge.net
(Continue reading)

Hans Meine | 31 Jan 21:52
Picon

Re: Calendar utility function: Improvement request

Hi again!

On Sonntag 04 Januar 2009, Hans Meine wrote:
> I just tried to typeset a calendar.  AFAICS, the calendar libary would be
> even 10 times better if \pgfcalendardatetojulian would not only accept a
> fixed offset behind the '+', but a weekday-dependent offset.

In addition, I now have some more feature requests:

1) Is it maybe already possible to modify the calendar range through a style? 
I'd like to round \pgfcalendarbeginjulian and \pgfcalendarendjulian such that 
I get only complete weeks, i.e. a little more than one month.  Right now I 
have to do that before the \calendar:

\newcount\monthsheetdate
\newcount\monthsheetweekday

\pgfcalendardatetojulian{2009-02-01}{\monthsheetdate}
\pgfcalendarjuliantoweekday{\the\monthsheetdate}{\monthsheetweekday}
\advance\monthsheetdate by -\the\monthsheetweekday
\pgfcalendarjuliantodate{\the\monthsheetdate}{\myyear}{\mymonth}{\myday}
\edef\monthsheetbegin{\myyear-\mymonth-\myday}

\pgfcalendardatetojulian{2009-02-last}{\monthsheetdate}
\pgfcalendarjuliantoweekday{\the\monthsheetdate}{\monthsheetweekday}
\advance\monthsheetdate by -\the\monthsheetweekday
\advance\monthsheetdate by 6
\pgfcalendarjuliantodate{\the\monthsheetdate}{\myyear}{\mymonth}{\myday}
\edef\monthsheetend{\myyear-\mymonth-\myday}

(Continue reading)

Hans Meine | 6 Feb 18:59
Picon

Re: Calendar utility function: Improvement request

On Saturday 31 January 2009 21:52:59 Hans Meine wrote:
> 2) I'd like to render the number of each week (i.e. in order to be able to
> differentiate between "even and odd weeks"), but there's no
> \pgfcalendarcurrentweek.  Could this be added?

I now implemented this myself! :-)  Thanks to the other macros I found in 
pgfcalendar.code.tex, I could teach myself how to implement the computation 
(after doing some research on how the week number is usually defined).

Attached you find a patch that adds \pgfcalendarjuliantoweek which computes a 
week number according to ISO 8601 (i.e. week 1 is the week of the year's first 
thursday).  Also, it adds \pgfcalendarcurrentweek as a "frontend" macro for 
easy typesetting.  Next I plan to add ifdate-conditionals like "even week" or 
"odd week", which should be easy.

It would also be cool to have a function that computes the easter date, in 
order to mark holidays in your calendar.

Q1: I have now used \counter1-\counter4 since that fits well with the numbered 
formulas, and \pgfutil <at> tempcnta for (very) temporary purposes.  Is that 
reasonable?
Q2: Do I really need all the \relax'es?  (I do not know much about their 
purpose, and nothing in this context.)
Q3: The nested scope is to get local counters, right?

Have a nice day,
  Hans

(Continue reading)

Hans Meine | 3 Aug 09:43
Picon

Re: Calendar utility function: Improvement request

Hi again!

On Friday 06 February 2009 18:59:16 Hans Meine wrote:
> On Saturday 31 January 2009 21:52:59 Hans Meine wrote:
> > 2) I'd like to render the number of each week (i.e. in order to be able
> > to differentiate between "even and odd weeks"), but there's no
> > \pgfcalendarcurrentweek.  Could this be added?
>
> I now implemented this myself! :-)  Thanks to the other macros I found in
> pgfcalendar.code.tex, I could teach myself how to implement the computation
> (after doing some research on how the week number is usually defined).
>
> Attached you find a patch that adds \pgfcalendarjuliantoweek which computes
> a week number according to ISO 8601 (i.e. week 1 is the week of the year's
> first thursday).  Also, it adds \pgfcalendarcurrentweek as a "frontend"
> macro for easy typesetting.

I forgot to ask about inclusion in PGF.  AFAIK, my implementation should fit 
well into the current codebase.

My posting in Feb. contained the following (unanswered) questions though:
> Q1: I have now used \counter1-\counter4 since that fits well with the
> numbered formulas, and \pgfutil <at> tempcnta for (very) temporary purposes.  Is
> that reasonable?
> Q2: Do I really need all the \relax'es?  (I do not know much about their
> purpose, and nothing in this context.)
> Q3: The nested scope is to get local counters, right?

Also, I suggested further features:
> Next I plan to add ifdate-conditionals like
(Continue reading)


Gmane