[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] Listing and not listing regions inverted if `\begin{lstlisting}
From: |
Denis Bitouzé |
Subject: |
[AUCTeX] Listing and not listing regions inverted if `\begin{lstlisting}' not followed by what is expected |
Date: |
Sat, 21 Mar 2015 20:22:18 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Hi,
the following MWE compiles like a charm from a LaTeX point of view but
has a syntax highlighting problem from an AUCTeX point of view: because
the character just after the 1st `\begin{lstlisting}' is not what is
expected (not a `['):
1. what follows until the 1st `\end{lstlisting}' is not considered as
a listing (not on a yellow background),
2. this 1st `\end{lstlisting}' and what follows is considered as
a listing (on a yellow background) until the next `\begin{lstlisting}',
3. etc.
Hence, after the 1st `\begin{lstlisting}', listing and not listing
regions are inverted.
Is there a way to circumvent this trouble?
Thanks in anticipation.
--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}
--8<---------------cut here---------------end--------------->8---
--
Denis
- [AUCTeX] Listing and not listing regions inverted if `\begin{lstlisting}' not followed by what is expected,
Denis Bitouzé <=