6

Synctex makes it possible to jump between your LaTeX code and the compiled PDF, which is absolutely great, if you have larger documents. However it is my impression that when you use environments, Synctex jumps only to the environment rather than the precise location you want to jump. This does not matter, if your environments are small, but it is very annoying, if your environments are large. Is there any way around this problem, e.g. changing the implementation of the environment or reconfiguring synctex etc.?

This questions is a result of discussion Comment Multi-line Text on Counter Condition, because the result of this dicussion is an environment that typically includes large quantities of text.

This question might be similar to SyncTeX functionality in TeXShop and TeXworks, but I am not specifically interested in TeXShop.

2
  • @student: My mistake. -- Related: tex.stackexchange.com/questions/39678/… – krlmlr Jun 14 '12 at 21:41
  • @Meneldur , You can try including more labels , subsections, citations so that inverse search becomes more precise instead of showing the whole section. With Texmaker and Texworks, you can do Forward search using structure tags on the left window to the PDF on the right window. Similarly Inverse search can be done using the PDF Bookmarks/table of contents back to .tex source. – texenthusiast Jun 19 '12 at 0:26
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.