emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Printable calendar?
@ 2014-05-30 14:20 Peter Davis
  2014-05-30 15:23 ` Peter Davis
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Davis @ 2014-05-30 14:20 UTC (permalink / raw)
  To: emacs-orgmode

I'm trying to make a printable calendar of my bike commuting trips during the month of May. I don't need any fancy calendar functions, so I figured a simple table would do it. I
created the ord file whose contents are below, but when I export to HTML, there are some quirks ...

 1) Some of the dates are right aligned within the cells, and others left.
 2) I'd like to have full borders on the table

Also, is there a better way to do this? I know emacs has calendar tools, and org has diary and agenda tools, but they seemed like overkill for trying to get a simple calendar page
printed. 

Thanks,
-pd


---- cut here ----
#+STARTUP: showeverything logdone
#+options: num:nil toc:nil
#+author: Peter Davis
#+title: Every Day in May 2014

|      Sun | Mon     | Tue     | Wed     | Thu     | Fri     | Sat      |
|----------+---------+---------+---------+---------+---------+----------|
|          |         |         |         | 1       | 2       | 3        |
|          |         |         |         |         |         |          |
|          |         |         |         | AM: 3.6 | AM: 3.6 | AM: 7.6  |
|          |         |         |         | PM: 3.7 | PM: 3.7 | AM: 7.6  |
|----------+---------+---------+---------+---------+---------+----------|
|        4 | 5       | 6       | 7       | 8       | 9       | 10       |
|          |         |         |         |         |         |          |
| AM: 11.4 | AM: 3.7 | AM: 3.7 | AM: 5.1 | AM: 3.6 | AM: 3.3 | AM: 5.1  |
|          | PM: 3.3 | PM: 3.3 |         | PM: 3.3 | PM: 3.3 |          |
|----------+---------+---------+---------+---------+---------+----------|
|       11 | 12      | 13      | 14      | 15      | 16      | 17       |
|          |         |         | *BIKE*  |         |         | AM: 7.6  |
|          | AM: 3.7 | AM: 3.7 | AM: 9.2 | AM: 3.7 | AM: 3.7 | M: 6.1   |
|          | PM: 3.3 | PM: 3.3 | PM: 9.7 | PM: 3.3 | PM: 3.3 | PM: 13.3 |
|----------+---------+---------+---------+---------+---------+----------|
|       18 | 19      | 20      | 21      | 22      | 23      | 24       |
|          |         |         |         |         |         |          |
|          | AM: 3.7 | AM: 3.6 | AM: 3.7 | AM: 3.7 | AM: 7.0 | AM: 5.5  |
|          | PM: 3.2 | PM: 3.3 | PM: 3.3 | PM: 3.3 |         |          |
|----------+---------+---------+---------+---------+---------+----------|
|       25 | 26      | 27      | 28      | 29      | 30      | 30       |
|   *BIKE* |         |         | *TRIKE* |         |         |          |
| AM: 16.2 |         | AM: 3.6 |         | AM: 3.8 | AM: 3.6 |          |
|          | PM: 5.1 | PM: 3.3 | PM: 7.3 | PM: 3.3 |         |          |
|----------+---------+---------+---------+---------+---------+----------|
---- cut here ----



-- 
----
Peter Davis
The Tech Curmudgeon
www.techcurmudgeon.com

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

* Re: Printable calendar?
  2014-05-30 14:20 Printable calendar? Peter Davis
@ 2014-05-30 15:23 ` Peter Davis
  2014-05-30 17:20   ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Davis @ 2014-05-30 15:23 UTC (permalink / raw)
  To: emacs-orgmode

Ok, I was able to get the column rules I want. (See below)

I'm still puzzled by the right/left alignment. In the org buffer the columns appear correctly aligned, but in HTML output, the left (Sun) and right (Sat) columns are right-aligned,
while all the others are left-aligned.

Clues?

Thanks,
-pd


