Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tikz in slidify? #502

Open
orb16 opened this issue Oct 13, 2016 · 0 comments
Open

tikz in slidify? #502

orb16 opened this issue Oct 13, 2016 · 0 comments

Comments

@orb16
Copy link

orb16 commented Oct 13, 2016

I have a figure I create in latex using the tikz package. Is it possible to write it directly in the Rmarkdown document? (ie, the way equations can be written, if mathjax is specified as a widget).

The code I use to create my latex figure is below. I'm using the io2012 framework for my slides.

\documentclass{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{pdflscape}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows, positioning, calc, plotmarks}
\renewcommand{\familydefault}{\sfdefault}   

\begin{document}
    \pagenumbering{gobble}
\begin{landscape}


\pgfdeclarelayer{bg}    % declare background layer
\pgfsetlayers{bg,main}  % set the order of the layers (main is the standard layer)

Some text


\tikzstyle{startstop3} = [rectangle, minimum width=5cm,  line width=1mm,minimum height=2cm,text centered, font = \bf, draw=black, fill=white]

\tikzstyle{process3} = [rectangle, rounded corners, minimum width=4.2cm, text width = 4cm, minimum height=2cm, line width=1mm, text centered, draw=black, fill=white!100]

\tikzstyle{cloud3} = [draw, rectangle, rounded corners, fill=black!100, text width = 3.5cm, minimum width=4cm, minimum height = 1.5cm,   text centered, text=white]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{circle3} = [circle, fill = black, xshift = 0.1cm]
%\tikzset{every loop/.style={min distance=40mm,in=0,out=40,looseness=10}}

\begin{tikzpicture}[remember picture,overlay,node distance=2cm]

\node (perch1) [process3] {};




%% regeneration framework
\node (perch2) [process3, right of=perch1, xshift = 6cm] {};
\node (perch4) [process3, right of=perch2, xshift = 3cm, yshift = 2cm] {}; 
\node (perch3) [process3, right of=perch2, xshift = 3cm, yshift = -2cm] {};
\node (perch5) [process3, right of=perch4, xshift = 3cm, yshift = -2cm, label={[align=left]}] {};

\node (perch1n) [circle3, left of=perch1, text = white, yshift = 0.9cm, xshift = -0.1cm] {\textbf{\Large 1}};
\node (perch2n) [circle3, left of=perch2, text = white, yshift = 0.9cm, xshift = -0.1cm] {\textbf{\Large 2}};
\node (perch3n) [circle3, left of=perch4, text = white, yshift = 0.9cm, xshift = -0.1cm] {\textbf{\Large 3}};
\node (perch4n) [circle3, left of=perch3, text = white, yshift = 0.9cm, xshift = -0.1cm] {\textbf{\Large 4}};
\node (perch5n) [circle3, left of=perch5, text = white, yshift = 0.9cm, xshift = -0.1cm] {\textbf{\Large 5}};

\node (glyphosate) [right of=perch1, text = black, xshift = 1.8cm, yshift = 0.3cm] {};



\begin{pgfonlayer}{bg} 

 \draw[->,gray, >=angle 60, line width = 1mm, line cap=round] (perch1n) edge [out=105,in=170,looseness=20, min distance = 10mm] node[below] {} (perch1n);

\draw[->,black, >=angle 60, line width = 1mm, line cap=round, loosely dashed] ($(perch4.east)$) to [bend left] ($(perch5.north)$);

\draw[->,gray, >=angle 60, line width = 1mm, line cap=round] ($(perch4.west)$) to [bend right] ($(perch1.north)$);

\draw[->,gray, >=angle 60, line width = 1mm, line cap=round] ($(perch3.west)$) to [bend left] ($(perch1.south)$);

\draw[->,gray, >=angle 60, line width = 1mm, line cap=round] ($(perch2.east)+(0, -0.17)$) to [bend left] ($(perch3.north)$);
\draw[->,black, >=angle 60, line width = 1mm, line cap=round] ($(perch2.east)+(0, +0.17)$) to [bend right] ($(perch4.south)$);


\draw[->,black, >=angle 60, line width = 1mm, line cap=round] ($(perch1.east)$) -- ($(perch2.west)$);

\node (perch4I) [circle3, fill = white, right of=perch3, text = white, yshift = -0.74cm, xshift = -.26cm] {3};
\draw[->,gray, >=angle 60, line width = 1mm, line cap=round] (perch4I) edge [out=285,in=350,looseness=25, min distance = 10mm] node[below] {} (perch4I);



 \node (perch5I) [circle3, fill = white, right of=perch5, text = white, yshift = 0.7cm, xshift = -0.33cm] {5};
 \draw[->,black, >=angle 60, line width = 1mm, line cap=round, loosely dashed] (perch5I) edge [out=25,in=85,looseness=30, min distance = 10mm] node[below] {} (perch5I);
 \end{pgfonlayer}



\end{tikzpicture}
\end{landscape}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant