daqana / tikzDevice

A R package for producing graphics output as PGF/TikZ code for use in TeX documents.

Home Page:https://daqana.github.io/tikzDevice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Tikz to export a simple graph from R but the .tex file is empty

WhiskersReneeWe opened this issue · comments

Hi, I spent hours trying to research the solutions but I failed. Can anybody help with this issue?
I simply want to transfer R graph into my Latex file on Overleaf, but the .tex file produced by tikzDevice from R is empty.

Here is the simple test code in R:

install.packages('tikzDevice')
library(tikzDevice)
library(ggplot2)

tikz('plot_first.tex',width=3.5, height=3)
plot(1:10)
dev.off()

Here is what I get:

Creating temporary TikZ metrics dictionary at:
	C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA/tikzMetricsDictionary
Using TikZ metrics dictionary at:
	C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA/tikzMetricsDictionary
Measuring dimensions of: m
Running command: "C:\PROGRA~2\MIKTEX~1.9\miktex\bin\pdflatex.exe" -interaction=batchmode -halt-on-error -output-directory "C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA\tikzDevice243c7c9a3444" "C:/Users/SHIYAN~1/AppData/Local/Temp/RtmpsvH0dA/tikzDevice243c7c9a3444/tikzStringWidthCalc.tex"
Error in getMetricsFromLatex(TeXMetrics, verbose = verbose) : 
TeX was unable to calculate metrics for:

I ran tikzTest(), here is the output (I can't fathom what is wrong):

Active compiler:
	C:\PROGRA~2\MIKTEX~1.9\miktex\bin\pdflatex.exe
	MiKTeX-pdfTeX 2.9.6050 (1.40.17) (MiKTeX 2.9)
	Copyright (C) 1982 D. E. Knuth, (C) 1996-2016 Han The Thanh

Measuring dimensions of: A
Running command: "C:\PROGRA~2\MIKTEX~1.9\miktex\bin\pdflatex.exe" -interaction=batchmode -halt-on-error -output-directory "C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA\tikzDevice243c1fae7c5e" "C:/Users/SHIYAN~1/AppData/Local/Temp/RtmpsvH0dA/tikzDevice243c1fae7c5e/tikzStringWidthCalc.tex"
This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9)
entering extended mode

Sorry, but C:\PROGRA~2\MIKTEX~1.9\miktex\bin\pdflatex.exe did not succeed.

The log file hopefully contains the information to get MiKTeX going again:

  C:/Users/shi yan/AppData/Local/MiKTeX/2.9/miktex/log/pdflatex.log

You may want to visit the MiKTeX project page, if you need help.

TeX was unable to calculate metrics for:

	A

Contents of TeX file C:/Users/SHIYAN~1/AppData/Local/Temp/RtmpsvH0dA/tikzDevice243c1fae7c5e/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 C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA\tikzDevice243c1fae7c5e/tikzStringWidthCalc.log:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (MiKTeX 2.9) (preloaded format=pdflatex 2018.9.24)  24 SEP 2018 11:41
entering extended mode
**"C:/Users/shi yan/AppData/Local/Temp/RtmpsvH0dA/tikzDevice243c1fae7c5e/tikzSt
ringWidthCalc.tex"

