This is a new user of R.
TikzDevice and ggplot2 have been installed in R Studio on MacBook Air.
An error occurred when trying to run the blue code in the screenshot.
I tried to use tikzTest() to check the error. The error was ! LaTeX Error: File 'tikz.sty' not found. The full output of tikzTest() is after the screenshot.
Just wondering how to fix this error?
P.s. I've installed MacTex but could not find tikz.sty in packages or updates.
Much appreciated if some solutions could be provided.
tikzTest()
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: A
Running command: '/usr/local/bin/pdflatex' -interaction=batchmode -halt-on-error -output-directory '/var/folders/1t/bjl9jstj6zl4gx_lxwkfvxqw0000gn/T//RtmpuavW7G/tikzDevice13b806c1dd9fc' '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:
A
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) {A};
\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.4.30) 14 MAY 2021 22:22
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**tikzStringWidthCalc.tex
(/var/folders/1t/bjl9jstj6zl4gx_lxwkfvxqw0000gn/T//RtmpuavW7G/tikzDevice13b806c
1dd9fc/tikzStringWidthCalc.tex
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18> (/Users/waterqi/Library/TinyTeX/texmf-dist/te
x/latex/base/article.cls
Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
(/Users/waterqi/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:
220 strings out of 480954
2975 string characters out of 5906449
280518 words of memory out of 5000000
17541 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
44i,0n,50p,138b,36s stack positions out of 5000i,500n,10000p,200000b,80000s
! ==> Fatal error occurred, no output PDF file produced!
>

tikz. – daleif May 14 '21 at 12:58