Tikz not installed? Yes it is!

mdframedtikz-pgf

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.

(c:/Users/14506498/AppData/Roaming/TinyTeX/texmf-dist/tex/latex/mdframed/md-frame-1.mdf

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?

Best Answer

@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.

Related Question