Fragment output without knitrout and verbatim environment

<<newChunk,echo=FALSE,comment=NA,background=NA>>=
x <- "\\includegraphics[width=\\maxwidth]{figure/Kompetenz1.pdf}"
cat(x)
@ 

      

If I run this r-code in my .Rnw file, I get the following output in my .tex file:

\begin{knitrout}
\definecolor{shadecolor}{rgb}{1, 1, 1}\color{fgcolor}\begin{kframe}
\begin{verbatim}
\includegraphics[width=\maxwidth]{figure/Kompetenz1.pdf}
\end{verbatim}
\end{kframe}
\end{knitrout}

      

How can I only get \ includegraphics {...} without any environment in my .tex file?

+3


source to share


2 answers


I'm not sure why you are using Knitr in the first place. It looks like you are just trying to include the PDF in your latex document. To do this, I would use the command:

\includepdf[pages=-]{figure/Kompetenz1.pdf}

      

or



\includegraphics[width=\maxwidth]{figure/Kompetenz1.pdf}

      

In your Rnw. No need for a piece of Knitr.

0


source


The answer from @baptiste was right.

Why I used the Knitr block to loop over some values. Here's my sample code:



<<Ueberblick, echo = FALSE, results = 'asis'>>=
for(i in 1:nrow(Kompetenzen)){ 
    cat(paste("\\includegraphics[width=\\maxwidth]figure/Kompetenz.pdf}",i," \\newline ",sep=""))
}

@

      

Thanks for the help!

0


source







All Articles