1

When I compile the following:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Arial}

\begin{document}

Hello.

<<foo, dev='tikz'>>=
library(ggplot2)
qplot(1)
@

\end{document}

I get the error

Line 10: Error in getMetricsFromLatex(TeXMetrics, verbose = verbose) :

I get no error when I omit

\usepackage{fontspec}
\setmainfont{Arial}

or dev='tikz'. Looking at Yihui's answer here (How to debug if Knitr quits unexpectedly when composing tikz figure), I followed his debugging steps.

  1. check the log file figure/foo.log for the error message

There is no file figure/foo.log

  1. open figure/foo.tikz (it is supposed to be a complete LaTeX document), and see if you can spot anything wrong

Nothing appears wrong in the preamble, but there is only a blank line between \begin{document} and \end{document}.

  1. try cd figure/; pdflatex foo.tikz in the terminal, and see what pdflatex [edit: xelatex] says (you'd better remove \nonstopmode in foo.tikz)

Unsurprisingly, xelatex foo.tikz runs fine, but produces no output.

  • Have you tried to open your document on external pdf file? Maybe it's just the console that doesn't make appear your work – PMC1234 Jan 31 '16 at 9:47
  • 1
    No pdf file is produced. – Hugh Jan 31 '16 at 9:52
  • 2
    this seems to be a known issue github.com/yihui/tikzDevice/issues/46 – David Carlisle Jan 31 '16 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.