我正在尝试放入tikzpicture
。beamer
目前,我正在模式下在单独的 PDF 文件中创建它article
,然后裁剪它;因为我不知道如何缩放tikzpicture
以适合我的beamer
窗口。
我在这里放置了一个完整的实数flowchart
,我想直接在 beamer 中使用。任何帮助都会有用。
\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}
答案1
您可以使用\scalebox
。结果并不美观,但最终的缩放和定位留给您。
\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}