I am trying to run some R markdown code, knitting some LaTeX together, and I am getting these odd warnings:

Package mdframed Warning: The file tikz does not exist (mdframed) but needed by mdframed

(mdframed) see documentation fo further information on input line 382.


File: md-frame-1.mdf 2013/07/01\ 1.9b: md-frame-1

! Undefined control sequence.

l.174 \tikzset {mdfframetitlerule/.style={% ...

However, I have installed tikz. Here are the packages my header imports:

  • \usepackage{subfig}
  • \usepackage{framed}
  • \usepackage{adjustbox}
  • \usepackage{xcolor}
  • \usepackage{booktabs}
  • \usepackage{longtable}
  • \usepackage{array}
  • \usepackage{multirow}
  • \usepackage{wrapfig}
  • \usepackage{float}
  • \usepackage{colortbl}
  • \usepackage{pdflscape}
  • \usepackage{tabu}
  • \usepackage{threeparttable}
  • \usepackage{threeparttablex}
  • \usepackage[normalem]{ulem}
  • \usepackage{makecell}
  • \usepackage{tikz}

I have read elsewhere that xcolor and tikz can sometimes have installation order/compatibility issues. I have tried reinstalling pgf and xcolor in different orders, but the same error persists. What is the problem?

  • 6
    quite possibly you have two tex systems, a minimal one for R and a full one with tikz, please show a small complete test file and a full log with the error, as code blocks ({} in the editor) not quotations or itemized lists. Feb 6, 2022 at 11:51

1 Answer 1


@DavidCarlisle was correct. MikTeX was installed containing all required packages, but TinyTeX had also been installed, and Rmarkdown was choosing the latter. Errors pointed to \tikz/mdframed because the first piece of code run called those packages, but in reality TinyTeX may have had none of the packages I needed.

Problem was solved by tinytex::uninstall_tinytex().

I also subsequently ran remove.packages("tinytex"). Note the order here is important!).

Note the distinction between tinytex and TinyTeX: TinyTeX is a LaTeX installation (just like MikTeX, ...) which can be run without R, whereas tinytex is an R package which provides easy use/installation/package management of TinyTeX.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .