Le 22/03/15 à 10h02, Tassilo Horn <t...@gnu.org> a écrit :

> Denis Bitouzé <dbito...@wanadoo.fr> writes:
>
> Hi Denis,

Hi Tassilo,

>> \newenvironment{latexcode}
>> {%
>>   \VerbatimOut{tmp.tex}%
>> }{%
>>   \endVerbatimOut%
>>   \lstinputlisting{tmp.tex}%
>> }
>>
>> \begin{document}
>> \begin{frame}[fragile]
>> \begin{latexcode}
>> \begin{lstlisting}+\only<2->{+[+\emph{options}+]+}+
>> +\emph{listing}+
>> \end{lstlisting}
>> \end{latexcode}
>
> The problem is that AUCTeX has no clue that latexcode is a verbatim
> environment, and therefore its complete content should be displayed with
> the verbatim face.  Just add it as such ino your local variables
> section:
>
> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% eval: (add-to-list 'LaTeX-verbatim-environments-local "latexcode")
> %%% End:

Thanks for your answer. Anyway, the following:

--8<---------------cut here---------------start------------->8---
\documentclass{beamer}
\usepackage{lmodern}
\usepackage{fancyvrb}
\usepackage{listings}

\lstset{%
  escapechar=+,%
  basicstyle=\ttfamily,%
  language=[LaTeX]TeX%
}%

\newenvironment{latexcode}
{%
  \VerbatimOut{tmp.tex}%
}{%
  \endVerbatimOut%
  \lstinputlisting{tmp.tex}%
}

\begin{document}
\begin{frame}[fragile]
\begin{latexcode}
\begin{lstlisting}+\only<2->{+[+\emph{options}+]+}+
+\emph{listing}+
\end{lstlisting}
\end{latexcode}
\end{frame}

\begin{frame}[fragile]
\begin{latexcode}
\begin{lstlisting}
+Foo bar+
\end{lstlisting}
\end{latexcode}
\end{frame}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% eval: (add-to-list 'LaTeX-verbatim-environments-local "latexcode")
%%% End:
--8<---------------cut here---------------end--------------->8---

does work either though the (not) listing region is highlighted
differently (I must admit what I need is a kind of torture test from
a syntax highlight point of view :)
-- 
Denis

_______________________________________________
auctex mailing list
auctex@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex

Reply via email to