投影机中的列表问题...我做错了什么?

投影机中的列表问题...我做错了什么?

我尝试将lstlisting环境放在左列,但出现错误。环境是否lstlistingcolumns兼容beamer?还是其他原因?

\documentclass{beamer}

\usepackage{remreset}
\usepackage{comment} % end and begin comment
\usepackage{dtklogos} % for \BibTeX

\usepackage{listings} % display code on slides; don't forget [fragile] option after \begin{frame}
\usepackage{bera} % pause in listing
\usepackage{color}
\definecolor{lightgrey}{rgb}{0.92,0.92,0.92} % defining color for listing
\definecolor{darkgreen}{rgb}{0,0.6,0} % defining color for listing

\usepackage{graphicx} % importing figure

\usepackage{verbatim} % writing code 

\makeatletter
\@removefromreset{subsection}{section} % creates navigation circles for every slide not section
\makeatother
\setcounter{subsection}{1} % creates navigation circles for every slide not section

\usetheme{Frankfurt}

\lstset{language=[LaTeX]TeX,
basicstyle=\small\ttfamily,
texcsstyle=*\bf\color{blue},
numbers=left,
breaklines=true,
keywordstyle=\color{darkgreen},
commentstyle=\color{red},
otherkeywords={$},
frame=leftline,
tabsize=2,
backgroundcolor=\color{lightgrey},
escapeinside=||
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\begin{columns}

\begin{column}{5cm}
\begin{lstlisting}[float=*]
\pause
\end{lstlisting}
\end{column}

\begin{column}{5cm}
text
\end{column}

\end{columns}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

答案1

否;columns并且lstlisting并不矛盾。您应该使用fragile框架选项,并且不要将列表视为浮动对象:

\documentclass{beamer}

\usepackage{remreset}
\usepackage{comment} % end and begin comment
\usepackage{dtklogos} % for \BibTeX

\usepackage{listings} % display code on slides; don't forget [fragile] option after \begin{frame}
\usepackage{bera} % pause in listing
\usepackage{color}
\definecolor{lightgrey}{rgb}{0.92,0.92,0.92} % defining color for listing
\definecolor{darkgreen}{rgb}{0,0.6,0} % defining color for listing

\usepackage{graphicx} % importing figure

\usepackage{verbatim} % writing code 

\makeatletter
\@removefromreset{subsection}{section} % creates navigation circles for every slide not section
\makeatother
\setcounter{subsection}{1} % creates navigation circles for every slide not section

\usetheme{Frankfurt}

\lstset{language=[LaTeX]TeX,
basicstyle=\small\ttfamily,
texcsstyle=*\bf\color{blue},
numbers=left,
breaklines=true,
keywordstyle=\color{darkgreen},
commentstyle=\color{red},
otherkeywords={$},
frame=leftline,
tabsize=2,
backgroundcolor=\color{lightgrey},
escapeinside=||
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}[fragile]
\begin{columns}

\begin{column}{5cm}
\begin{lstlisting}
\pause
\end{lstlisting}
\end{column}

\begin{column}{5cm}
text
\end{column}

\end{columns}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}

在此处输入图片描述

顺便说一下,我在您的代码中看到了以下一行:

\usepackage{bera} % pause in listing

这是不正确的;该包与是否可以在里面bera使用无关;只是一个字体包(用于获得漂亮的等宽字体)。\pauselstlistingbera

相关内容