("C:/Users/shi yan/AppData/Local/Temp/RtmpsvH0dA/tikzDevice243c1fae7c5e/tikzStr
ingWidthCalc.tex"
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 75 language(s) loaded.
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\base\article.cls
"
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\frontendlaye
r\tikz.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\basiclayer\p
gf.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\utilities\pg
frcs.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgfutil-common.tex"
\pgfutil@everybye=\toks14
\pgfutil@tempdima=\dimen103
\pgfutil@tempdimb=\dimen104

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgfutil-common-lists.tex"))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgfutil-latex.def"
\pgfutil@abb=\box26
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\ms\everyshi.sty"
Package: everyshi 2001/05/15 v3.00 EveryShipout Package (MS)
))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgfrcs.code.tex"
Package: pgfrcs 2015/08/07 v3.0.1a (rcs-revision 1.31)
))
Package: pgf 2015/08/07 v3.0.1a (rcs-revision 1.15)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\basiclayer\p
gfcore.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics\graphic
x.sty"
Package: graphicx 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics\keyval.
sty"
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks15
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics\graphic
s.sty"
Package: graphics 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics\trig.st
y"
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics-cfg\gra
phics.cfg"
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 99.

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics-def\pdf
tex.def"
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
))
\Gin@req@height=\dimen105
\Gin@req@width=\dimen106
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\systemlayer\
pgfsys.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\systemlaye
r\pgfsys.code.tex"
Package: pgfsys 2014/07/09 v3.0.1a (rcs-revision 1.48)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgfkeys.code.tex"
\pgfkeys@pathtoks=\toks16
\pgfkeys@temptoks=\toks17

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgfkeysfiltered.code.tex"
\pgfkeys@tmptoks=\toks18
))
\pgf@x=\dimen107
\pgf@y=\dimen108
\pgf@xa=\dimen109
\pgf@ya=\dimen110
\pgf@xb=\dimen111
\pgf@yb=\dimen112
\pgf@xc=\dimen113
\pgf@yc=\dimen114
\w@pgf@writea=\write3
\r@pgf@reada=\read1
\c@pgf@counta=\count87
\c@pgf@countb=\count88
\c@pgf@countc=\count89
\c@pgf@countd=\count90
\t@pgf@toka=\toks19
\t@pgf@tokb=\toks20
\t@pgf@tokc=\toks21

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\systemlaye
r\pgf.cfg"
File: pgf.cfg 2008/05/14  (rcs-revision 1.7)
)
Driver file for pgf: pgfsys-pdftex.def

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\systemlaye
r\pgfsys-pdftex.def"
File: pgfsys-pdftex.def 2014/10/11  (rcs-revision 1.35)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\systemlaye
r\pgfsys-common-pdf.def"
File: pgfsys-common-pdf.def 2013/10/10  (rcs-revision 1.13)
)))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\systemlaye
r\pgfsyssoftpath.code.tex"
File: pgfsyssoftpath.code.tex 2013/09/09  (rcs-revision 1.9)
\pgfsyssoftpath@smallbuffer@items=\count91
\pgfsyssoftpath@bigbuffer@items=\count92
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\systemlaye
r\pgfsysprotocol.code.tex"
File: pgfsysprotocol.code.tex 2006/10/16  (rcs-revision 1.4)
))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\xcolor\xcolor.st
y"
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\graphics-cfg\col
or.cfg"
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352.
Package xcolor Info: Model `RGB' extended on input line 1364.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcore.code.tex"
Package: pgfcore 2010/04/11 v3.0.1a (rcs-revision 1.7)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
th.code.tex"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thcalc.code.tex"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thutil.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thparser.code.tex"
\pgfmath@dimen=\dimen115
\pgfmath@count=\count93
\pgfmath@box=\box27
\pgfmath@toks=\toks22
\pgfmath@stack@operand=\toks23
\pgfmath@stack@operation=\toks24
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.code.tex"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.basic.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.trigonometric.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.random.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.comparison.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.base.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.round.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.misc.code.tex")
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfunctions.integerarithmetics.code.tex")))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
thfloat.code.tex"
\c@pgfmathroundto@lastzeros=\count94
))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorepoints.code.tex"
File: pgfcorepoints.code.tex 2013/10/07  (rcs-revision 1.27)
\pgf@picminx=\dimen116
\pgf@picmaxx=\dimen117
\pgf@picminy=\dimen118
\pgf@picmaxy=\dimen119
\pgf@pathminx=\dimen120
\pgf@pathmaxx=\dimen121
\pgf@pathminy=\dimen122
\pgf@pathmaxy=\dimen123
\pgf@xx=\dimen124
\pgf@xy=\dimen125
\pgf@yx=\dimen126
\pgf@yy=\dimen127
\pgf@zx=\dimen128
\pgf@zy=\dimen129
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorepathconstruct.code.tex"
File: pgfcorepathconstruct.code.tex 2013/10/07  (rcs-revision 1.29)
\pgf@path@lastx=\dimen130
\pgf@path@lasty=\dimen131
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorepathusage.code.tex"
File: pgfcorepathusage.code.tex 2014/11/02  (rcs-revision 1.24)
\pgf@shorten@end@additional=\dimen132
\pgf@shorten@start@additional=\dimen133
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorescopes.code.tex"
File: pgfcorescopes.code.tex 2015/05/08  (rcs-revision 1.46)
\pgfpic=\box28
\pgf@hbox=\box29
\pgf@layerbox@main=\box30
\pgf@picture@serial@count=\count95
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcoregraphicstate.code.tex"
File: pgfcoregraphicstate.code.tex 2014/11/02  (rcs-revision 1.12)
\pgflinewidth=\dimen134
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcoretransformations.code.tex"
File: pgfcoretransformations.code.tex 2015/08/07  (rcs-revision 1.20)
\pgf@pt@x=\dimen135
\pgf@pt@y=\dimen136
\pgf@pt@temp=\dimen137
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorequick.code.tex"
File: pgfcorequick.code.tex 2008/10/09  (rcs-revision 1.3)
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcoreobjects.code.tex"
File: pgfcoreobjects.code.tex 2006/10/11  (rcs-revision 1.2)
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorepathprocessing.code.tex"
File: pgfcorepathprocessing.code.tex 2013/09/09  (rcs-revision 1.9)
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorearrows.code.tex"
File: pgfcorearrows.code.tex 2015/05/14  (rcs-revision 1.43)
\pgfarrowsep=\dimen138
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcoreshade.code.tex"
File: pgfcoreshade.code.tex 2013/07/15  (rcs-revision 1.15)
\pgf@max=\dimen139
\pgf@sys@shading@range@num=\count96
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcoreimage.code.tex"
File: pgfcoreimage.code.tex 2013/07/15  (rcs-revision 1.18)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcoreexternal.code.tex"
File: pgfcoreexternal.code.tex 2014/07/09  (rcs-revision 1.21)
\pgfexternal@startupbox=\box31
))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorelayers.code.tex"
File: pgfcorelayers.code.tex 2013/07/18  (rcs-revision 1.7)
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcoretransparency.code.tex"
File: pgfcoretransparency.code.tex 2013/09/30  (rcs-revision 1.5)
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\basiclayer
\pgfcorepatterns.code.tex"
File: pgfcorepatterns.code.tex 2013/11/07  (rcs-revision 1.5)
)))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\modules\pg
fmoduleshapes.code.tex"
File: pgfmoduleshapes.code.tex 2014/03/21  (rcs-revision 1.35)
\pgfnodeparttextbox=\box32
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\modules\pg
fmoduleplot.code.tex"
File: pgfmoduleplot.code.tex 2015/08/03  (rcs-revision 1.13)
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\compatibilit
y\pgfcomp-version-0-65.sty"
Package: pgfcomp-version-0-65 2007/07/03 v3.0.1a (rcs-revision 1.7)
\pgf@nodesepstart=\dimen140
\pgf@nodesepend=\dimen141
)
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\compatibilit
y\pgfcomp-version-1-18.sty"
Package: pgfcomp-version-1-18 2007/07/23 v3.0.1a (rcs-revision 1.1)
))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\utilities\pg
ffor.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\utilities\pg
fkeys.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgfkeys.code.tex"))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\latex\pgf\math\pgfmath
.sty"
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
th.code.tex"))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\utilities\
pgffor.code.tex"
Package: pgffor 2013/12/13 v3.0.1a (rcs-revision 1.25)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\math\pgfma
th.code.tex")
\pgffor@iter=\dimen142
\pgffor@skip=\dimen143
\pgffor@stack=\toks25
\pgffor@toks=\toks26
))
("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\frontendla
yer\tikz\tikz.code.tex"
Package: tikz 2015/08/07 v3.0.1a (rcs-revision 1.151)

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\libraries\
pgflibraryplothandlers.code.tex"
File: pgflibraryplothandlers.code.tex 2013/08/31 v3.0.1a (rcs-revision 1.20)
\pgf@plot@mark@count=\count97
\pgfplotmarksize=\dimen144
)
\tikz@lastx=\dimen145
\tikz@lasty=\dimen146
\tikz@lastxsaved=\dimen147
\tikz@lastysaved=\dimen148
\tikzleveldistance=\dimen149
\tikzsiblingdistance=\dimen150
\tikz@figbox=\box33
\tikz@figbox@bg=\box34
\tikz@tempbox=\box35
\tikz@tempbox@bg=\box36
\tikztreelevel=\count98
\tikznumberofchildren=\count99
\tikznumberofcurrentchild=\count100
\tikz@fig@count=\count101

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\modules\pg
fmodulematrix.code.tex"
File: pgfmodulematrix.code.tex 2013/09/17  (rcs-revision 1.8)
\pgfmatrixcurrentrow=\count102
\pgfmatrixcurrentcolumn=\count103
\pgf@matrix@numberofcolumns=\count104
)
\tikz@expandcount=\count105

("C:\Users\shi yan\AppData\Local\Programs\MiKTeX 2.9\tex\generic\pgf\frontendla
yer\tikz\libraries\tikzlibrarytopaths.code.tex"
File: tikzlibrarytopaths.code.tex 2008/06/17 v3.0.1a (rcs-revision 1.2)
)))
Warning messages:
1: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\pdflatex.exe" -interaction=batchmode -halt-on-error -output-directory "C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA\tikzDevice243c1fae7c5e" "C:/Users/SHIYAN~1/AppData/Local/Temp/RtmpsvH0dA/tikzDevice243c1fae7c5e/tikzStringWidthCalc.tex"' had status 1 
2: In readLines(texLog) :
  incomplete final line found on 'C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA\tikzDevice243c1fae7c5e/tikzStringWidthCalc.log'
3: In readLines(texLog) :
  incomplete final line found on 'C:\Users\SHIYAN~1\AppData\Local\Temp\RtmpsvH0dA\tikzDevice243c1fae7c5e/tikzStringWidthCalc.log'

I am not sure how to solve this at all even though I checked all the relevant posts online.
Please help! Thanks a lot!

Hi @WhiskersReneeWe, this looks like the issue discussed in #176.
What version of Windows are you running; also 32 or 64 bit? What's your R version? You could also paste your output of devtools::session_info() here.

Hi @bellackn, Thank you very much!

Session info -------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 system   x86_64, mingw32             
 ui       RStudio (1.1.442)           
 language (EN)                        
 collate  English_United States.1252  
 tz       America/Los_Angeles         
 date     2018-09-26                  

Packages -----------------------------------------------------------------------------------------------------------
 package     * version date       source        
 base        * 3.4.4   2018-03-15 local         
 codetools     0.2-15  2016-10-05 CRAN (R 3.4.4)
 coin          1.2-2   2017-11-28 CRAN (R 3.4.4)
 colorspace    1.3-2   2016-12-14 CRAN (R 3.4.3)
 compiler      3.4.4   2018-03-15 local         
 datasets    * 3.4.4   2018-03-15 local         
 devtools      1.13.5  2018-02-18 CRAN (R 3.4.3)
 digest        0.6.14  2018-01-14 CRAN (R 3.4.3)
 filehash      2.4-1   2017-04-07 CRAN (R 3.4.1)
 ggplot2     * 2.2.1   2016-12-30 CRAN (R 3.4.4)
 graphics    * 3.4.4   2018-03-15 local         
 grDevices   * 3.4.4   2018-03-15 local         
 grid          3.4.4   2018-03-15 local         
 gtable        0.2.0   2016-02-26 CRAN (R 3.4.3)
 labeling      0.3     2014-08-23 CRAN (R 3.4.1)
 lattice       0.20-35 2017-03-25 CRAN (R 3.4.4)
 lazyeval      0.2.1   2017-10-29 CRAN (R 3.4.3)
 MASS          7.3-49  2018-02-23 CRAN (R 3.4.4)
 Matrix        1.2-12  2017-11-30 CRAN (R 3.4.4)
 memoise       1.1.0   2017-04-21 CRAN (R 3.4.4)
 methods     * 3.4.4   2018-03-15 local         
 modeltools    0.2-21  2013-09-02 CRAN (R 3.4.1)
 multcomp      1.4-8   2017-11-08 CRAN (R 3.4.4)
 munsell       0.4.3   2016-02-13 CRAN (R 3.4.3)
 mvtnorm       1.0-7   2018-01-26 CRAN (R 3.4.3)
 party         1.3-0   2018-04-20 CRAN (R 3.4.4)
 pillar        1.1.0   2018-01-14 CRAN (R 3.4.3)
 plyr          1.8.4   2016-06-08 CRAN (R 3.4.3)
 Rcpp          0.12.17 2018-05-18 CRAN (R 3.4.4)
 rlang         0.2.1   2018-05-30 CRAN (R 3.4.4)
 sandwich      2.4-0   2017-07-26 CRAN (R 3.4.3)
 scales        0.5.0   2017-08-24 CRAN (R 3.4.3)
 splines       3.4.4   2018-03-15 local         
 stats       * 3.4.4   2018-03-15 local         
 stats4        3.4.4   2018-03-15 local         
 strucchange   1.5-1   2015-06-06 CRAN (R 3.4.3)
 survival      2.41-3  2017-04-04 CRAN (R 3.4.4)
 TH.data       1.0-8   2017-01-23 CRAN (R 3.4.4)
 tibble        1.4.1   2017-12-25 CRAN (R 3.4.3)
 tikzDevice  * 0.12    2018-07-02 CRAN (R 3.4.4)
 tools         3.4.4   2018-03-15 local         
 utils       * 3.4.4   2018-03-15 local         
 withr         2.1.1   2017-12-19 CRAN (R 3.4.3)
 yaml          2.1.18  2018-03-08 CRAN (R 3.4.4)
 zoo           1.8-1   2018-01-08 CRAN (R 3.4.3)

Hmm, I still struggle with reproducing this error on a brand-new Windows 10 32 bit VM and R v3.4.4. What exact Windows are you using?

Also, what you could try is setting a global tikzMetricsDictionary as follows:

options(tikzMetricsDictionary = file.path("C:", "users", "[YOUR_USERNAME]", "tikzMetricsDict", fsep = .Platform$file.sep))

tikzDevice::tikz("plot_second.tex", width = 3.5, height = 3, standAlone = TRUE)
plot(1:10)
dev.off()

Hello @WhiskersReneeWe, did you have time yet to test my suggested workaround?