Closed okomarov closed 6 years ago
Hi,
this is most certainly due to the inner synctex algorithm. It fails sometimes due to inappropriate heuristics. Unfortunately, there are so many different situations that no unique synctex policy may exist. I should take a look at this point when I have time. NB: Usually, I compare with Texworks behaviour to see how the frontend is involved. J. Laurens
More technical details for further insight. Next sources give almost the same .synctex file. We can see that the tikzpicture creates a new h box with 0 width, height and depth, with many glue nodes inside. This box "catches" synchronization too much.
\documentclass{article}
\usepackage{tikz}
\begin{document}
A
B
%\begin{tikzpicture}\end{tikzpicture}%
C
D
\end{document}
and
\documentclass{article}
\usepackage{tikz}
\begin{document}
A
B
\begin{tikzpicture}\end{tikzpicture}%
%
C
D
\end{document}
BTW, it seems that we have to insert a void line in order to have the same line numbers for corresponding nodes with/without tikzpicture. That would suggest that line numbering is not properly managed by the SyncTeX technology inside the TeX engine, a deeper look is needed. J. Laurens
Works better with synctex 1.20. Maybe we must wait some time before changes are available in clients.
The issue happens with TeXstudio. The following MWE reproduces the issue (all necessary files are attached).
All files, .tex .pdf .synctex and included tikz .tex, are available here./
I could look into it, but I might need a pointer where the issue might be.