In my LaTeX document I am using the following structure: I have a main tex-file from which chapters are included via include(.). Thus, each chapter has its own tex-file.

For some time now, I encountered synchronization problems between my source and the PDF viewer, i. e., the "go to PDF" and "go to source" of my IDE do not work. Weird enough, I only have this issue with some of the chapters. In my chapter's file names, I do neither use special characters nor spaces. Since this issue bothered me some time now, I tried to narrow it down.

The cause is apparently that synctex does not like the trim = ..., clip option of \includegraphics. Issues of such kind were already reported here and here. In the latter post this issue is already attributed to the clip option. However, I believe I can even further describe the bug (I don't think it is a feature) and therefore hope a solution or workaround to be around.

Here comes a MWE:




\author{TeXstudio Team}
\title{Simple Book Example}
\date{January 2013}



% bibliography, glossary and index would go here.



\chapter{The First Chapter}

    \includegraphics[trim=0 0 0 0,clip,

    \includegraphics[trim=0 0 0 0,clip, % can also be 'clip' without 'trim = ...'


\chapter{The Second Chapter}

Here is some text!

From within chapter02.tex you should not be able to sync to our PDF viewer and vice versa due to the clip option in the proceeding \include{.} (also fails to sync when code of chapter01.tex is placed in main.tex; but syncs when code of both chapters are placed in main).

Now comes the interesting bit: just remove or comment trim=0 0 0 0,clip, in the second figure's \includegraphics (and only there) and the synchronization should work (if the two figures are printed on individual pages). That is, it works even though the first figure's option is still trim=0 0 0 0,clip,.

Therefore, it looks like the clip option causes only problems when the corresponding figure is displayed in the PDF on the last page, i. e., directly proceeding the following include for which the syncing fails. You may also put text around the figure to avoid the figure being printed on the chapter's last page and then syncing should also work fine.

Neither \clearpage nor empty includes (\include{}) before the chapters' includes work for me.

So, currently I just do not use the clip option for figures at the end of chapters. And even though I would want to avoid figures at the end of chapters in my final version anyway (some style guides advice against it), a working solution would still be appreciated very much!

  • that seems odd, it probably depends on the pdf viewer, which are you using? trim=0 0 0 0,clip, doesn't actually do anything does your real use have non zero values? May 28, 2016 at 21:18
  • As I wrote in the comment of the MWE, even without trim and only clip the syncing fails. Can you reproduce the bug?
    – ToJo
    May 28, 2016 at 21:22
  • I don't have reverse search set up anyway, but as I said you probably need to say which viewer you are using. but again clip shouldn't be needed (or do anything) unless you are changing the bounding box of your figures May 28, 2016 at 21:53
  • @DavidCarlisle I can reproduce using Kile and Okular for backwards search. (But only backwards. Forward search seems to work OK from the main file. Forward search doesn't work generally from the included files with my current set-up, so I can't test that.) For backwards search, it searches for a file with the name of the working directory i.e. it loses the last part of the path consisting of the file name and extension.
    – cfr
    May 28, 2016 at 22:04
  • @DavidCarlisle I can reproduce this error with TeXstudio for both the internal as well as external viewer (Sumatra) and in both directions (forward and backwards). Sumatra's output for forward search, i. e., "go to PDF", is "unknown file 'chapter02.tex'", for backward sync it is "no sync information available".
    – ToJo
    May 29, 2016 at 12:40


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.