[-- Attachment #1: Type: text/plain, Size: 1222 bytes --] Hi I am looking for convenient method to generate a weekly calendar in table form that looks like #+begin_src | Hours | Mon | Tue | Wed | Thu | Fri | | 8:00-9:00 | | | | | | | 9:00-10:00 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 19:00-20:00 | | | | | | #+end_src But, of course the missing hours should be inserted automatically. A poor man's solution would be to do it manually and to save the table as a template, but is there a way to generate it using org's table functionality? Thanks and regards Uwe Brauer -- I strongly condemn Putin's war of aggression against the Ukraine. I support to deliver weapons to Ukraine's military. I support the ban of Russia from SWIFT. I support the EU membership of the Ukraine. [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
Something to play with: | start | duration | end | notes | |-------+----------+-------+-------| | 08:00 | 1:00 | 09:00 | | | 09:00 | 01:00 | 10:00 | | | 10:00 | 01:00 | 11:00 | | | 11:00 | 01:00 | 12:00 | | | 12:00 | 01:00 | 13:00 | | | 13:00 | 01:00 | 14:00 | | | 14:00 | 01:00 | 15:00 | | | 15:00 | 01:00 | 16:00 | | | 16:00 | 01:00 | 17:00 | | | 17:00 | 01:00 | 18:00 | | | 18:00 | 01:00 | 19:00 | | | 19:00 | 01:00 | 20:00 | | | 20:00 | 01:00 | 21:00 | | #+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U -- : Eric S Fraga, with org release_9.5.3-397-g81289b in Emacs 29.0.50
[-- Attachment #1: Type: text/plain, Size: 1955 bytes --] >>> "ESF" == Eric S Fraga <e.fraga@ucl.ac.uk> writes: > Something to play with: > | start | duration | end | notes | > |-------+----------+-------+-------| > | 08:00 | 1:00 | 09:00 | | > | 09:00 | 01:00 | 10:00 | | > | 10:00 | 01:00 | 11:00 | | > | 11:00 | 01:00 | 12:00 | | > | 12:00 | 01:00 | 13:00 | | > | 13:00 | 01:00 | 14:00 | | > | 14:00 | 01:00 | 15:00 | | > | 15:00 | 01:00 | 16:00 | | > | 16:00 | 01:00 | 17:00 | | > | 17:00 | 01:00 | 18:00 | | > | 18:00 | 01:00 | 19:00 | | > | 19:00 | 01:00 | 20:00 | | > | 20:00 | 01:00 | 21:00 | | > #+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U Thanks very much let me see whether I understand its logic I tried | start | duration | end | notes | |-------+----------+-------+-------| | 08:00 | 1:00 | 09:00 | | #+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U I put the cursor say on the word «start» And then fire up C-c C-c, nothing happens. I fire up C-u C-u C-c C-c and it complains because the expression points outside the table | start | duration | end | notes | |-------+----------+-------+-------| | 08:00 | 1:00 | 09:00 | | | | | | | #+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U Now C-u C-u C-c C-c gives | start | duration | end | notes | |-------+----------+-------+-------| | 08:00 | 1:00 | 09:00 | | | 09:00 | 01:00 | 10:00 | | #+TBLFM: @<<<$2..@>$2=@-1;U::@<<<$1..@>$1=@-1+@-1$+1;U::$3=$1+$2;U Very very nice, so I can proceed like this. Thanks a lot! Uwe -- I strongly condemn Putin's war of aggression against the Ukraine. I support to deliver weapons to Ukraine's military. I support the ban of Russia from SWIFT. I support the EU membership of the Ukraine. [-- Attachment #2: smime.p7s --] [-- Type: application/pkcs7-signature, Size: 5673 bytes --]
Uwe Brauer <oub@mat.ucm.es> writes:
> I am looking for convenient method to generate a weekly calendar in
> table form that looks like
>
> #+begin_src
>
> | Hours | Mon | Tue | Wed | Thu | Fri |
> | 8:00-9:00 | | | | | |
> | 9:00-10:00 | | | | | |
> | | | | | | |
> | | | | | | |
> | | | | | | |
> | | | | | | |
> | | | | | | |
> | | | | | | |
> | | | | | | |
> | | | | | | |
> | | | | | | |
> | 19:00-20:00 | | | | | |
> #+end_src
>
> But, of course the missing hours should be inserted automatically.
>
> A poor man's solution would be to do it manually and to save the table
> as a template, but is there a way to generate it using org's table
> functionality?
Eric gave you a way that you asked (using Org table functionality), but
another way could be to simply use a bunch of insert statements. Or
rather, 1-2 to insert the header, followed by a loop with a starting
time, interval, etc.
Two advantages to that approach:
1. You could specify start, end time and resolution (spacing) as
arguments (might not be needed).
2. You would not need a 'duration' column.
3. No need for formula (which leaves more room for your own, should you
need it).
Just another way to do the same thing.
Cheers,
TRS-80