4

I am trying to put tikzpicture in beamer. Currently, I am creating it in a separate PDF file in article mode and then crop it; because I have no idea how I can scale the tikzpicture to fit my beamer window.

I am here putting a complete real flowchart, that I want to use directly in beamer. Any help will be useful.

\documentclass[12pt]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\pagestyle{empty}
\begin{document}
\begin{frame}
\pagestyle{empty}
\tikzstyle{decision} = [diamond, draw, fill={rgb:red,3;green,39;blue,233}, 
    text width=4.5em, text badly centered, node distance=4cm, inner sep=0pt, text=white, font=\bfseries]
\tikzstyle{block} = [rectangle, draw, fill={rgb:red,3;green,39;blue,233}, 
    text width=8em, text centered, rounded corners, minimum height=4em, node distance=2cm,
  text=white, font=\bfseries]
\tikzstyle{line} = [draw, -latex', line width=2pt]
\tikzstyle{cloud} = [draw, ellipse,fill={rgb:red,0;green,114;blue,255}, node distance=4cm,
text width=5em, text centered, minimum height=2em, text=white, font=\bfseries]

 \begin{tikzpicture}[node distance = 2cm, auto]
    \node [block] (init) {initialize model};
    \node [cloud, left of=init] (expert) {$V^{(2)}_{ij}$ from \textit{ab initio} DFT};
    \node [cloud, right of=init] (system) {lattice structure};
    \node [block, below of=init] (identify) {identify models (Ising/ Heisenberg)};
    \node [block, below of=identify] (mc) {Monte Carlo};
    \node [block, below of=mc] (evaluate) {Metropolis Alogorithm};
    \node [block, left of=evaluate, node distance=4cm] (iteration) {Iterate};
    \node [decision, below of=evaluate, node distance=3cm] (decide) {System Converged?};
    \node [block, below of=decide, node distance=3cm] (stop) {Evaluate $T_c$, magnetization,    correlation  \textit{etc.}};
    \node [cloud, right of=evaluate](how) {choose $V^{(2)}_{ij}$ according to shell and local concentration};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (mc);
    \path [line] (mc) -- (evaluate);
    \path [line] (evaluate) -- (decide);
    \path [line] (decide) -- node {\large\textbf{yes}}(stop);
    \path [line,dashed] (expert) -- (init);
    \path [line,dashed] (system) -- (init);
    \path [line] (decide) -| node [near start] {\large\textbf{no}} (iteration);
    \path [line] (iteration) |- (mc);
    \path [line,dashed] (how) -- (evaluate);
\end{tikzpicture}   
\end{frame}
\end{document}
2

You can use \scalebox. The result is not beautiful, but the final scaling and positioning is left to you.

\documentclass[12pt]{beamer}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\pagestyle{empty}
\begin{document}
\begin{frame}
\pagestyle{empty}
\tikzstyle{decision} = [diamond, draw, fill={rgb:red,3;green,39;blue,233}, 
    text width=4.5em, text badly centered, node distance=4cm, inner sep=0pt, text=white, font=\bfseries]
\tikzstyle{block} = [rectangle, draw, fill={rgb:red,3;green,39;blue,233}, 
    text width=8em, text centered, rounded corners, minimum height=4em, node distance=2cm,
  text=white, font=\bfseries]
\tikzstyle{line} = [draw, -latex', line width=2pt]
\tikzstyle{cloud} = [draw, ellipse,fill={rgb:red,0;green,114;blue,255}, node distance=4cm,
text width=5em, text centered, minimum height=2em, text=white, font=\bfseries]


\scalebox{0.5}{ % PS
 \begin{tikzpicture}[node distance = 2cm, auto]
    \node [block] (init) {initialize model};
    \node [cloud, left of=init] (expert) {$V^{(2)}_{ij}$ from \textit{ab initio} DFT};
    \node [cloud, right of=init] (system) {lattice structure};
    \node [block, below of=init] (identify) {identify models (Ising/ Heisenberg)};
    \node [block, below of=identify] (mc) {Monte Carlo};
    \node [block, below of=mc] (evaluate) {Metropolis Alogorithm};
    \node [block, left of=evaluate, node distance=4cm] (iteration) {Iterate};
    \node [decision, below of=evaluate, node distance=3cm] (decide) {System Converged?};
    \node [block, below of=decide, node distance=3cm] (stop) {Evaluate $T_c$, magnetization,    correlation  \textit{etc.}};
    \node [cloud, right of=evaluate](how) {choose $V^{(2)}_{ij}$ according to shell and local concentration};
    % Draw edges
    \path [line] (init) -- (identify);
    \path [line] (identify) -- (mc);
    \path [line] (mc) -- (evaluate);
    \path [line] (evaluate) -- (decide);
    \path [line] (decide) -- node {\large\textbf{yes}}(stop);
    \path [line,dashed] (expert) -- (init);
    \path [line,dashed] (system) -- (init);
    \path [line] (decide) -| node [near start] {\large\textbf{no}} (iteration);
    \path [line] (iteration) |- (mc);
    \path [line,dashed] (how) -- (evaluate);
\end{tikzpicture}   
} % PS
\end{frame}
\end{document}

enter image description here

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.