故障排除:系统错误latexCmd,实习生 = TRUE,ignore.stderr = TRUE:运行命令时出错 - RStudio 中的 tikzDevice

如何解决故障排除:系统错误latexCmd,实习生 = TRUE,ignore.stderr = TRUE:运行命令时出错 - RStudio 中的 tikzDevice

所以我尝试使用 tikzDevice 来获取矢量图形,然后我想将其包含在我的 Overleaf 文件中。然而,当我使用 here 中的指令时,我遇到了一个问题。

此外,我使用 RStudio 版本 1.3.929 和最新的 MikTex。我还更新了所有软件包。

# Example by Ilyass

library(tikzDevice)
library(ggplot2)
    
options(tz="Europe/Berlin")

#Dummy data for the plot
y <- exp(seq(1,10,.1))
x <- 1:length(y)
data <- data.frame(x = x,y = y)

#Create a .tex file that will contain your plot as vectors
tikz(file = "plot_test.tex",width = 5,height = 5)

#Simple plot of the dummy data using LaTeX elements
    plot <- ggplot(data,aes(x = x,y = y)) + 
        geom_line() +
        ggtitle( paste("Fancy \\LaTeX ","\\hspace{0.01cm} title")) +
        labs( x = "$x$ = Time",y = "$\\Phi$ = Innovation output") +
        theme_bw()

#This line is only necessary if you want to preview the plot right after compiling
print(plot)

#Necessary to close or the tikxDevice .tex file will not be written
dev.off()

如果我运行我的代码(见上文),我会收到错误消息:

TeX 无法计算以下指标: \char77

然后我运行它并收到此错误消息:

tikzTest("\\char77") 
 Active compiler:
    /usr/local/bin/pdflatex
    pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021)
    kpathsea version 6.3.3

Measuring dimensions of: \char77
Running command: '/usr/local/bin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/1r/rtb0lx8x5hdg48qw7bg3wh8c0000gn/T//RtmpIEsh0G/tikzDevice12365771d59f1' 'tikzStringWidthCalc.tex'
This is pdfTeX,Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode

TeX was unable to calculate metrics for:

    \char77

Contents of TeX file tikzStringWidthCalc.tex:

\documentclass[10pt]{article}

\usepackage{tikz}

\usepackage[active,tightpage,psfixbb]{preview}

\PreviewEnvironment{pgfpicture}

\setlength\PreviewBorder{0pt}

\usepackage[T1]{fontenc}

\usetikzlibrary{calc}

\batchmode
\begin{document}
\begin{tikzpicture}
\node[inner sep=0pt,outer sep=0pt,scale=1] (TeX) {\char77};
\path let \p1 = ($(TeX.east) - (TeX.west)$),\n1 = {veclen(\x1,\y1)} in (TeX.east) -- (TeX.west)
    node{ \typeout{tikzTeXWidth=\n1} };
\end{tikzpicture}
\end{document}
Contents of log file tikzStringWidthCalc.log:

This is pdfTeX,Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex 2021.5.18)  18 JUN 2021 10:29
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**tikzStringWidthCalc.tex

(/var/folders/1r/rtb0lx8x5hdg48qw7bg3wh8c0000gn/T//RtmpIEsh0G/tikzDevice1236577
1d59f1/tikzStringWidthCalc.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-05-11> (/Users/sophiehensgen/Library/TinyTeX/texmf-d
ist/tex/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(/Users/sophiehensgen/Library/TinyTeX/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2020/04/10 v1.4m Standard LaTeX file (size option)
)
\c@part=\count179
\c@section=\count180
\c@subsection=\count181
\c@subsubsection=\count182
\c@paragraph=\count183
\c@subparagraph=\count184
\c@figure=\count185
\c@table=\count186
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen138
)

! LaTeX Error: File `tikz.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.4 ^^M
        
Here is how much of TeX's memory you used:
 223 strings out of 480796
 3020 string characters out of 5903434
 284328 words of memory out of 5000000
 17703 multiletter control sequences out of 15000+600000
 403430 words of font info for 27 fonts,out of 8000000 for 9000
 14 hyphenation exceptions out of 8191
 34i,0n,38p,138b,36s stack positions out of 5000i,500n,10000p,200000b,80000s

!  ==> Fatal error occurred,no output PDF file produced!

我可以通过使用以下命令在正确的位置设置 pdflatex 来解决这个问题。

getoption("tikzLatex")
options("tikzLatex"='/usr/bin/pdflatex')

但是,不,我收到了一个全新的错误,我找不到任何帮助。

Error in system(latexCmd,intern = TRUE,ignore.stderr = TRUE) : error in running command

有人知道我如何解决这个问题或 tikzDevice 的替代方案吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?
Java在半透明框架/面板/组件上重新绘画。
Java“ Class.forName()”和“ Class.forName()。newInstance()”之间有什么区别?
在此环境中不提供编译器。也许是在JRE而不是JDK上运行?
Java用相同的方法在一个类中实现两个接口。哪种接口方法被覆盖?
Java 什么是Runtime.getRuntime()。totalMemory()和freeMemory()?
java.library.path中的java.lang.UnsatisfiedLinkError否*****。dll
JavaFX“位置是必需的。” 即使在同一包装中
Java 导入两个具有相同名称的类。怎么处理?
Java 是否应该在HttpServletResponse.getOutputStream()/。getWriter()上调用.close()?
Java RegEx元字符(。)和普通点?