[R] LaTeX references inside R code using SweaveListingUtils

Frank E Harrell Jr f.harrell at vanderbilt.edu
Thu Jun 25 20:53:24 CEST 2009


I have sent a note to  Peter Ruckdeschel who wrote the excellent 
SweaveListingUtils package but find myself up against a deadline in 
preparing a handout for useR! 2009.

The following is supposed to work:

<<>>=
plot(x, y)   # Figure `\ref{myfig}`
@

Where the back tick ` is an escape character and \ref{myfig} will be 
replaced by LaTeX with the correct figure number that was created by a 
\label{myfig} command.  I have not been able to get this to work.  I 
just get `\ref{myfig}` verbatim on the R output.

Does anyone know of a way to do this?

Thanks
Frank

-- 
Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University




More information about the R-help mailing list