Problem
When I’m trying to knit .Rmd file into .pdf file in RStudio, I’ve got this error log:
/Applications/RStudio.app/Contents/MacOS/pandoc/pandoc t.utf8.md — to latex — from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures — output t.pdf — filter /Applications/RStudio.app/Contents/MacOS/pandoc/pandoc-citeproc — template /Users/13k/R/rmarkdown/rmd/latex/default.tex — highlight-style tango — latex-engine pdflatex — variable geometry:margin=1in
output file: t.knit.mdpandoc: Error producing PDF from TeX source.
! LaTeX Error: File `framed.sty’ not found.Type X to quit or <RETURN> to proceed,
or enter new name. (Default extension: sty)Enter file name:
! Emergency stop.
<read *>l.31 \definecolor
Error: pandoc document conversion failed
Execution halted
The main problem is:
File ‘framed.sty’ not found.
Solution
After a few hours of googling time for a solution, I’ve found that it was caused by missing LaTeX package in my macOS. Unlike LaTeX in Windows, I can’t find GUI app for LaTeX in macOS. Because of that, I need to do package installation manually using Terminal with sudo tlmgr command.
Try to type this command in Terminal:
sudo tlmgr update — self
sudo tlmgr install framed
You may need this LaTex version have been installed on your Mac:
XeLaTeX
MiKTeX