1

Since I started using LaTeX I've found the forward/inverse search utility most helpful. What I've always noticed is that when using \includegraphics the area highlighted when forward searching a picture is sometimes much bigger than the picture itself. This makes syncing very difficult, especially when doing inverse search. Let me show you an example. My MWE is:

\documentclass{article}
\usepackage{graphicx}

\begin{document}
    \centering
    Nothing.
    \newpage
    \includegraphics[width=.5\linewidth]{noDPI}
    \includegraphics[width=.5\linewidth]{600DPI}
\end{document}

I have prepared two equally sized 640x480 PNG pictures. Both were processed with ExifTool doing exiftool.exe -all= file.png to remove all metadata. The one named 600DPI.png had its DPI set to 600 running exiftool.exe -PixelsPerUnitX=23622 -PixelsPerUnitY=23622 600DPI.png.

noDPI.png 600DPI.png

Ctrl+clicking each \includegraphics line in the source panel of TeXstudio highlights the PDF using the internal viewer. In the picture below you can see both highlighted rectangles at the same time. Notice the second spans more than one page.

Result.png

Although the images are the same size, the highlighted area is different. This is a nuisance because if I want to inverse search some text that lies in an area that is highlighted but where there is in fact no picture, TeXstudio takes me to the \includegraphics line instead. It becomes even more problematic with two-column documents.

For now I've been using ExifTool to set a high DPI value wherever needed. I've noticed that no matter how high I set it, the rectangle is never smaller than the picture itself. This is not practical, since the options are not the same for all image file formats (besides the fact that it fells very hackish).

Is there a way around this?

Some Notes

  • I've seen similar questions about problems with forward/inverse search, but none mentioned the graphicx package.
  • I've always been a TeXstudio user, so I can't tell what happens with other editors.
  • I got similar results using an external viewer (SumatraPDF).

PS: I apologize for the long question. Thanks for making it to the end :).

  • Interesting question raising many issues Core is the synctex method of using the area objects as created during the TeX build phases. So is it TeX & its interwoven glue structure not matching pdf zones Is it synctex not storing those areas in a hi-def way, so that selecting a pixel in the PDF will go back to the dot of an I in the TeX Certainly I am surprised to see a hint that image dpi has a drastic effect (like an unbound definition for drink spilling all over the page) there are those better than I to say why but my expectation is the point of newpage to end include are stored as one zone – KJO Apr 4 at 12:52

Your Answer

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

Browse other questions tagged or ask your own question.