1

In TeXstudio when I right-click on the pdf preview and click on "Go to source" to find the corresponding LaTeX code, I find that it's off by around 100-200 lines. How is this happening?

I've installed a fresh copy of TeXstudio v2.12.8 (hg 2.12.8-1-g68cd350, using Qt Version 5.8.0, compiled with Qt 5.8.0 R) right after uninstalling and removing all the configuration files for the previous TeXstudio version (v.2.10). In that version, the "go to source" functionality was always reasonably accurate (within ~5 lines). I'm using a Win7 Enterprise PC.

Related post: Click right to "Go to source code" with Texstudio wasn't too helpful for me.

  • 2
    I don't know how this is happening but in general I tend to think that this is about soft-line wrapping. It's a general problem of SyncTeX – percusse Apr 30 '18 at 11:10
  • 1
    If I remember correctly, synctex is only accurate to the level of paragraphs. How long are your paragraphs? – user36296 Apr 30 '18 at 11:55
  • The paragraphs aren't long: around 3-4 sentences. But there are lots of equation / align environments, blocks of 3-4 lines each. – Medulla Oblongata Apr 30 '18 at 12:06
  • have you updated your TeX installation as well? – naphaneal Apr 30 '18 at 12:46
  • This is most likely to be an issue with synctex. If you could construct a minimal working example of this happening, like this, then maybe you can try to post an issue up on synctex's Github page. – Troy Apr 30 '18 at 12:59
2

As you can see in the comments, this is due to soft wrapping. This means that if a line is too long to fit in the text editors line then it's wrapped around.

This is only a visual line break - not a logical.

The inverse search (go to source) works line-wise. Make more real line breaks if you want a better accuracy.

enter image description here

\documentclass{article}

\begin{document}

Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 


Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text 

Text Text Text Text Text Text Text Text Text Text Text T
Text Text Text Text Text Text Text Text Text Text Text T
Text Text Text Text Text Text Text Text Text Text Text T
Text Text Text Text Text Text Text Text Text Text Text T
Text Text Text Text Text Text Text Text Text Text Text T
Text Text Text Text Text Text Text Text Text Text Text T

\end{document}

This is my guess at least :).

  • Thanks for your help. However I already have many "real" line breaks in my equations, plus my paragraphs are about half as long as what you have in your example... I still have the inaccuracy issue while using the most recent versions of TeXstudio and TeXworks, so should I post something on their Github page? – Medulla Oblongata May 1 '18 at 7:25
  • @MedullaOblongata Yes, maybe you can open an issue. I would make sure that you document the problem very good: Screenshot, screen capture video, example document, using the newest version and so on. – Dr. Manuel Kuehner May 1 '18 at 7:49

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.