You should not print booktabs() in a chunk with results='asis', because that will generate invalid LaTeX code in the output. You can use invisible(booktabs()) or foo <- booktabs() to avoid printing.
Or request Duncan (the package author) to return invisible(save) in booktabs(). Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Mon, Jun 3, 2013 at 1:38 PM, John Kane <jrkrid...@yahoo.ca> wrote: > > > ________________________________ > From: Yihui Xie <x...@yihui.name> > To: John Kane <jrkrid...@yahoo.ca> > Cc: Lyx List <lyx-users@lists.lyx.org> > Sent: Monday, June 3, 2013 4:17:18 PM > Subject: Re: Problem using R's table package with knitr. > > Did you \usepackage{booktabs} in the preamble? That is what > ?tables::booktabs says. > > Yes , I tried it both with and without \usepackage{booktabs} > > I realise I did not attach my example file. > > Hopefully there is one now. > > Thanks > > Regards, > Yihui > -- > Yihui Xie <xieyi...@gmail.com> > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA > > > On Mon, Jun 3, 2013 at 3:07 PM, John Kane <jrkrid...@yahoo.ca> wrote: >> I was having a look at the tables package in R and tried to run an example >> in LyX. It works fine until I try using the suggestion to use the >> booktabs() >> command in the knitr statement. >> The code works fine in R. >> >> I assume that I am in conflict with another latex package in LyX? Any >> workarounds? >> >> It's not a serious problem as I don't actually need to use the tables >> package; I was just playing around with tables trying to understand the >> syntax and decided to try it in LyX. > >