4

I am making presentations using beamer, I included the package \usepackage{cutwin}, but what does the parameters specify in \begin{cutout}{1}{2pt}{3\linewidth}{4}?

I want to make the text left of a figure but I got a mess as shown in the following.

\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}

enter image description here

2 Answers2

6

Use simply the native columns environment instead:

\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}

The output:

enter image description here

Remarks

  • I suppressed parts of the code in the question that were not essential to the issue discussed here.

  • beamer already loads graphicx and hyperref, so there's no need to load them in your document.

  • If the text on the left is code, you could be interested in using the listings package, for example which offers many features to help you typeset code.

Gonzalo Medina
  • 505,128
  • Thanks! What does \column{0.5\linewidth} mean? I am guessing this column is set to locate at 50% of linewidth? BTW, what is linewidth in presentation? I usually use textwidth... @Gonzalo Medina – Chi Zhang Jan 18 '15 at 01:50
  • @ChiZhang You're welcome. Indeed, \column{.5\linewidth} declares a column of width .5\linewidth. \linewidth and \textwidth are equal in this particular context, but they might be differen; see http://tex.stackexchange.com/q/16942/3954 – Gonzalo Medina Jan 18 '15 at 02:21
4

Or use the naive minipage approach.

\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}

enter image description here