I work across two separate Mac computers, a Macbook Pro at work, and a Macbook Air at home. Both macs are running identical operating systems. I am writing in RMarkdown, using knitr to compile beamer slides.

One machine runs perfectly, but the other generates a conflict with the xcolor package.

! Package xcolor Error: Undefined color `Maroon'.

This error has been reported elsewhere, with the primary solution to include the following line in a LaTeX document:


Unfortunately, this is not possible when working from markdown. Even if it was possible, this would not explain why the document is compiling perfectly on one machine, but not on the other.

The session info (sessionInfo()) from RStudio is identical for both machines. The version info acquired from $ latex -v is also identical.

The RStudio session info is as follows:

R version 3.5.1 (2018-07-02)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
    [1] compiler_3.5.1  backports_1.1.2 magrittr_1.5    rprojroot_1.3-2
[5] htmltools_0.3.6 tools_3.5.1     yaml_2.2.0      Rcpp_0.12.18   
[9] stringi_1.2.4   rmarkdown_1.10  knitr_1.20      stringr_1.3.1  
[13] digest_0.6.15   evaluate_0.11

While the latex -v info is also identical and reads as follows:

pdfTeX 3.14159265-2.6-1.40.19 (TeX Live 2018)
kpathsea version 6.3.0
Copyright 2018 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.34; using libpng 1.6.34
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.00

I have also copied the full RStudio library section across the two machines, which effectively rules the RStudio environment out as a source of the problem.

A basic example of a slide deck that fails on one but not the other is as follows. This code should be saved as an *.Rmd file, and will require the bookdown package to be pre-installed.

title: 'Test slide deck'
author: "Rob Smith"
date: "Updated `r format(Sys.time(), '%B %d, %Y')`"
    colortheme: seahorse
    fonttheme: serif
    slide_level: 3
    theme: Berkeley
        collapse: section
    self.contained: yes
    split_by: none
  pdf_document: default
- \usepackage{tikz}
- \usepackage{pgfplots}
- \usepackage{fontawesome5}
- \usepackage{academicons}
urlcolor: red

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)

# Test slide deck for code
## Section 1
### Slide 1
#### Box on slide 1

This is just a test file to demonstrate the problem with `xcolor`.

If possible I would like to identify all possible points of difference in the two TeX installations.

Is there by any chance a simple way to do this, either from the console in RStudio, or from the terminal in OSX?

  • 1
    Welcome to TeX.se. Can edit your question to add a small .Rmd file that will produce the problem for you on the machine that doesn't work? – Alan Munn Aug 22 '18 at 13:44
  • Thanks for adding the code. This code produces the same error? I don't see any place in which the colour 'Maroon' is used. – Alan Munn Aug 22 '18 at 14:17
  • @AlanMunn, It does indeed, according to other posts, the error appears to be generated in the links of the Beamer template. The template I believe calls the xcolor package from TeX. The xcolor question appears to have been addressed here for the LaTeX environment. Unfortunately my knowledge of how pandoc works is fairly limited. I am just hoping that if I find the difference between the two installations I will be able to point to the actual culprit. – Rob Smith Aug 22 '18 at 14:25
  • Unfortunately this compiles without error for me. Try adding knitr::opts_knit$set(latex.options.color = "dvipsnames,svgnames,x11names") Does this change anything? – Alan Munn Aug 22 '18 at 15:12
  • Still no luck, unfortunately. There must be something faulty with this installation, although it is a fresh installation of TeX 2018 distribution on both machines, which makes the difference seem strange. – Rob Smith Aug 22 '18 at 17:35

Thanks to @AlanMunn I stumbled across a solution to the problem.

Both machines are essentially set up identically, including: OSX version (MacOS High Sierra, version 10.13.6 (17G65)) Rstudio version (1.1.456) R version (3.5.1) (with native pandoc installation) Tex live Distribution (2018)

After @AlanMunn 's comment I realised that at a recent workshop I installed homebrew version of pandoc, with the command:

$ brew install pandoc

After installing this, the xcolor package error disappeared and the documents compile perfectly on both machines. It would appear that the homebrew distribution is free of the problem caused by the native RStudio version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.