![在 Beamer 中将项目列表包裹在 TikZ 图片(使用 \tikzset 生成)周围](https://linux22.com/image/351431/%E5%9C%A8%20Beamer%20%E4%B8%AD%E5%B0%86%E9%A1%B9%E7%9B%AE%E5%88%97%E8%A1%A8%E5%8C%85%E8%A3%B9%E5%9C%A8%20TikZ%20%E5%9B%BE%E7%89%87%EF%BC%88%E4%BD%BF%E7%94%A8%20%5Ctikzset%20%E7%94%9F%E6%88%90%EF%BC%89%E5%91%A8%E5%9B%B4.png)
我有一张用 TikZ 生成的计算机图片(来源),我正在 Beamer 演示文稿中使用此图像。我需要在其周围环绕文本,我考虑使用包wrapfig
。如果我使用长文本(无itemize
),我会得到以下结果:
但如果我使用
itemize
,计算机就会消失!
我完全不知道如何解决这个问题。我在下面提供了一个 MWE。提前非常感谢。
编辑:我刚刚意识到计算机图像被打印在下一张幻灯片中!
\documentclass[10pt]{beamer}
\usepackage{tikz}
\usepackage{wrapfig}
\usepackage{lipsum}
\usetikzlibrary{fit}
\tikzset{
comp/.style = {
minimum width = 8cm,
minimum height = 4.5cm,
text width = 8cm,
inner sep = 0pt,
text = green,
align = center,
font = \Huge,
transform shape,
thick
},
monitor/.style = {draw = none, xscale = 18/16, yscale = 11/9},
display/.style = {shading = axis, left color = black!60, right color = black},
ut/.style = {fill = gray}
}
\tikzset{
computer/.pic = {
% screen (with border)
\node(-m) [comp, pic actions, monitor]
{\phantom{\parbox{\linewidth}{\tikzpictext}}};
% display (without border)
\node[comp, pic actions, display] {\tikzpictext};
\begin{scope}[x = (-m.east), y = (-m.north)]
% filling the lower part
\path[pic actions, draw = none]
([yshift=2\pgflinewidth]-0.1,-1) -- (-0.1,-1.3) -- (-1,-1.3) --
(-1,-2.4) -- (1,-2.4) -- (1,-1.3) -- (0.1,-1.3) --
([yshift=2\pgflinewidth]0.1,-1);
% filling the border of the lower part
\path[ut]
(-1,-2.4) rectangle (1,-1.3)
(-0.9,-1.4) -- (-0.7,-2.3) -- (0.7,-2.3) -- (0.9,-1.4) -- cycle;
% drawing the frame of the whole computer
\path[pic actions, fill = none]
(-1,1) -- (-1,-1) -- (-0.1,-1) -- (-0.1,-1.3) -- (-1,-1.3) --
(-1,-2.4) coordinate(sw)coordinate[pos=0.5] (-b west) --
(1,-2.4) -- (1,-1.3) coordinate[pos=0.5] (-b east) --
(0.1,-1.3) -- (0.1,-1) -- (1,-1) -- (1,1) -- cycle;
% node around the whole computer
\node(-c) [fit = (sw)(-m.north east), inner sep = 0pt] {};
\end{scope}
}
}
\begin{document}
\begin{frame}{Title}
\begin{wrapfigure}{l}{0pt}
\begin{tikzpicture}
\pic(compc) [
draw,
fill = green!30,
display/.append style = {left color=green!80!black!80},
scale = 0.5,
pic text = {Text}
]
{computer};
\end{tikzpicture}
\end{wrapfigure}
\begin{itemize}
\item \lipsum[1]
\end{itemize}
\end{frame}
\end{document}
答案1
如果您需要wrapfigure
进行演示,幻灯片上的文字就太多了。
但回到你的问题:我只需将项目和图像放在列中,然后在外面恢复新的项目。
\documentclass[10pt]{beamer}
\begin{document}
\begin{frame}{Title}
\begin{columns}[b, onlytextwidth]
\begin{column}{.4\textwidth}
\includegraphics[width=\textwidth, height=5cm]{example-image}
\end{column}
\begin{column}{.58\textwidth}
\begin{itemize}
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac.
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac felis.
\end{itemize}
\end{column}
\end{columns}
\begin{itemize}
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac.
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
\end{itemize}
\end{frame}
\end{document}
与右侧图像的操作方式相同:
\documentclass[10pt]{beamer}
\begin{document}
\begin{frame}{Title}
\begin{columns}[b, onlytextwidth]
\begin{column}{.6\textwidth}
\begin{itemize}
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac.
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac felis.
\end{itemize}
\end{column}
\begin{column}{.4\textwidth}
\includegraphics[width=\textwidth, height=5cm]{example-image}
\end{column}
\end{columns}
\begin{itemize}
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac.
\item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis.
\end{itemize}
\end{frame}
\end{document}