[Tex/LaTex] Embedding HTML code in beamer

beamerhtml

I want to embed html code like latex in beamer, like follows:

  \begin{frame}{HTML Code}[fragile]
   \begin{lstlisting}[language=html]
    <html>
    <head>
    </head>
    <body>
    </body>
    </html>
  \end{lstlisting}
   \end{frame}

But it is not working , Latex file is giving compilation errors. It is really urgent. Please help.

Best Answer

Remarks

The order of your parameters for the frame is wrong. The options in [] need to appear before the title in {}.

Implementation

\documentclass{beamer}
\usepackage{listings}
\begin{document}
\begin{frame}[fragile]{HTML Code}
\begin{lstlisting}[language=html]
<html>
<head>
</head>
<body>
</body>
</html>
\end{lstlisting}
\end{frame}
\end{document}

Output

frame