[Tex/LaTex] Can SyncTeX work across included files

forward-inverse-searchtexmaker

I am using the memoir class in Texmaker.

As far as I understand adding

--synctex=1

to the LaTeX and PDFLaTeX command will make the output document open up at the cursor position of the code. So if I left my cursor at the start of a particular piece of text on a random page the pdf will open up at that page.

It also enables the "click to jump to line".

Since I am typing a large document I an using \include to include all my chapters. This means when I compile I have to compile a master document. This means the cursor is now wherever I left it in the master document.

This is a huge pain since the pdf output is sometimes nowhere near the most recently edited part that I want to view. If I am working in Chapter 5 I can go leave the cursor after

\include{chapterfive}

but then the output is always on the last page of the chapter and I still need to scroll to the relevant part.

As you can imagine this becomes very tiresome very quickly. So I need help configuring Texmaker so that the PDF output opens up at the last place that I edited.

EDIT: I found a workaround. I followed this answer: Typesetting multiple TeX files

to be able to compile each chapter individually. And it worked 100%.

Best Answer

For me, the following works correctly:

  • Load your main file in Texmaker
  • Choose Options -> Define Current Document as 'Master Document'
  • Open a subfile
  • Edit subfile, etc.
  • Press 'Quick Build'
  • Main file builds but 'current' file stays visible, etc.
  • SyncTeX linking is possible from source to PDF and the reverse
Related Question