---- cut here ----
#+ATTR_HTML: :border 2 :frame border
| Sun      | Mon     | Tue     | Wed     | Thu     | Fri     | Sat      |
|----------+---------+---------+---------+---------+---------+----------|
| /        | <>      | <>      | <>      | <>      | <>      | <>       |
|          |         |         |         | 1       | 2       | 3        |
|          |         |         |         |         |         |          |
|          |         |         |         | AM: 3.6 | AM: 3.6 | AM: 7.6  |
|          |         |         |         | PM: 3.7 | PM: 3.7 | AM: 7.6  |
|----------+---------+---------+---------+---------+---------+----------|
| 4        | 5       | 6       | 7       | 8       | 9       | 10       |
|          |         |         |         |         |         |          |
| AM: 11.4 | AM: 3.7 | AM: 3.7 | AM: 5.1 | AM: 3.6 | AM: 3.3 | AM: 5.1  |
|          | PM: 3.3 | PM: 3.3 |         | PM: 3.3 | PM: 3.3 |          |
|----------+---------+---------+---------+---------+---------+----------|
| 11       | 12      | 13      | 14      | 15      | 16      | 17       |
|          |         |         | *BIKE*  |         |         | AM: 7.6  |
|          | AM: 3.7 | AM: 3.7 | AM: 9.2 | AM: 3.7 | AM: 3.7 | M: 6.1   |
|          | PM: 3.3 | PM: 3.3 | PM: 9.7 | PM: 3.3 | PM: 3.3 | PM: 13.3 |
|----------+---------+---------+---------+---------+---------+----------|
| 18       | 19      | 20      | 21      | 22      | 23      | 24       |
|          |         |         |         |         |         |          |
|          | AM: 3.7 | AM: 3.6 | AM: 3.7 | AM: 3.7 | AM: 7.0 | AM: 5.5  |
|          | PM: 3.2 | PM: 3.3 | PM: 3.3 | PM: 3.3 |         |          |
|----------+---------+---------+---------+---------+---------+----------|
| 25       | 26      | 27      | 28      | 29      | 30      | 30       |
| *BIKE*   |         |         | *TRIKE* |         |         |          |
| AM: 16.2 |         | AM: 3.6 |         | AM: 3.8 | AM: 3.6 |          |
|          | PM: 5.1 | PM: 3.3 | PM: 7.3 | PM: 3.3 |         |          |
|----------+---------+---------+---------+---------+---------+----------|
---- cut here ----


-- 
----
Peter Davis
The Tech Curmudgeon
www.techcurmudgeon.com

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

* Re: Printable calendar?
  2014-05-30 15:23 ` Peter Davis
@ 2014-05-30 17:20   ` Nick Dokos
  2014-05-31 12:32     ` Peter Davis
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2014-05-30 17:20 UTC (permalink / raw)
  To: emacs-orgmode

Peter Davis <pfd@pfdstudio.com> writes:

> Ok, I was able to get the column rules I want. (See below)
>
> I'm still puzzled by the right/left alignment. In the org buffer the
> columns appear correctly aligned, but in HTML output, the left (Sun)
> and right (Sat) columns are right-aligned,
> while all the others are left-aligned.
>
> Clues?
>

You can force the misbehaving columns to behave - more or less: the M
value on the 17th will cause problems (btw, I prefer
to have a non-exported "zeroth" column for things like / and !
that are basically table metadata - see (info "(org) Advanced features")
for details):


--8<---------------cut here---------------start------------->8---
#+ATTR_HTML: :border 2 :frame border
|   | Sun      | Mon     | Tue     | Wed     | Thu     | Fri     | Sat      |
|---+----------+---------+---------+---------+---------+---------+----------|
| / | <l>      | <>      | <>      | <>      | <>      | <>      | <l>      |
|---+----------+---------+---------+---------+---------+---------+----------|
|   |          |         |         |         | 1       | 2       | 3        |
|   |          |         |         |         |         |         |          |
|   |          |         |         |         | AM: 3.6 | AM: 3.6 | AM: 7.6  |
|   |          |         |         |         | PM: 3.7 | PM: 3.7 | AM: 7.6  |
|---+----------+---------+---------+---------+---------+---------+----------|
|   | 4        | 5       | 6       | 7       | 8       | 9       | 10       |
|   |          |         |         |         |         |         |          |
|   | AM: 11.4 | AM: 3.7 | AM: 3.7 | AM: 5.1 | AM: 3.6 | AM: 3.3 | AM: 5.1  |
|   |          | PM: 3.3 | PM: 3.3 |         | PM: 3.3 | PM: 3.3 |          |
|---+----------+---------+---------+---------+---------+---------+----------|
|   | 11       | 12      | 13      | 14      | 15      | 16      | 17       |
|   |          |         |         | *BIKE*  |         |         | AM: 7.6  |
|   |          | AM: 3.7 | AM: 3.7 | AM: 9.2 | AM: 3.7 | AM: 3.7 | M: 6.1   |
|   |          | PM: 3.3 | PM: 3.3 | PM: 9.7 | PM: 3.3 | PM: 3.3 | PM: 13.3 |
|---+----------+---------+---------+---------+---------+---------+----------|
|   | 18       | 19      | 20      | 21      | 22      | 23      | 24       |
|   |          |         |         |         |         |         |          |
|   |          | AM: 3.7 | AM: 3.6 | AM: 3.7 | AM: 3.7 | AM: 7.0 | AM: 5.5  |
|   |          | PM: 3.2 | PM: 3.3 | PM: 3.3 | PM: 3.3 |         |          |
|---+----------+---------+---------+---------+---------+---------+----------|
|   | 25       | 26      | 27      | 28      | 29      | 30      | 30       |
|   | *BIKE*   |         |         | *TRIKE* |         |         |          |
|   | AM: 16.2 |         | AM: 3.6 |         | AM: 3.8 | AM: 3.6 |          |
|   |          | PM: 5.1 | PM: 3.3 | PM: 7.3 | PM: 3.3 |         |          |
|---+----------+---------+---------+---------+---------+---------+----------|
--8<---------------cut here---------------end--------------->8---

The misbehaviour is caused by the heuristic used in
org-export-table-cell-alignment:

,----
| Return alignment as specified by the last alignment cookie in the
| same column as TABLE-CELL.  If no such cookie is found, a default
| alignment value will be deduced from fraction of numbers in the
| column (see `org-table-number-fraction' for more information).
`----

You can play around with org-table-number-fraction (default: 0.5) to
change the behaviour. A value of 0.25 will right-align them all, whereas
a value of 0.75 will left-align them all. But I wouldn't want to bet my
life on that: it depends on the contents of the table so it seems like a
fragile solution at best.

BTW, the 0.25 and 0.75 values above are purely trial-and-error (actually
derived from the smallest ratio I found edebugging over the columns:
6/21).

Nick

Footnotes:

[fn:1] The heuristic counts empty cells as numbers if the non-empty row
       above it is a number, so for the first column for example, there
       are 21 cells and 11 of them are "numbers".
       

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

* Re: Printable calendar?
  2014-05-30 17:20   ` Nick Dokos
