1

I am working on a Beamer presentation with columns. When I run:

\begin{frame}[fragile]
 \frametitle{Example}
 \begin{columns}
 \begin{column}{0.415\textwidth}
\begin{figure}
  \centering
  \includegraphics[scale = .25]{mosaic.pdf}
 \end{figure}
 \end{column}
  \begin{column}{0.415\textwidth}
  \begin{lstlisting}
ods select MosaicPlot;
proc freq data = mosaic;
 table party*sex/
 plots = mosaic;
 weight count;
run;
  \end{lstlisting}
  \end{column}
  \end{columns}
\end{frame}

it runs fine. But when I run the very similar:

\begin{frame}
  \frametitle{Strip chart - example}
    \begin{columns}
     \begin{column}{0.425\textwidth}
    \begin{figure}
  \centering
  \includegraphics[scale = .35]{strip.pdf}
 \end{figure}
 \end{column}
 \begin{column}{0.425\textwidth}
  \begin{lstlisting}
title "Salary by division, rookies";
 proc sgplot data = sashelp.baseball;
  scatter x = salary y = div;
  where yrmajor le 1;
 run;
  \end{lstlisting}
  \end{column}
  \end{columns}
\end{frame}

it causes:

Package Listings Warning: Text dropped after begin of listing on input line 103 .

Overfull \hbox (46.10982pt too wide) in paragraph at lines 103--106
[][]\T1/phv/m/n/10.95 stlistingolumnolumns
)
! Emergency stop.
<*> _temp.tex

!  ==> Fatal error occurred, no output PDF file produced!

which I don't understand at all.

What am I missing?

4

You forgot fragile in the second one.

Since you have verbatim text in both frames (listings of code), both frames require the fragile option. The first has it:

\begin{frame}[fragile]

so all is well. The second lacks it:

\begin{frame}

so it ends in tears :(.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.