5

Suppose I have a large document which I decide to split into several .tex files. I have a main.tex that contains many calls like

\include{chapter1}
\include{chapter2}
...

In order to focus on a single file, say, chapter1.tex without having to switch between it and the main file, TeXMaker has a nice option that allows you to set main.tex as the main document (other editors have it as well). So when you press your custom shortcut to compile, TeXMaker will not compile the file you're on but compile main.tex instead.

This is nice but there is an issue: if you use SyncTeX's forward search option it will not bring you to the point where you are but in some random spot in the document.

Inverse search on the other hand works: if you click on a portion of your pdf file, it will take you back to the correct .tex file in the correct line.

So my question is: is there a way to make it so that forward search takes you to the correct spot in the pdf?


My setup is the following: I have TeXMaker interacting with Zathura pdf. From TeXMaker the compilation call is (as usual)

pdflatex -synctex=1 -interaction=nonstopmode %.tex

And the forward search instruction is

zathura --synctex-forward @:1:%.tex %.pdf

On Zathura the inverse search (not needed for the purpose if this question) is

set synctex true
set synctex-editor-command 'texmaker %{input} -line %{line}'

But if you have another working setup feel free to answer anyway.

1 Answer 1

-1

Answer: Test the TeXMaker fork called TeXStudio, also free, which works out of the box with forward and inverse search. The syntax for forward and inverse search is identical to TeXMaker, as are many other operations in TeXStudio.

TeXStudio for Linux, MaxOS, Windows

For Linux, an easy trial is the AppImage download: texstudio-3.1.2-x86_64.AppImage is 57MB self-contained and works directly with TeXLive2021. You do not install it, but make it executable and run it. I recently tested TeXStudio on Linux Mint 19.3 and Linux Mint 20.1 (2021), both being Ubuntu-based. Total download time to editing and viewing a 1200 page book was 3 min.

3
  • I'm not sure this answers the question: are you saying that forward search works for multiple source files on TexStudio? Furthermore, the second paragraph of the answer seems irrelevant... In any case, as a suggestion, always try to install from your distro's repository instead of using prepackaged binaries from elsewhere.
    – MannyC
    Jul 12, 2021 at 13:08
  • If TeXLive2017 is installed from Linux Synaptic, then TeXStudio installs from Synaptic with minimum disk impact and provides forward/inverse search out of the box. About AppImages: TeXLive2021 is an essential package, of 6GB. TeXStudio installed from Synaptic forces install of an older 2017 TeXLive: an extra 4GB on top of TeXLive2021. To test TeXStudio was the objective, then delete (uninstall) TeXStudio AppImage. Jul 13, 2021 at 16:55
  • The 1200 page paperback tested had main.tex with 178 * .tex includes. Forward and inverse search worked out of the box as expected. Jul 13, 2021 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .