ztable icon indicating copy to clipboard operation
ztable copied to clipboard

LaTeX references & caption line wrapping

Open cpsievert opened this issue 10 years ago • 3 comments

I really like the motivation of this package, but I noticed a couple issues that might prevent me from using it. Consider this minimal example (see here for source). Is there a way to get the caption to wrap according to the table width? Also, the LaTeX reference link is there (it's really hard to see), but the numbering doesn't appear (any idea how to make it appear?).

I also think it's better practice to avoid the assumption that users will have the appropriate preamble/definitions to support the default options (that is, I think booktabs & zebra should be FALSE by default).

cpsievert avatar Dec 18 '14 17:12 cpsievert

Dear Carson,

Thank you for your e-mail. All you comments are correct. Because function ztable() don’t use latex caption. It takes character strings in caption parameter and make a multicolumn row before the colnames row. I chose this method to solve the the font size mismatchs between the caption and the table, but when caption length is long, it resulted in problem as your comments.

There are at least three solutions. But all solutions have limitation. One promising solution is to use ‘minipage’ in caption as follows.

require(ztable)
ztable(head(mtcars[1:5]), caption = "\\begin{minipage}[c]{0.5\\linewidth}
Some really ridiculously long caption text that doesn't make any sense but is here just to demonstrate line wrapping doesn't work in the caption
\\end{minipage}", label = "tbl:example", zebra = FALSE)

The result of this command is as follows.

Another possible solution is to use ‘pbox’ and the 3rd solution is to use ‘tabulary’ package. But all possible solutions requires table width to specified.

Do you mind if you should put table width as a parameter ? Fro example..

ztable(head(iris),caption=“Some really ridiculously long caption text that doesn't make any sense but is here just to demonstrate line wrapping doesn't work in the caption”,tablewidth=0.5)

How about that?

My solution for caption size and position mismatching has inborn limitations as a collateral damage.

And I have changed default values as your suggestions. During a couple of days, I am trying to vertical striping.

After then, I will try to solve the problem.

Keep in touch !!

Sincerely,

KW Moon, MD,PhD

    1. 19., 오전 2:54, Carson [email protected] 작성:

I really like the motivation of this package, but I noticed a couple issues that might prevent me from using it. Consider this minimal example https://github.com/cpsievert/cpsievert.github.com/blob/master/stack/ztable/index.pdf?raw=true (see here https://github.com/cpsievert/cpsievert.github.com/tree/master/stack/ztable for source). Is there a way to get the caption to wrap according to the table width? Also, the LaTeX reference link is there (it's really hard to see), but the numbering doesn't appear (any idea how to make it appear?).

I also think it's better practice to avoid the assumption that users will have the appropriate preamble/definitions to support the default options (that is, I think booktabs & zebra should be FALSE by default).

— Reply to this email directly or view it on GitHub https://github.com/cardiomoon/ztable/issues/1.

cardiomoon avatar Dec 19 '14 02:12 cardiomoon

I like your last solution best (how would tablewidth be different from wraptablewidth?)

cpsievert avatar Dec 19 '14 17:12 cpsievert

The referencing will work if you use the \caption instead of \multicolumn for the caption. Is it possible to have it updated?

artidataio avatar Mar 14 '17 20:03 artidataio