[texhax] beamer code in columns

Herbert Voss Herbert.Voss at FU-Berlin.DE
Wed Sep 11 12:42:17 CEST 2013


Am 11.09.2013 12:10, schrieb shawn wilson:
> I can't seem to figure out how to get one column to stop overflowing
> into the next - I've tried minipage and parcolumns, but this is the
> simplest example:

with the fragile oprion you can use listings inside the columns.
Then the listings can take the current linewidth into account.
Outside of the columns the whole textwidth is used.

\documentclass{beamer}
\usepackage{listings}
\begin{document}

\begin{frame}[fragile]{Config file}
Outline:
\begin{columns}[t]
\begin{column}{0.45\textwidth}
\begin{lstlisting}[tabsize=8,basicstyle=\ttfamily\tiny,frame=single]
depend() {
     provide dns
     need localmount net
     after bootmisc
     use logger
}
\end{lstlisting}
\end{column}
\begin{column}{0.45\textwidth}
\begin{lstlisting}[tabsize=8,basicstyle=\ttfamily\tiny,frame=single]
reload() {
     ebegin "Reloading ${SVCNAME}"
     kill -HUP $(cat "${pidfile}")
     eend $?
}
\end{lstlisting}
\end{column}
\end{columns}
\end{frame}

\end{document}


Herbert


More information about the texhax mailing list