Error in getMetricsFromLatex(TeXMetrics)

1,392 views
Skip to first unread message

Nicolae

unread,
Mar 29, 2012, 7:35:50 PM3/29/12
to knitr
Sorry, here is the rest of the log:

("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls"
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo"
File: size10.clo 2007/10/19 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
)
label: cars-demo (with options)
List of 6
$ dev : chr "tikz"
$ fig.width : num 4
$ fig.height: num 2.8
$ out.width : chr ".45\\textwidth"
$ message : logi FALSE
$ cache : logi TRUE

Error in process_file(input) :
Quitting from lines 81-87: Error in
getMetricsFromLatex(TeXMetrics) :
TeX was unable to calculate metrics for the following string
or character:

m

Common reasons for failure include:
* The string contains a character which is special to LaTeX unless
escaped properly, such as % or $.
* The string makes use of LaTeX commands provided by a package and
the tikzDevice was not told to load the package.

The contents of the LaTeX log of the aborted run have been printed
above,
it may contain additional details as to why the metric calculation
failed.

Calls: knit -> process_file -> <Anonymous>

Execution halted

Nicolae

unread,
Mar 29, 2012, 7:32:40 PM3/29/12
to knitr
Hi,

I tried using knitr with RStudio 0.96.71 on Windows 7 with MikTex 2.9.
I was trying to run the knitr-manual.Rnw file and just pressed Compile
PDF. I got the error above at line 81. See below for the rest of the
log. Could you please tell me what is going on? Is this a problem with
MikTex? I updated MikTex itself and all the packages in it, restarted
RStudio, and it still won't work. I would appreciate any help you can
provide.

Thank you!

Nicolae

Yihui Xie

unread,
Mar 29, 2012, 9:58:41 PM3/29/12
to Nicolae, knitr
This may not be easy to diagnose. It is a problem of tikzDevice; the
first thing to check is the output of:

library(tikzDevice)

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

Yihui Xie

unread,
Jun 29, 2012, 1:13:36 PM6/29/12
to Pascal B, kn...@googlegroups.com, Nicolae
I guess I know the reason now: you need to install the tikz package
for LaTeX; I'm not sure how it is called in MikTeX (should be "pgf").
So open the MikTeX package manager, and install pgf. Let me know if
this solves the problem.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Fri, Jun 29, 2012 at 12:39 PM, Pascal B <hootho...@gmail.com> wrote:
> Hello Nicolae et Yihui,
>
> I have the same problem as Nicolae.
> my version of R studio is 0.96.304.
> any hints on what could be going wrong ?
> below are some outputs.
>
> best regards and nice week-end
> Pascal
>
> output of > library(tikzDevice) is :
>
> Le chargement a nécessité le package : filehash
> filehash: Simple key-value
> database (2.2-1
> 2012-03-12)
> tikzDevice: A Device for R
> Graphics Output in
> PGF/TikZ Format (v0.6.2)
> Checking for a LaTeX compiler...
>
>
> A working LaTeX compiler was found by checking:
> The PATH using the command pdflatex
>
> Global option tikzLatex set to:
> C:\PROGRA~2\MIKTEX~1.9\miktex\bin\pdflatex.exe
>
> MiKTeX-pdfTeX 2.9.4225 (1.40.12) (MiKTeX 2.9)
> Copyright (C) 1982 D. E. Knuth, (C) 1996-2006 Han The Thanh
>
>
>
> A working XeLaTeX compiler was found by checking:
> The PATH using the command xelatex
>
> Global option tikzXelatex set to:
> C:\PROGRA~2\MIKTEX~1.9\miktex\bin\xelatex.exe
>
> MiKTeX-XeTeX 2.9.4239 (0.9997.5) (MiKTeX 2.9)
> (C) 1994-2008 by SIL International, (C) 2009-2011 by Jonathan Kew
>

Pascal B

unread,
Jun 29, 2012, 6:22:24 PM6/29/12
to kn...@googlegroups.com, Pascal B, Nicolae
Dear Yihui,

thanks for the hint, indeed pgf was not installed.
but the problem is not solved with 'pgf' installation.

i also installed 'preview'. it seems not sufficient neither.

any other idea ? I'll keep investigating
thanks anyway
Pascal

On Friday, June 29, 2012 7:13:36 PM UTC+2, Yihui Xie wrote:
I guess I know the reason now: you need to install the tikz package
for LaTeX; I'm not sure how it is called in MikTeX (should be "pgf").
So open the MikTeX package manager, and install pgf. Let me know if
this solves the problem.

Regards,
Yihui


Yihui Xie

unread,
Jun 29, 2012, 7:43:34 PM6/29/12
to Pascal B, kn...@googlegroups.com, Nicolae
Are you sure you have other packages in knitr-manual.Rnw installed as
well? You can check by, e.g.

kpsewhich tikz.sty
kpsewhich mathpazo.sty

in the command window (Start->Run->cmd).

The tikzDevice package requires some LaTeX expertise to use, and the
knitr manual is probably a too complicated document to start with. If
you want to try tikz with knitr, you can start with a minimal example
like

\documentclass{article}
\begin{document}
<<test, dev='tikz'>>=
plot(1)
@
\end{document}

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


Rasmus

unread,
Aug 11, 2012, 12:08:44 PM8/11/12
to kn...@googlegroups.com, Pascal B, Nicolae
Just for the record, I solve this problem by removing preview.sty from auctex and using the latest from CTAN (use kpeewhich preview.sty to determine whether this is an issue)  Running a diff the only difference between the two files is that the ctan version has (i) a version; and (ii) a differently formatted date (/ versus -).
--Rasmus

Stéphane Laurent

unread,
Jul 6, 2013, 2:19:57 PM7/6/13
to kn...@googlegroups.com, Nicolae
Hello Pascal,

 This error message occurs when there's a mistake in the LaTeX code.
Are you sure the "m" in this line is correct ? : 

 \node[inner sep=0pt, outer sep=0pt, scale=1.07999997138977] (TeX) { m}



Le vendredi 29 juin 2012 18:39:49 UTC+2, Pascal B a écrit :
Hello Nicolae et Yihui,

I have the same problem as Nicolae.
my version of R studio is 0.96.304.
any hints on what could be going wrong ?
below are some outputs.

.....

Jeremie

unread,
Nov 11, 2014, 5:55:08 AM11/11/14
to kn...@googlegroups.com
Hello,
@Rasmus, could you please be more specific about how you updated the
preview.sty pacakge in auctex. I'm having a hell of a time solving this problem.
see http://stackoverflow.com/questions/26822998/tikzdevice-not-working-on-emacs.

--jeremie


Reply all
Reply to author
Forward
0 new messages