I know that SyncTeX does not work correctly in Beamer (see Inverse PDF Search in beamer).
But there seems to be also a problem with inverse search in environments defined with \NewEnviron
.
I want to call something like this:
\begin{foo}{x}{y}
bla bla
\end{foo}
It does not need to be an environment. But I do not know what to use else because I want to control the body which is possible with \BODY
in \NewEnviron
but not possible with \newenvironment
.
So is it possible to define an environment-like thing, where SyncTeX points to the text in the environment and not at the end of the environment?
In itemize
-environments it seems to work. Does someone know how it is implemented there?
Example:
\documentclass{letter}
\usepackage{environ}
\newif\ifshow
\NewEnviron{foo}[3]{
\ifshow
#1\\
\BODY
-----------
\else
Alert #1 #2 #3
\fi
}
\begin{document}
\begin{foo}{hide}{1}{2}
hidden Text
\end{foo}
\showtrue
\begin{foo}{show}{2}{1}
\begin{itemize}
\item a
\item b
\item c
\end{itemize}
\end{foo}
\begin{itemize}
\item d
\item e
\item f
\end{itemize}
\end{document}
For a, b, c inverse search does not work for d, e, f it works. For me it is important that the original text body can be replaced.
\NewEnviron
grabs the entire environment body and processes it only at the end, so SyncTeX cannot know from where within the environment each specific piece of text came from. As far as SyncTeX knows it was all stored in the\end{foo}
. I'm afraid the answer is: not possible\NewEnviron
does not work. Therefore, asked for an alternative. It should be possible ifitemize
works.