This question already has an answer here:

I created a new document using the default presentation template – simple-beaver. Then I added the following:

  • \usepackage{listings} at the top of the file right after \documentclass{beamer} declaration
  • a new frame:

    \section{Some Code}
          print "Hello world"

When I press Recompile sharelatex throws time out error. Any ideas how can I make the listings package work in sharelatex presentation?

marked as duplicate by user36296 beamer Mar 23 '18 at 11:40

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    Your beamer frame needs to be declared fragile. – Scott Seidman Mar 23 '18 at 10:56
  • Can you tell us the error? – Foitn Mar 23 '18 at 10:57
  • 1
  • 1
    aka use \begin{frame}[fragile]{Code} – daleif Mar 23 '18 at 10:58
  • 1
    Well, as the user of beamer you should read the beamer manual. ShareLaTeX has written som nice docs, but they cannot cover everything – daleif Mar 23 '18 at 11:06