是否可以在R Markdown文档中\usetikzlibrary{bayesnet}
?该命令在Tex中运行正常。但是Markdown会抛出一个错误,说找不到该文件:tikzlibrarybayesnet.code.tex
这是我的R markdown文件的标题:
---
title: "Sample R Markdown Report"
author: "My name"
date: "Today's date"
output:
pdf_document: default
header-includes:
- \usepackage{tikz}
- \usetikzlibrary{bayesnet}
---
## LDA as a Graphical Model:
\begin{figure}
\centering
\tikz{ %
\node[latent] (alpha) {$\alpha$} ; %
\node[latent, right=of alpha] (theta) {$\theta$} ; %
\node[latent, right=of theta] (z) {z} ; %
\node[obs, right=of z] (w) {w} ; %
\node[latent, right=of w] (phi) {$\phi$} ; %
\node[latent, right=of phi] (beta) {$\beta$} ; %
\plate[inner sep=0.25cm, xshift=-0.12cm, yshift=0.12cm] {plate1} {(z) (w)} {N}; %
\plate[inner sep=0.25cm, xshift=-0.12cm, yshift=0.12cm] {plate2} {(theta) (plate1)} {M}; %
\plate[inner sep=0.25cm, xshift=-0.12cm, yshift=0.12cm] {plate2} {(phi)} {K}; %
\edge {alpha} {theta} ; %
\edge {theta} {z} ; %
\edge {z,phi} {w} ; %
\edge {beta} {phi} ; %
}
\end{figure}
这是我得到的错误:
!包tikz错误:我没有找到tikz库' bayesnet'。我找了 名为tikzlibrarybayesnet.code.tex和pgflibrarybayesnet.code.tex的文件,但是 要么可以在当前的texmf树中找到..
如果我知道文件位于下面的位置,是否可以直接指定它的路径?
/usr/local/texlive/2014/texmf-dist/tex/generic/pgf/frontendlayer/tikz/libraries/tikzlibrarybayesnet.code.tex
This tikz example运行正常。它将它扩展到usetikzlibrary{}
让我搞砸了。