答案1
像这样?
梅威瑟:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, shapes.arrows}
\begin{document}
\begin{frame}
\frametitle{Is there a simple solution to draw arrows?}
\centering
\begin{tikzpicture}[node distance=0pt,
SA/.style = {single arrow, draw=blue!40!gray, very thick, fill=blue!20!gray!10,
minimum height=1.6*\n1,
}
]
\node (n) [text width=0.8\textwidth]
{
\begin{itemize}[<+-| alert@+>]
\item Politics
\item Empirical
\item Simplified mechanistic
\item Full dynamics
\end{itemize}
};
\path let \p1 = ($(n.north)-(n.south)$),
\n1 = {veclen(\y1,\x1)} in
node[SA, rotate=90, xshift=\n1/2,
above=of n.south west] {Easy to apply}
node[SA, rotate=-90, xshift=-\n1/2,
above=of n.south east] {Transparency};
\end{tikzpicture}
\end{frame}
\end{document}
正如您所见,itemize 放在tikz
节点中,因为箭头使用single arrow
形状。
附录: 箭头适合于 itemize 高度(实际上是它的 1.6 倍)。我选择这个有两个原因:
- 箭头中的文字比项目高度长,
- 从提供的图片我(现在看来是错误的)得出结论,这是理想的
在下面的 MWE 中,我将箭头高度降低到大约 itemize 中文本的高度,并将字体大小更改为(\large
在itemize
环境中为,\small
在箭头中为)。另外,为了使两个箭头等高,我将其替换minimum width
为text width
。这些更改的结果是:
更正后的代码为:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc, positioning, shapes.arrows}
\begin{document}
\begin{frame}
\frametitle{Is there a simple solution to draw arrows?}
\centering
\begin{tikzpicture}[node distance=0pt,
SA/.style = {single arrow, draw=blue!40!gray, very thick, fill=blue!20!gray!10,
inner xsep=0pt, text width=\n1-4ex, align=center,% 4ex compensate vertical space above and below itemize
font=\small
}
]
\node (n) [text width=0.8\textwidth, font=\large]
{
\begin{itemize}[<+-| alert@+>]
\item Politics
\item Empirical
\item Simplified mechanistic
\item Full dynamics
\end{itemize}
};
\path let \p1 = ($(n.north)-(n.south)$),
\n1 = {veclen(\y1,\x1)} in
node[SA, rotate=90, xshift=0.45*\n1,
above=of n.south west] {Easy to apply}
node[SA, rotate=-90, xshift=-0.55*\n1,
above=of n.south east] {Transparency};
\end{tikzpicture}
\end{frame}
\end{document}
答案2
使用下面的代码就可以得到你想要的效果。
\documentclass{beamer}
\usepackage{tikz}
\usepgflibrary{shapes.arrows}
\begin{document}
\tikzstyle{my arrow} = [draw=cyan!75, very thick, single arrow, minimum height=7.5cm, shape border rotate =#1, fill=gray!10]`
\begin{frame}
\frametitle{Is there a simple solution to draw arrows?}
\begin{itemize}[<+-| alert@+>]
\item Politics \tikz \coordinate (po);
\item Empirical
\item Simplified mechanistic
\item Full dynamics
\end{itemize}
\begin{tikzpicture}[overlay]
\node at (-0.25,1) [my arrow=90] {\rotatebox{90}{Easy to apply}};
\node at (10,1) [my arrow=-180] {\rotatebox{-90}{Transparency}};
\end{tikzpicture}
\end{frame}
\end{document}