我正在尝试在我用的流程图中绘制一个圆圈,围绕一堆节点,beamer
但我不知道该怎么做。理想情况下,我希望圆圈包含大多数节点(但不是所有节点)。我该怎么做?
这是我的代码:
\begin{frame}
\frametitle{The Regime Complex for Climate Change\\(Keohane and Victor (2011) )}
\tikzstyle{type1} = [rectangle, rounded corners, minimum width=3cm, minimum height=0.1cm,text centered, draw=black, fill=blue!10, text width=2cm]
\tikzstyle{type2} = [rectangle, rounded corners, minimum width=3cm, minimum height=0.1cm, text centered, draw=black, fill=blue!10, text width=5cm]
\tikzstyle{info} = [rectangle, rounded corners, minimum width=2.5cm, minimum height=0.1cm, text centered, draw=black,
fill=blue!30, text width=2.5cm]
\tikzstyle{org} = [rectangle, rounded corners, minimum width=2cm, minimum height=0.1cm, text centered, draw=black,
fill=blue!30, text width=3cm]
\tikzstyle{decision} = [square, minimum width=1cm, minimum height=0.1cm, text centered,
draw=black, fill=green!30, text width=4cm]
\tikzstyle{arrow} = [thick,->,>=stealth]
\begin{tikzpicture}[node distance=1.2cm]
\node (un) [type1, xshift=-3cm] {UN Legal Regimes};
\node (expert) [type1, right of=un, xshift=4cm]{Expert Assessments};
\node (montreal)[type1, below of=un, xshift=-1cm]{Montreal Protocol};
\node (bilateral)[type1, right of=montreal, xshift=3cm]{Bilateral Initiatives};
\node (clubs)[type1, right of=bilateral, xshift=2cm]{Clubs};
\node(subnat)[type1, below of=montreal, xshift=1cm]{Subnational Action};
\node(MDA)[type1, right of=subnat, xshift=4cm]{MDA};
\node(geo)[type1, below of=subnat, xshift=-1cm]{Geoengineering Governance};
\node(nuc)[type1, right of=geo, xshift=2cm]{Nuclear Technology};
\node(fin)[type1, right of=nuc, xshift=2cm]{Financial Market Rules};
\node(intel)[type2, below of=geo, xshift=1cm]{Intel Property and Investment Rules};
\node(trade)[type2, right of=intel, xshift=5cm]{International Trade Regime};
\end{tikzpicture}
\end{frame}
答案1
这可以通过使用fit
库来实现,例如使用
\node[draw=red,double,fit=(un) (montreal) ,inner sep=1ex,circle] (tmp) {};
请注意,在下面的代码中,我使用tikzset
了tikzstyle
应该使用 \tikzset 还是 \tikzstyle 来定义 TikZ 样式?
% arara: pdflatex
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{fit}
\tikzset{type1/.style={rectangle, rounded corners, minimum width=3cm, minimum height=0.1cm,text centered, draw=black, fill=blue!10, text width=2cm},
type2/.style={rectangle, rounded corners, minimum width=3cm, minimum height=0.1cm, text centered, draw=black, fill=blue!10, text width=5cm},
info/.style = {rectangle, rounded corners, minimum width=2.5cm, minimum height=0.1cm, text centered, draw=black,
fill=blue!30, text width=2.5cm},
org/.style={rectangle, rounded corners, minimum width=2cm, minimum height=0.1cm, text centered, draw=black,
fill=blue!30, text width=3cm},
decision/.style = {square, minimum width=1cm, minimum height=0.1cm, text centered,
draw=black, fill=green!30, text width=4cm},
arrow/.style = {thick,->,>=stealth},
}
\begin{document}
\begin{frame}
\frametitle{The Regime Complex for Climate Change\\(Keohane and Victor (2011) )}
\begin{tikzpicture}[node distance=1.2cm]
\node (un) [type1, xshift=-3cm] {UN Legal Regimes};
\node (expert) [type1, right of=un, xshift=4cm]{Expert Assessments};
\node (montreal)[type1, below of=un, xshift=-1cm]{Montreal Protocol};
\node (bilateral)[type1, right of=montreal, xshift=3cm]{Bilateral Initiatives};
\node (clubs)[type1, right of=bilateral, xshift=2cm]{Clubs};
\node(subnat)[type1, below of=montreal, xshift=1cm]{Subnational Action};
\node(MDA)[type1, right of=subnat, xshift=4cm]{MDA};
\node(geo)[type1, below of=subnat, xshift=-1cm]{Geoengineering Governance};
\node(nuc)[type1, right of=geo, xshift=2cm]{Nuclear Technology};
\node(fin)[type1, right of=nuc, xshift=2cm]{Financial Market Rules};
\node(intel)[type2, below of=geo, xshift=1cm]{Intel Property and Investment Rules};
\node(trade)[type2, right of=intel, xshift=5cm]{International Trade Regime};
\node[draw=red,double,fit=(un) (montreal) ,inner sep=1ex,circle] (tmp) {};
\end{tikzpicture}
\end{frame}
\end{document}