nutterb / pixiedust

Tables So Beautifully Fine-Tuned You Will Believe It's Magic.
180 stars 18 forks source link

Table captions? #22

Closed renlund closed 8 years ago

renlund commented 9 years ago

Have you considered having a sprinkle for adding captions to the tables?

nutterb commented 9 years ago

I have put some thought into it, but haven't decided what to do about it yet. With a fairly simple hook, captions can be added to HTML and LaTeX tables with knitr already. Unfortunately, that hook wouldn't apply to console output. The other advantage to the hook is that it would keep track of table numbers, whereas if I wrote something from the ground up, I'd eventually get roped into writing something to track the table numbers. From past experience, that's not something I'm keen to do again.

All that said, how strongly do you feel about the following:

  1. The need to have captions apply to console output?
  2. Having tables numbered automatically?
  3. Developing a captioning system that works independently of knitr?
renlund commented 9 years ago

Yes, I can see that there might be some complications here. Probably I haven't examined knitr hook options for captions enough to have a feeling for a "right" way to go here. At the moment I'm using your package for rmarkdown, and one way to add the caption is easy enough:

t <- print(dust(object) + ... <sprinkles> ... + sprinkle_print_method("markdown"))
cat(t, "\n\n Table: My caption.")

But of course in the end I want a system for numbering all tables generated (independent of the generating package) and a way to reference them (in "pure" rmarkdown).

Regarding your questions:

  1. No need for captions to console output.
  2. I guess that would be tricky, as a document might have tables generated from other packages.
  3. Personally, my work is already so entangled with knitr that it would be pointless to have an independent system.
nutterb commented 8 years ago

Added in v 6.0.1, currently in the new-latex-tables branch.