Incompatibility between the emaxima LaTeX mode and the knitr R package.



Hi,

On knitr's side, you can remove the color package using the `document`
hook (if you have the latest version of knitr), e.g.

<<no-color, include=FALSE>>=
knit_hooks$set(document = function(x) {
  sub('\\usepackage{graphicx, color}', '\\usepackage{graphicx}', x,
fixed = TRUE)
})
@


Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Sun, Nov 25, 2012 at 11:19 AM, Emmanuel Charpentier
<emm.charpentier at free.fr> wrote:
> Dear Xie, dear list,
>
> In order to add some trace of symbolic computations related to a
> statistical problem in the relevant document, created via R and knitr, I
> tried to use the emaxima LaTeX style (which I already had used
> successfully in another Sweave-processed .Rnw file).
>
> It turns out that this is not currently possible :
>
> - the knitting process adds \usepackage{graphicx, color} right after the
> \documentclass declaration opening the .Rnw file.
>
> - The emaxima package also uses color, in an incompatible way. From the
> pdflatex log :
>
> ==============================================================
> (/usr/share/texmf/tex/latex/emaxima.sty
> (/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty)
>
> ! LaTeX Error: Option clash for package color.
>
> See the LaTeX manual or LaTeX Companion for explanation.
> Type  H <return>  for immediate help.
>  ...
>
> l.85 \usepackage
>                 {pdfcolmk}
> ?
> ! Emergency stop.
>  ...
>
> l.85 \usepackage
>                 {pdfcolmk}
> !  ==> Fatal error occurred, no output PDF file produced!
> ==============================================================
>
> Can someone suggest a workaround ?
>
> Sincerely,
>
>                                         Emmanuel Charpentier
>
>