diff --git a/.gitignore b/.gitignore index e3bbc5310213152a4f02ea8b5f43b48642448f18..aa98502d4bc9e2598eaa9329a666ce47bb406a88 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,11 @@ probabilities.tex *.Rproj /*.tex /*_files/ +*.dot +*.log +MyGraph.pdf +*.aux +*.log +*.out +*.toc + diff --git a/make-pdf.sh b/make-pdf.sh index 39dacd466960efede6f6a17c432a74f9b9423548..27643d4623096d229449543f77d4cc8957bc3e91 100755 --- a/make-pdf.sh +++ b/make-pdf.sh @@ -1,6 +1,13 @@ #!/bin/sh for file in *.Rmd do - # do something on $file Rscript -e "library(rmarkdown); rmarkdown::render('$file', 'pdf_document')" done + +pdflatex --shell-escape syncleus-white-example.tex + +#for file in *.tex +#do +# pdflatex --shell-escape "$file" +#done + diff --git a/syncleus-white-example.Rmd b/syncleus-white-example.Rmd index 5030f551eb9405a22a28a10cabe9ac9bdd8bd984..c187e299006b8d2bc886b5ea4f8a35cd434734b6 100644 --- a/syncleus-white-example.Rmd +++ b/syncleus-white-example.Rmd @@ -46,6 +46,33 @@ we have Naive Bayes Classifiers and Bayesian Networks which operate on completely different principles. Moreover this is compounded with a lack of understanding regarding unconditional and conditional probabilities. +\digraph[scale=0.5]{MyGraph}{ + rankdir="LR"; + 4, 10 [color = pink, style = filled]; + 4->13 + 10->13 + 10->2 + 13, 2 [color = lightblue, style = filled]; + 13->6 + 13->1 + 2->8 + 1, 6, 8 [color = green, style = filled]; + 1->15 + 8->9 + 15, 9 [color = yellow, style = filled]; + 9->5 + 15->3 + 15->12 + 15->11 + 15->14 + 3, 5, 11, 12, 14 [color = orange, style = filled]; + 5->7 + 11->7 + 14->7 + 10->7 + 7 [color = magenta, style = filled]; +} + In this article I offer a tutorial to help bring the lay person up to speed with some basic understanding on these concepts and how Bayes Theorem can be applied. diff --git a/syncleus-white-example.pdf b/syncleus-white-example.pdf index 3941282166cfd0e0b1d6de913462d8285b8a09a0..cd51e26bf9bff0eae083c9afed72ff3393d6eb90 100644 Binary files a/syncleus-white-example.pdf and b/syncleus-white-example.pdf differ diff --git a/templates/graphviz.sty b/templates/graphviz.sty new file mode 100644 index 0000000000000000000000000000000000000000..201a3f3eb7d809272ed6c5b6e801c43b5d8903a7 --- /dev/null +++ b/templates/graphviz.sty @@ -0,0 +1,77 @@ +% graphviz.sty +% by Mark Aufflick +% 2006-03-25 +% mark@aufflick.com +% http://mark.aufflick.com/ +% +% based on graphviz.tex by Derek Rayside 2003 + +% Modified by Mike Prentice (mjp44@buffalo.edu) +% 2011-02-21 +% To use PDF output directly from dot +% dot -Tpdf + +% Modified by Remi Dubot (remi.dubot@irit.fr) +% 2012-12-3 +% To distinguish errors from tex and from dot. +% Report dot errors +% Indications for non english writers + +% add the following lines to your preamble: + +% \usepackage[pdftex]{graphicx} +% \usepackage{graphviz} + +% parameters to \digraph: +% 1 - parameters for \includegraphics (optional; default value is "scale=1") +% 2 - name of the digraph +% 3 - body of the digraph + +% parameters to \includedot +% 1 - parameters for \includegraphics (optional; default value is "scale=1") +% 2 - name of the dot file (w/out file extension, which must be `.dot') + +% ASSUMES pdflatex +% If you are not using pdflatex, go back on an older version of this style. + +% If you are not writing english, pay attention to your charset. +% If is not UTF-8, you may have to indicate your charset to dot with "-Gccharset=XXXX". + +\ProvidesPackage{graphviz} + +\newcommand{\includedot}[2][scale=1]{% + \ifnum\pdfshellescape=1 + % Yes, enabled + \immediate\write18{bash -c "dot -Tpdf #2.dot -o #2.pdf 2> #2.log"}% + \IfFileExists{#2.pdf} + % the pdf exists: include it + {\includegraphics[#1]{#2}} + % the pdf was not created - show a hint + { \fbox{ \begin{tabular}{l} + The file \texttt{#2.pdf} hasn't been created from + \texttt{#2.dot} yet. \\ + We attempted to create it with:\\ + `\texttt{dot -Tpdf #2.dot -o #2.pdf}' \\ + but that seems not to have worked.\\ + \texttt{dot} said : \\ + "\texttt{\input{#2.log}}" + \end{tabular}} + } + \else + \fbox{ \begin{tabular}{l} + You need to execute `\texttt{pdflatex}' with the `\texttt{-shell-escape}' option.\\ + This allows the graphviz package to execute the program dot. + \end{tabular}} + \fi +} + +\newcommand{\digraph}[3][scale=1]{ + \newwrite\dotfile + \immediate\openout\dotfile=#2.dot + \immediate\write\dotfile{digraph #2 {\string#3}} + \immediate\closeout\dotfile + \includedot[#1]{#2} +} + + + diff --git a/templates/syncleus-white.cls b/templates/syncleus-white.cls index 647bcb137c390762022109f9beec44a56747563d..5e35e92234b10f1be5a8b04c1d88d5851730f474 100644 --- a/templates/syncleus-white.cls +++ b/templates/syncleus-white.cls @@ -20,7 +20,7 @@ % --------------------------------------------------------------------- \RequirePackage[utf8]{inputenc} \RequirePackage{amsmath,amsfonts,amssymb} -\RequirePackage{graphicx,xcolor} +\RequirePackage[pdftex]{graphicx,xcolor} \RequirePackage[english]{babel} \RequirePackage{booktabs} \RequirePackage{eso-pic} diff --git a/templates/syncleus-white.tex b/templates/syncleus-white.tex index d09902d4c5a0ea60547cf7c031abd3aeda1ba56d..76729de62ecd116b5fbd0add633d00a50a18fe7e 100644 --- a/templates/syncleus-white.tex +++ b/templates/syncleus-white.tex @@ -4,9 +4,10 @@ \usepackage{mathtools} \usepackage{amssymb} \usepackage{amsmath} -\usepackage{graphicx} \usepackage{subcaption} \usepackage{float} +\usepackage[pdftex]{graphicx} +\usepackage{./templates/graphviz} \usepackage[$if(geometry)$$geometry$$else$left=2cm, right=2cm, top=2.25cm, bottom=2.25cm, headheight=13.6pt, letterpaper$endif$]{geometry}