我正在使用 制作演示文稿beamer
,我包含了包\usepackage{cutwin}
,但是参数指定了什么\begin{cutout}{1}{2pt}{3\linewidth}{4}
?
我想将文本放在图形的左边,但是结果却很混乱,如下所示。
\documentclass{beamer}
\usepackage[british]{babel}
\usepackage{hyperref,ru,url}
\usepackage[]{graphicx}
\usepackage{epstopdf} % insert .eps figure
\usepackage{ragged2e} % justify text
\justifying % justify text
\tolerance=1 % disable hyphen at row end
\emergencystretch=\maxdimen % |
\hyphenpenalty=10000 % |
\hbadness=10000 % |
\let\olditem=\item % justify in \item
\renewcommand{\item}{\olditem \justifying} %|
\usepackage{cutwin} % wrap figure
...
\begin{document}
\begin{frame}
\frametitle{Example 2}
\begin{block}{Calculations and Plots}
Plot $\sin(2x)$, $\sin(x^2)$ and $\sin^2(x)$ when $0\leqslant x\leqslant 6$.
\end{block}
\opencutright
\vfill
\renewcommand\windowpagestuff{%
\includegraphics[angle=0,width=1.6in]{eg2.eps}
}
\begin{cutout}{0}{0.7\linewidth}{0pt}{4}
\vspace{.5in}
$\color{blue}{>> x=linspace(0,6,100);}$\\
$\color{blue}{>> y1=sin(2*x);}$\\
$\color{blue}{>> y2=sin(x.^{\wedge} 2);}$\\
$\color{blue}{>> y3=(sin(x)).^{\wedge} 2;}$\\
$\color{blue}{>> plot(x,y1,x, y2,x, y3)}$\\
\end{cutout}
\end{frame}
\end{document}
答案1
只需使用本地columns
环境即可:
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Example 2}
\begin{block}{Calculations and Plots}
Plot $\sin(2x)$, $\sin(x^2)$ and $\sin^2(x)$ when $0\leqslant x\leqslant 6$.
\end{block}
\begin{columns}
\column{0.5\linewidth}
$\color{blue}{>> x=linspace(0,6,100);}$\\
$\color{blue}{>> y1=\sin(2*x);}$\\
$\color{blue}{>> y2=\sin(x.^{\wedge} 2);}$\\
$\color{blue}{>> y3=(\sin(x)).^{\wedge} 2;}$\\
$\color{blue}{>> plot(x,y1,x, y2,x, y3)}$\\
\column{0.5\linewidth}
\includegraphics[angle=0,width=\linewidth]{example-image-a}
\end{columns}
\end{frame}
\end{document}
输出:
评论
我隐藏了问题中与此处讨论的问题不相关的部分代码。
beamer
已经加载graphicx
和hyperref
,因此无需在文档中加载它们。如果左侧的文本是代码,您可能有兴趣使用
listings
例如,包提供了许多功能来帮助您排版代码。
答案2
或者使用简单的minipage
方法。
\documentclass{beamer}
\begin{document}
\begin{frame}
\frametitle{Example 2}
\begin{block}{Calculations and Plots}
Plot $\sin(2x)$, $\sin(x^2)$ and $\sin^2(x)$ when $0\leqslant x\leqslant 6$.
\end{block}
\begin{minipage}{0.5\linewidth}
$\color{blue}{>> x=linspace(0,6,100);}$\\
$\color{blue}{>> y1=\sin(2*x);}$\\
$\color{blue}{>> y2=\sin(x.^{\wedge} 2);}$\\
$\color{blue}{>> y3=(\sin(x)).^{\wedge} 2;}$\\
$\color{blue}{>> plot(x,y1,x, y2,x, y3)}$\\
\end{minipage}% <-- this % is needed
\begin{minipage}{0.5\linewidth}
\includegraphics[,width=\linewidth]{example-image-a}
\end{minipage}
\end{frame}
\end{document}