本文介绍了为什么 knitr 无法找到 framed.sty 或 kpsewhich?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

knit('test2.rnw')


processing file: test2.rnw
  |>>>>>>>>>>>>>                                                    |  20%
  |>>>>>>>>>>>>>>>>>>>>>>>>>>                                       |  40%
label: setup (with options) 
List of 2
 $ include: logi FALSE
 $ cache  : logi FALSE

sh: kpsewhich: command not found
  |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>                          |  60%
  |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>             |  80%
  |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| 100%
  ordinary text without R code


output file: /Users/xxx/Desktop/R_meetup/documentation/test2.tex

Warning message:
In test_latex_pkg("framed", system.file("misc", "framed.sty", package = "knitr")) :
  unable to find LaTeX package 'framed'; will use a copy from knitr
 >

我使用的是 OSX Lion 10.7.3

I'm on OSX Lion 10.7.3

kpsewhich 的路径:

Path for kpsewhich:

   $ which kpsewhich
    /usr/texbin/kpsewhich


$ which pdflatex
/usr/texbin/pdflatex

两个路径都在我的 home 目录中的 .bash_profile 中.我的 Tex 安装中确实有框架包.

Both paths are in my .bash_profile in my home directory. I do have the framed package in my Tex install.

PATH=$PATH:/usr/texbin/pdflatex
PATH=$PATH:/usr/texbin/kpsewhich
export PATH

解决方案

将此添加到我的 .rprofile 修复它:

Adding this to my .rprofile fixed it:

Sys.setenv("PATH" = paste(Sys.getenv("PATH"),"/usr/texbin",sep=":"))

推荐答案

安装 texlive-latex-extra 为我解决了.原始答案(https://stackoverflow.com/a/25517332/1169233)适用于 Ubuntu,但 AFAIK也应该在 Mac OS 上逐字运行.

Installing texlive-latex-extra solved for me. The original answer (https://stackoverflow.com/a/25517332/1169233) is intended for Ubuntu, but AFAIK it should work verbatim on Mac OS too.

这篇关于为什么 knitr 无法找到 framed.sty 或 kpsewhich?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 03:49