Thibaut Jombart wrote: > Duncan Murdoch wrote: > >>>> >>>> >>> Maybe a clue: we can use >>> cat(readLines(as.character(?plot)),sep="\n") >>> >>> to display the help (here, of plot) directly to the screen. So we could >>> use something like: >>> >>> <<echo=TRUE,print=FALSE,eval=FALSE>>= >>> ?plot >>> @ >>> >>> >>> <<echo=FALSE,print=TRUE,eval=TRUE>>= >>> cat(readLines(as.character(?plot)),sep="\n") >>> @ >>> >>> But this doesn't work (latex compilation error) as weird characters >>> appear in the produced tex, at some places (tabulations?), like: >>> >>> _T_h_e _D_e_f_a_ >>> >>> (not sure what it will look like in this email, but emacs reads things >>> like _^HT_^HH_^He...). >>> >>> Maybe an encoding problem? I tried specifying different encoding to >>> readLines, with no luck (latin1, UTF-8). Otherwise, the help appears >>> in the .tex. >>> >> Those are backspaces: it's trying to underline the title. You'd get >> a better display if you read the latex version instead. I think you >> need to construct the path to it yourself (using system.file() etc.) >> >> Duncan Murdoch >> >> >> >> > Thanks for the hint ! > So, the code below roughly works: > > ####### > \documentclass{article} > \usepackage{verbatim} > \begin{document} > <<echo=TRUE,print=FALSE,eval=FALSE>>= > ?plot > @ > > > <<echo=FALSE,print=FALSE,results=tex>>= > path <- sub("help","latex",as.character(?plot)) > path <- paste(path,'tex',sep=".") > cat(readLines(path),sep="\n") > @ > > \end{document} > ####### > > The document compiles with pdflatex but still complains about a bunch of > unknown latex instructions (like \HeaderA, used at the begining of the > included (plot.tex) tex file. The resulting pdf indeed looks a bit nasty. > > What command shall we include in the header to have it work? >
The refman.tex file starts like this: \documentclass[a4paper]{book} \usepackage[times,hyper]{Rd} \usepackage[latin1]{inputenc} \usepackage{makeidx} Those packages should do it. (Rd.sty is in R_HOME/share/texmf). Duncan Murdoch ______________________________________________ R-help@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.