Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing a slide. I want to use lstlisting

    \documentclass[10pt]{beamer}
    \usepackage[utf8]{inputenc}
    \usepackage[english]{babel}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern} 
    \usepackage{listings}
    \begin{document}
    \begin{frame}{HeartBleed}
    \begin{lstlisting}
    Hellow world  
   \end{lstlisting}
   \end{frame}
   \end{document}

I get an error around around \begin{lstlisting} and it says: job aborted, no legal \end found. How can I resolve this problem ?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

For the usage of listings you have to use the fragile option for the frame:

\documentclass{beamer}
\usepackage{listings}

\begin{document}
    \begin{frame}[fragile]
        \begin{lstlisting}
            Hello world  
        \end{lstlisting}
    \end{frame}
\end{document}

Further information can be at found http://pbelmans.wordpress.com/2011/02/20/why-latex-beamer-needs-fragile-when-using-verbatim/

share|improve this answer
    
Thank you very much, it works, and this is very useful for my presentation as I have to do that on several slides. –  user61279 Aug 26 at 12:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.