@ 2014-05-31 12:32     ` Peter Davis
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Davis @ 2014-05-31 12:32 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

On Fri, May 30, 2014 at 01:20:21PM -0400, Nick Dokos wrote:
> Peter Davis <pfd@pfdstudio.com> writes:
> 
> > Ok, I was able to get the column rules I want. (See below)
> >
> > I'm still puzzled by the right/left alignment. In the org buffer the
> > columns appear correctly aligned, but in HTML output, the left (Sun)
> > and right (Sat) columns are right-aligned,
> > while all the others are left-aligned.
> >
> > Clues?
> >
> 
> You can force the misbehaving columns to behave - more or less: the M
> value on the 17th will cause problems (btw, I prefer
> to have a non-exported "zeroth" column for things like / and !
> that are basically table metadata - see (info "(org) Advanced features")
> for details):
> 

Thanks, Nick. That worked beautifully (once I noticed that May has 31 days instead of 30 twice.)

> The misbehaviour is caused by the heuristic used in
> org-export-table-cell-alignment:
> 
> ,----
> | Return alignment as specified by the last alignment cookie in the
> | same column as TABLE-CELL.  If no such cookie is found, a default
> | alignment value will be deduced from fraction of numbers in the
> | column (see `org-table-number-fraction' for more information).
> `----
> 
> You can play around with org-table-number-fraction (default: 0.5) to
> change the behaviour. A value of 0.25 will right-align them all, whereas
> a value of 0.75 will left-align them all. But I wouldn't want to bet my
> life on that: it depends on the contents of the table so it seems like a
> fragile solution at best.
> 
> BTW, the 0.25 and 0.75 values above are purely trial-and-error (actually
> derived from the smallest ratio I found edebugging over the columns:
> 6/21).
> 
> Nick
> 
> Footnotes:
> 
> [fn:1] The heuristic counts empty cells as numbers if the non-empty row
>        above it is a number, so for the first column for example, there
>        are 21 cells and 11 of them are "numbers".
>        

Interesting, but it sounds to me like org is trying to be too smart for its own good here, making inferences based on the contents of the
cells. I'll stick with the '<l>' notation, which seems more reliable.

Thank you!

-pd


-- 
----
Peter Davis
The Tech Curmudgeon
www.techcurmudgeon.com

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

end of thread, other threads:[~2014-05-31 12:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-30 14:20 Printable calendar? Peter Davis
2014-05-30 15:23 ` Peter Davis
2014-05-30 17:20   ` Nick Dokos
2014-05-31 12:32     ` Peter Davis

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).