0

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.

marli
  • 165

1 Answers1

1

We can realize it with \newenvironment and \comment from verbatim:

\documentclass{letter}
\usepackage{verbatim}

\newif\ifshow

\newenvironment{foo}[3]{ \ifshow #1\ \else \def\a{#1} \def\b{#2} \def\c{#3} \expandafter\comment \fi } { \ifshow ----------- \else \expandafter\endcomment Alert \a~\b~\c \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}

Then inverse search does also work for a, b and c.

marli
  • 165