Inverse search of a compiled file with -syntex=1 option is trivial: you just choose Configure -> Editor -> Kate option from Okular -> Settings menu, then use Shift-Click on your favorite line of the pdf file.

What about the forward search? How am I supposed to make Okular show a screen with a particular line pointed to in the Kate editor? Or in an abstract source editor, for that matter. No amount of search shows any clue.

It just works in some LaTeX IDEs, of course, but what is under the hood?

  • There's no answer for 'an abstract source editor' or, even, an editor with an unspecified viewer. It depends on the viewer accepting relevant information and the format it needs that information to be provided in. Then it depends on the editor formulating the request to the viewer in that specific way. Obviously, some of this is just a matter of configuring the editor, but it needs to provide a suitable variable which it will set appropriately. For example, I have Kile configured to use okular --unique '%absolute_target'. Obviously, okular is Okular. The --unique [target] ...
    – cfr
    May 10, 2017 at 21:55
  • ... depends on okular expecting the information in that format. (--unique stops it opening a new instance of an open PDF.) But the %absolute_target is something Kile will replace with the appropriate reference. So your editor has to expose this information to you in the form of a suitable variable. Kate may well do this or you may be able to make it do this, given that Kile is basically a wrapper for Kate. But Kile obviously makes this easy because its whole point as a wrapper is to provide the bells and whistles TeX users are apt to find useful.
    – cfr
    May 10, 2017 at 21:58
  • “What is under the hood” — the current best “just works” technology is called SyncTeX. (This is what is used by AUCTeX in Emacs, for example.) See the TUGboat article Direct and reverse synchronization with SyncTEX by its creator Jérôme Laurens, especially section 4.3 “How SyncTeX works”. You can also see its official page and a question on this site about it. May 10, 2017 at 22:25
  • Yes, it's Kate. No, synctex is not a problem. Neither is executing a shell command okular --unique... from wherever you please by whatever shortcut/menu item you please. The huge problem is to get any information about that [target], or even a hint of its existence. Yes, in full it is okular --unique 'file.pdf#src:linenumber file.tex'. It took a huge amount of inventive googling. No manner of Okular docs, man okular or whatever, ever mention it. Where are KDE programmer guides? May 11, 2017 at 4:48
  • @AlexeyOrlov You don't know how to do it in Kile do you?! For some reason, it isn't working for me any longer.
    – cfr
    Aug 13, 2017 at 21:38

1 Answer 1


To forward search with Texstudio and Okular, use this:

okular --unique %.pdf#src:@?a./?c:r./?c:m.tex

  • 2
    Well, the editor TeXStudio was not asked ...
    – Mensch
    Nov 8, 2021 at 16:25
  • 1
    I think a call from text editors to Okular should keep the same protocol.
    – Frank
    Nov 11, 2021 at 21:25

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.