在Beamer框架中列出 - 警告后停止

在Beamer框架中列出 - 警告后停止

这个最小示例无法编译,我不知道为什么。有一个包警告

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

然后之后就没有输出了 / pdflatex 停止了,我必须终止它。

我的最小例子:

\documentclass[12pt]{beamer}
\usepackage{listings}
\begin{document}
\begin{frame}{Concept}[fragile]
    \begin{lstlisting}
PTable
    \end{lstlisting}
\end{frame}
\end{document}

完整的输出在这里:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian)
 restricted \write18 enabled.
entering extended mode
(./test.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 7 languages loaded.
(/usr/share/texmf/tex/latex/beamer/base/beamer.cls
(/usr/share/texmf/tex/latex/beamer/base/beamerbasercs.sty)
Document Class: beamer 2012/10/15 development version 3.24 A class for typesett
ing presentations (rcs-revision 24853e6b98cf)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasemodes.sty
(/usr/share/texmf/tex/latex/beamer/base/beamerbasedecode.sty))
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseoptions.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty))
(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty)
(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty))
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)
(/usr/share/texmf/tex/latex/pgf/basiclayer/pgfcore.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/share/texmf/tex/latex/pgf/systemlayer/pgfsys.sty
(/usr/share/texmf/tex/latex/pgf/utilities/pgfrcs.sty
(/usr/share/texmf/tex/generic/pgf/utilities/pgfutil-common.tex)
(/usr/share/texmf/tex/generic/pgf/utilities/pgfutil-latex.def
(/usr/share/texlive/texmf-dist/tex/latex/ms/everyshi.sty))
(/usr/share/texmf/tex/generic/pgf/utilities/pgfrcs.code.tex))
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys.code.tex
(/usr/share/texmf/tex/generic/pgf/utilities/pgfkeys.code.tex
(/usr/share/texmf/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex))
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgf.cfg)
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def)))
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex)
(/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex))
(/usr/share/texmf/tex/latex/xcolor/xcolor.sty
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg))
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcore.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmath.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathparser.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.random.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.base.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.round.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex)))
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfloat.code.tex))
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorequick.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex))
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex)
(/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex)))
(/usr/share/texmf/tex/latex/pgf/utilities/xxcolor.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty)
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty)
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg)
(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty)

Package hyperref Message: Stopped early.

)

Package hyperref Message: Driver (autodetected): hpdftex.

(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/share/texmf/tex/latex/beamer/base/beamerbaserequires.sty
(/usr/share/texmf/tex/latex/beamer/base/beamerbasecompatibility.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasefont.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)))
(/usr/share/texmf/tex/latex/beamer/base/beamerbasetranslator.sty
(/usr/share/texmf/tex/latex/beamer/base/translator/translator.sty
(/usr/share/texmf/tex/latex/beamer/base/translator/translator-language-mappings
.tex))) (/usr/share/texmf/tex/latex/beamer/base/beamerbasemisc.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasetwoscreens.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseoverlay.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasetitle.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasesection.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseframe.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseverbatim.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseframesize.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseframecomponents.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasecolor.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasenotes.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasetoc.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasetemplates.sty
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseauxtemplates.sty
(/usr/share/texmf/tex/latex/beamer/base/beamerbaseboxes.sty)))
(/usr/share/texmf/tex/latex/beamer/base/beamerbaselocalstructure.sty
(/usr/share/texlive/texmf-dist/tex/latex/tools/enumerate.sty))
(/usr/share/texmf/tex/latex/beamer/base/beamerbasenavigation.sty)
(/usr/share/texmf/tex/latex/beamer/base/beamerbasetheorems.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty))
(/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty))
(/usr/share/texmf/tex/latex/beamer/base/beamerbasethemes.sty))
(/usr/share/texmf/tex/latex/beamer/base/themes/theme/beamerthemedefault.sty
(/usr/share/texmf/tex/latex/beamer/base/themes/font/beamerfontthemedefault.sty)

(/usr/share/texmf/tex/latex/beamer/base/themes/color/beamercolorthemedefault.st
y)
(/usr/share/texmf/tex/latex/beamer/base/themes/inner/beamerinnerthemedefault.st
y)
(/usr/share/texmf/tex/latex/beamer/base/themes/outer/beamerouterthemedefault.st
y))) (/usr/share/texlive/texmf-dist/tex/latex/listings/listings.sty
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstmisc.sty)
(/usr/share/texlive/texmf-dist/tex/latex/listings/listings.cfg)) (./test.aux)
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty)
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
ABD: EveryShipout initializing macros
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty
(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty))
(./test.out) (./test.out)
(/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-basic-dicti
onary/translator-basic-dictionary-English.dict)
(/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-bibliograph
y-dictionary/translator-bibliography-dictionary-English.dict)
(/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-environment
-dictionary/translator-environment-dictionary-English.dict)
(/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-months-dict
ionary/translator-months-dictionary-English.dict)
(/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-numbers-dic
tionary/translator-numbers-dictionary-English.dict)
(/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-theorem-dic
tionary/translator-theorem-dictionary-English.dict)
No file test.nav.

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

谢谢!

答案1

beameruserguide.pdf第58页开始:

在此处输入图片描述

fragile是可能的选项之一,因此应在之前写上title

\begin{frame}[fragile]{Concept}

答案2

问题是,脆弱的如果框架标题以这种方式提供,则忽略选项。我使用了以下内容,并且有效:

\documentclass[12pt]{beamer}
\usepackage{listings}
\begin{document}
  \begin{frame}[fragile]
  \frametitle{Concept}
  \begin{lstlisting}
    PTable
  \end{lstlisting}
  \end{frame}
\end{document}

相关内容