On vscode you can setup a build task like this:
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"isBackground": true,
"promptOnClose": false,
"command": "make SYNC_LINE=${lineNumber} SYNC_FILE=${relativeFile}",
"problemMatcher": [],
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
},
"group": {
"kind": "build",
"isDefault": true,
}
}
],
}
And a Makefile like this:
TEX_CC=lualatex
TEX_FLAGS=--shell-escape --interaction=batchmode --halt-on-error --synctex=-1
####################################################################################
SYNC_LINE = 1
SYNC_FILE = main.tex
####################################################################################
.PHONY : main.aux
quick : main.aux
main.aux : main.tex sync
$(TEX_CC) $(TEX_FLAGS) $<
sync :
okular --unique --noraise main.pdf#src:$(SYNC_LINE)$(SYNC_FILE)
Now every time you press ctrl+shift+b
vscode will invoke make, compile the project and then sync to okular
From okular go to: Settings -> Configure Okular -> Editor
, select:
Editor: Custom Text Editor
Command: code --goto %f:%l
Now everytime you go to a line, press shift+leftMouse
, okular will sync to vscode