auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] Listing and not listing regions inverted if `\begin{lstlist


From: Denis Bitouzé
Subject: Re: [AUCTeX] Listing and not listing regions inverted if `\begin{lstlisting}' not followed by what is expected
Date: Sun, 22 Mar 2015 16:34:05 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Le 22/03/15 à 10h02, Tassilo Horn <address@hidden> a écrit :

> Denis Bitouzé <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]