The question is in the title.

(needless to say I tried texdoc synctex|etex_man|pdftex|pdftex-a|xetex|luatex and the only thing I found is that it's enabled by the extraprimitives function in LuaTeX. And it looks like one of the internal number registers, but documentation should ideally/hopefully include e.g. can we turn it on and off during the compilation itself/between pages, etc.)

  • With some quick testing it appears that locally setting \synctex=0 will not stop the file from being included in the final synctex output.
    – user202729
    Dec 11, 2022 at 13:18

1 Answer 1


extensions.c in the luatex source has

int synctexoption;


    A convenient primitive is provided: \.{\\synctex=1} in the input source file
    enables synchronization whereas \.{\\synctex=0} disables it. Its memory
    address is |synctex_code|. It is initialized by the {\sl Sync\TeX} controller
    to the command-line option if given. The controller may filter some reserved

    In order to give the {\sl Sync\TeX} controller read and write access to the
    contents of the \.{\\synctex} primitive, we declare |synctexoffset|, such
    that |mem[synctexoffset]| and \.{\\synctex} correspond to the same memory
    storage. |synctexoffset| is initialized to the correct value when quite
    everything is initialized.


/*tex Holds the true value of |synctex_code|: */

unlike say the primitive corresponding to shell-escape) it is not read-only and may be set locally.

  • Given that (if I recalled correctly) the ability to typeset TeX in comments in the source code has not been restored since the source code is converted from web to C, I think this is all there is. Other engine source code may have similar things.
    – user202729
    Dec 11, 2022 at 12:58
  • 1
    @user202729 texdoc pdftex-changes (and texdoc xetex-changes) has the above quote typeset, in the current version on page 215.
    – Marijn
    Dec 11, 2022 at 18:21

You must log in to answer this question.

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