title: Using tikz graphdrawing library within RMarkdown ... Need to use lualatex engine, but can't get it to work
body: <p>I have the following code in an <code>rmd</code> file which leverages <code>tikz</code> for diagrams:</p>
  
  <pre><code>---
  title: "TestNonTufteLua"
  author: "Me"
  output:
    pdf_document :
      latex_engine: lualatex
  ---
  
  Prove tikz works:
  ```{r tikTest1, engine = "tikz"}
  \usetikzlibrary{shapes}
  \begin{tikzpicture}
      \node[ellipse, draw=black, align = center] (Data) {Data $y_{n}$};
  \end{tikzpicture}
  ```
  
  Then, when you set `eval = TRUE` in the below code, it will not work. 
  ```{r tikTest2, eval = FALSE, engine = "tikz"}
  \usetikzlibrary{graphs, graphdrawing}
  \usegdlibrary{layered}
  \tikz [gr/.style={gray!50}, font=\bfseries]
  \graph [layered layout] {
      % A and F are horizontally aligned if you also set weight=0.5 for A -- C.
      A -- [minimum layers=2] C -- F,
      { [nodes=gr, edges=gr] A -- B -- { E, D -- F } }
  };
  ```
  </code></pre>
  
  <p>When changing to <code>eval=TRUE</code> in the second chunk, I get the following
  error: </p>
  
  <blockquote>
    <p>Quitting from lines 24-29 (testNonTufteLua.Rmd)  Error: running
    'texi2dvi' on '.\tikz36747a021b22.tex' failed</p>
    
    <p>LaTeX errors: rarygraphdrawing.code.tex:22: Package pgf Error: You
    need to run LuaTeX to use  the graph drawing library.</p>
  </blockquote>
  
  <p>This error occurs when using the <code>knit</code> button from RStudio or using <code>render("testNonTufteLua.Rmd", output_format = pdf_document(keep_tex = TRUE, latex_engine = "lualatex")</code>.  I have also experimented with setting <code>options(tikzDefaultEngine = "luatex")</code> to get <code>tikzDevice</code> to handle it properly, but it still does not work.  I just can't seem to get the <code>graphdrawing</code> library to work even though the <code>tikz-shapes</code> library can be loaded and also that the rest of the document seems to be compiled with <code>lualatex</code>.  Thanks for any help!!</p>