harrelfe / Hmisc

Harrell Miscellaneous
Other
208 stars 81 forks source link

caption.loc="bottom" in latex.default not working #6

Closed yacinehmito closed 5 years ago

yacinehmito commented 10 years ago

Hi,

The caption.loc="bottom" option in the latex function is not operational anymore ; it doesn't write the caption. I updated to 3.14-3 from 3.14-0 today and it made my captions disappear. For now they will stay on top of the table (not a major issue then). I didn't have the courage to jump into the code to directly look at the problem, sorry. Maybe it has already been fixed.

harrelfe commented 10 years ago

Sorry this bug was introduced in the last release. It is fixed for the next release.

paultrowbridge commented 9 years ago

Hi- I just installed Hmisc from github using devtools and this issue is still present in current github code. Sorry to be a pain, but this is important for an application. Is there any chance you can provide some type of a patch for the meantime until the next release?

harrelfe commented 9 years ago

Please provide a tiny example that fails, and describe what fails.

paultrowbridge commented 9 years ago

data(anscombe) a4t <- rbind(anscombe,round(apply(anscombe,2,mean),2),round(apply(anscombe,2,sd),2))

latex table: the R code executes fine, and produces file tables/a4table.tex:

w <- latex(a4t,file="tables/a4table.tex",title="",label="tab:a4dat",rowlabel="",ctable=TRUE,caption="Anscombe's Quartet with mean and standard deviation",caption.loc="bottom",where="!htbp",rgroup=c("Data","Summary"),n.rgroup=c(11,2),rowname=c("","","","","","","","","","","","mean","sd"),cgroup=c("Pair 1","Pair 2","Pair 3","Pair 4"),n.cgroup=c(2,2,2,2))

The failure comes from attempting to latex the output, latex crashes with the following error: ERROR: Package xkeyval Error: botcapcaption' undefined in familiesctbl'.

This is the (abbreviated) file hmisc::latex() produces: \ctable[botcapcaption={Anscombe's Quartet with mean and standard deviation},label=tab:a4dat,pos=!htbp,]{lrrcrrcrrcrr}{}{\FL

When I manually edit the file include a comma between "botcap" and "caption" as per ctable documentation, so that the resulting file looks like:

\ctable[botcap,caption={Anscombe's Quartet with mean and standard deviation},label=tab:a4dat,pos=!htbp,]{lrrcrrcrrcrr}{}{\FL

Then the document compiles fine with latex and produces exact desired output.

harrelfe commented 9 years ago

I just committed the fix to Github.