Undefined color `shadecolor'- RMarkdown fail to knit to pdf

Hi all,

apology if the question is not in the right format but I have been experiencing difficulties compiling pdf using Rmarkdown due to latex issues.

I had tinytex installed and am using R.3.6.2 version.

When I am knitting, the output throw an error saying:

output file: PSY613-HW5-RY.knit.md
! Package xcolor Error: Undefined color `shadecolor'.

I looked at similar questions but they all had a specific color in the error message. I had the following specified in my R markdown:

title: "HW5"
author: "xxx"
abstract:
date: \today
output:
  pdf_document:
    highlight: default
    keep_tex: false
    fig_caption: true
    latex_engine: pdflatex
fontsize: 11pt
geometry: margin=1in

I would really appreciate any insight into this. I have never encountered any issues before using the same setup.

What is the content of the file ?

This could come something in the content. With this header only, I can't reproduce.

Can you share also your Pandoc version ?

rmarkdown::pandoc_version()

thanks

Hi,
Thank you for your reply. My Pandoc version is 2.3.1 and I am also using macOS Mojave (version 10.14.6)

For the content, I was able to reproduce the error with the following:

```{r packages, include = FALSE}
library(pacman)
pacman::p_load(tidyverse,ggplot2,psych,here, Hmisc, modeest,car,effsize,rstatix,afex,ez,kableExtra,pastecs,emmeans,ggpubr)
```
**Background**:  
Background
**Instructions**:
# Exercise 1
a) read in data
```{r}
#Step 1 read in data 
turkey <- read.csv(here("turkey.csv"))
```

Everything works until I added the "Step 1 read in data" chunk, which threw the

! Package xcolor Error: Undefined color `shadecolor'.

If it is helpful,

The knitting problem came up after I have attempted to install tinytex using:

tinytex::install_tinytex(repository = "http://mirrors.tuna.tsinghua.edu.cn/CTAN/", 
version = "latest")

because I had the same issue about Certificate being out of date mentioned in this post

Upon installation I saw this Warning message:

In file.remove(exist_files(c(dir1, dir2))) :
  cannot remove file '/Users/rachelyan/Library/TinyTeX', reason 'No such file or directory'

This is everything I could think of that may lead to the issue

This is a quite old version. Last one is 2.16.2.
Do you have a RStudio IDE (which ships 2.14) to test your document ?

This is because the error comes from the highlighting by Pandoc on the PDF file. shadecolor must be included there.

Everything works on my side, so there must be something in your enviromnent causing this.

Can you run

tinytex::tlmgr("--version")

to check the version you are using.

Thanks

Yes, I am knitting everything from Rstudio IDE

I have

> tinytex::tlmgr("--version")
tlmgr --version
tlmgr revision 60693 (2021-10-04 04:24:25 +0200)
tlmgr using installation: /Users/rachelyan/Library/TinyTeX
TeX Live (https://tug.org/texlive) version 2021

You should have a more recent pandoc version then. You could update the IDE for that.

It worked!! Thank you so much.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.