I had a similar question here: Is there a change to get SyncTeX work with text within environments?
The thing is that Environ
has the problem that within an environment generated by \NewEnviron
the \BODY
will only recognized as one block by SyncTeX.
But in environments created with \newenvironment
the text within the environment is recognized by SyncTeX.
Nevertheless, as also stated in SyncTeX functionality in TeXShop and TeXworks, SyncTeX recognizes only lines. So you have to use line breaks in you editor to get an appropriate resolution with SyncTeX.
If we takt the example from Comment Multi-line Text on Counter Condition, we get the folowing:
\documentclass{scrartcl}
\usepackage{environ}
\usepackage{ifthen}
\usepackage{comment}
\usepackage{verbatim}
\newcounter{rlpublvl}% %this counter stores the publication level
\newcommand{\rlstetpublvl}[1]{\setcounter{rlpublvl}{#1}}% %sets the publication level to #1
\newenvironment{rltext}{}{}%
\newcommand{\rlcheckstatus}[1]{% %activates the environment rltext if #1 >= rlpublvl
\addtocounter{rlpublvl}{-1}%
\ifthenelse{#1 > \value{rlpublvl}}%
{\includecomment{rltext}}%
{\excludecomment{rltext}} %
\addtocounter{rlpublvl}{1}%
}%
\newif\ifhide
\hidefalse
\newenvironment{rlctxt}[1]{%
\addtocounter{rlpublvl}{-1}%
\ifthenelse{#1 > \value{rlpublvl}}%
{}%
{\hidetrue\expandafter\comment} %
}%
{%
\ifhide
\endcomment\hidefalse
\fi
\addtocounter{rlpublvl}{1}%
}%
\begin{document}
\rlstetpublvl{5} %global publication level set to 5
\rlcheckstatus{5} %this is printed
\begin{rltext}
This is ready
for publication.
\end{rltext}
\rlcheckstatus{0} %this is not printed
\begin{rltext}
This part is still under construction.
\end{rltext}
%-------
\begin{rlctxt}{5}% %this is printed
This is ready
for publication.
\end{rlctxt}
\begin{rlctxt}{0}% %this is not printed
This part is still under construction.
\end{rlctxt}
\end{document}
Now rlctxt
works with SyncTex as expected line-by-line with the text within the environment. rltext
does not work like this because text in environments from the comment
package are again recognized as one block by SyncTeX.