[R] Hmisc-xtable label (Solved)
Felipe Carrillo
mazatlanmexico at yahoo.com
Sat Jan 10 23:09:05 CET 2009
As soon as I sent the e-mail I found a solution to the hyperlink problem.
I removed the squared brackets and the number 1 from the line below. I don't know why I had the number there in the first place.
\pdfbookmark[1]{Contents}{table}
--- On Sat, 1/10/09, Felipe Carrillo <mazatlanmexico at yahoo.com> wrote:
> From: Felipe Carrillo <mazatlanmexico at yahoo.com>
> Subject: [R] Hmisc-xtable label
> To: r-help at stat.math.ethz.ch
> Date: Saturday, January 10, 2009, 1:36 PM
> Dear all:
> Does anybody know about label conflicts between xtable and
> Hmisc? I found a couple of e-mails similar to this problem
> but is not clear to me how to get around the label problem.
> The first table(longtable below) is generated with the
> latex function from Hmisc but for some reason when I try to
> hyperlink to it,it takes me to the top of the document. The
> second table created with the xtable package(bottom of
> document)hyperlinks OK, but if I would create the bottom
> table first using xtable and then create the longtable using
> Hmisc then the hyperlink works OK on the longtable but not
> on the other one. Thanks
> I'am using Sweave and Miktex, windows XP,R-2.8.1 to
> generate the document below:
>
>
>
> \documentclass[11pt]{article}
>
> \usepackage{amsmath}
> \usepackage{floatflt,graphicx,times}
> \usepackage[usenames,dvipsnames]{color}
> \usepackage{longtable,pdflscape}
> \usepackage{rotating}
> \usepackage{verbatim}
> \usepackage[ps2pdf,
> bookmarks=true,
> bookmarksnumbered=false,
> bookmarksopen=false,
> colorlinks=true,
> linkcolor=webblue]{hyperref}
>
> \definecolor{webgreen}{rgb}{0, 0.5, 0} % less intense
> green
> \definecolor{webblue}{rgb}{0, 0, 0.5} % less intense
> blue
> \definecolor{webred}{rgb}{0.5, 0, 0} % less intense red
>
> \usepackage[all]{hypcap}
> \pdfbookmark[1]{Contents}{table}
> \title{BROOD-YEAR 2007 WINTER CHINOOK JUVENILE
> PRODUCTION}
> \author{Felipe D. Carrillo}
> \date{January 5, 2009}
> \pagestyle{headings}
> \parskip 7.2pt
> \begin{document}
> \setkeys{Gin}{width=1.1\textwidth}
> \maketitle
>
> \tableofcontents
> The hyperlink of table 1 doesn't work!!!! but the
> hyperlink of table 2 works OK
> \newpage
> \listoftables
> \listoffigures
> \section{Introduction}
> \label{sec:introduction}
> Winter-run Chinook salmon is one of four distinct
> "runs" of Chinook salmon (Oncorhynchus
> tshawytscha)....
> \section{Study Area}
> The Sacramento River is the largest river system in
> California, flowing south through 600 kilometers (km)...
> \section{Methods}
> \subsection{Sampling gear}
> Sampling was conducted along a transect using four 2.4 m
> diameter rotary-screw traps.........
> \subsection{Sampling regimes}
> In general, rotary traps sampled continuously throughout
> 24-hour periods and were serviced once daily.
> \subsection{Data collection}
> All fish captured were anesthetized, identified to
> species......
>
> The first table(longtable below) is generated with the
> latex function from Hmisc but for some reason when I try to
> hyperlink to it
> takes me to the top of the document. The second table
> created with the xtable package(bottom of
> document)hyperlinks OK, but
> If I would create the bottom table first using xtable and
> then create the longtable using Hmisc then the hyperlink
> works OK on the
> longtable but not on the other one. Does anybody know
> about conflicts between these two packages? I found a couple
> of e-mails similar to
> this problem but is not clear to me how to get around the
> label problem. Thanks
> \newpage
> <<tab.R,echo=FALSE,results=tex>>=
> library(Hmisc)
> x <- matrix(rnorm(1000), ncol = 10)
> x.big <- data.frame(x)
> latex(x.big,"",label="tab:nice",file="",longtable=TRUE,
> dec=2,landscape=TRUE,
> caption='longtable generated with Hmisc.')
> @
>
> \section{Results}
> \subsection{Sampling effort}
> Weekly sampling effort throughout the 2006 brood-year
> emigration period was highly variable and ranged
> from 0.21 to 1.00 (0 = 0.74, N = 52 weeks; Table 1).
> Weekly sampling effort ranged from 0.21 to 1.00 (0 = 0.73, N
> = 26 weeks)
> between July and December, the period of greatest juvenile
> winter Chinook emigration, and 0.21 to 1.00 (0 = 0.75, N =
> 26 weeks)
> during the latter half of the emigration period (Table
> 1).\\
> \subsection{Trap efficiency trials}
> Eight mark-recapture trials were conducted using naturally
> produced fall run fry sized Chinook
>
> <<tab.RR,echo=F,results=tex>>=
> library(xtable)
> x <- matrix(rnorm(100), ncol = 10)
> ci.table <- data.frame(x)
> ci.table <-
> xtable(x,label='tab:mytable',align="ccccccccccc",caption='Table
> created with xtable',digits=0)
> print(ci.table,tabular.environment='longtable',include.rownames=FALSE,floating=FALSE)
> @
> \end{document}
>
>
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
More information about the R-help
mailing list