6

I want use listings package with uncover command. He's my code

\usepackage{listings}
\lstnewenvironment{Exemplecode}{}{}

\newenvironment{Framecode}[1]
{\begin{frame}[fragile, environment=Framecode]{#1}}
{\end{frame}}

\begin{frame}{Quelques Rappels}
 \begin{itemize}
   \item<1-> Les Alias.\newline
     \uncover<2->{\begin{Exemplecode}a \end{Exemplecode}}
 \end{itemize}
\end{frame}

I get the following error:

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

)
! Missing } inserted.
<inserted text> 
                }
l.19 \end{Framecode}

? 

EDIT: Thanks for the advice.

This is an exemple of my code:

\documentclass{beamer}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{listings}
\lstnewenvironment{Exemplecode}{}{}

\usetheme[hideothersubsections]{berkeley}
\setbeamerfont{block body}{size=\tiny}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]

\newenvironment{Framecode}[1]
{\begin{frame}[fragile, environment=Framecode]{#1}}
{\end{frame}}

\begin{document}

\begin{Framecode}{Quelques Rappels}
 \begin{itemize}
   \item<1-> Les Alias.\newline
   \begin{Exemplecode} a \end{Exemplecode}
 \end{itemize}
\end{Framecode}
\end{document}

Is it possible to do what I want to do ?

4

The lstlisting environment (and any descendants created with \lstnewenvironment) require the \end{...} to be standalone in a dedicated line. This is necessary because of the verbatim processing: Basically listings gobbles all lines until it finds a line with the respective \end{...} command:

\documentclass{beamer}
\usepackage[french]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{microtype}
\usepackage{xcolor}
\usepackage{listings}
\lstnewenvironment{Exemplecode}{}{}

\setbeamerfont{block body}{size=\tiny}
\definecolor{epi_brown}{RGB}{139,69,19}
\setbeamercolor{logo}{bg=white}
\setbeamertemplate{navigation symbols}{}
\setbeamertemplate{footline}[frame number]

\newenvironment{Framecode}[1]
{\begin{frame}[fragile, environment=Framecode]{#1}}
{\end{frame}}

\begin{document}

\begin{Framecode}{Quelques Rappels}
 \begin{itemize}
   \item<1-> Les Alias.\newline
   \begin{Exemplecode} 
     a 
   \end{Exemplecode}
 \end{itemize}
\end{Framecode}
\end{document}
  • Thanks for all ! I will ALWAYS write my latex code properly now even when i want just test. – Lumy Jun 12 '13 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.