Is there a libsynctex package shipped as a part of MacTex?

gpanda gpanda.cn at gmail.com
Tue May 19 03:54:51 CEST 2020


Hi Karl and Community,

Thank you all for the comments. I finally got this hacked on *macOS* and
now everything seems to work fine.

Steps to build libsynctex.a:
1. Fetch the latest synctex source from https://github.com/jlaurens/synctex
2. Build.
    Method 1: The README tells how to build the client tool "synctex" with
a Xcode CLI project, we can easily adapt to a Xcode Library project
for libsynctex.a.
    Method 2: I wrote a Makefile
<https://drive.google.com/file/d/1Sl_k56tijGDRRuPb1Epnhs49haBFCcPC/view?usp=sharing>
from
scratch, just make it.
    Note: a. -DSYNCTEX_WORK mentioned in README should be -D__SYNCTEX_WORK__
              b. make sure you have zlib
              c. In synctex_parser.c, change "/usr/include/zlib.h" to
"<zlib.h>"
                  # ifdef __SYNCTEX_WORK__
                  //# include "/usr/include/zlib.h"
                  # include <zlib.h>


And here are the steps to hack Zathura build script to link libsynctex.a
1. Follow the instructions of
https://pwmt.org/projects/zathura/installation/ to build zathura and the
dependencies.
    Note: No synctex support by now. Check the zathura binary file,
             nm zathura | grep synctex | wc -l
             11
2. Put the synctex source folder in Zathura's source folder,
e.g. zathura-0.4.5/zathura/synctex.
3. Hack meson.build, to add synctex support.
    Insert the following two lines before "if synctex.found()"
*    build_dependencies += synctex*
*    defines += '-DWITH_SYNCTEX'*
    if synctex.found()
4. Remove and recreate "build" folder and redo "meson build"
5. Hack build/build.ninja, to link libsynctex.a.
    Edit L240, LINK_ARGS of the zathura target, add -L<path of
zathura-0.4.5>/zathura/synctex -lsynctex:
    e.g. LINK_ARGS = -Wl,-dead_strip_dylibs -Wl,-undefined,error
-Wl,-headerpad_max_install_names libzathura.a *-L<path of
zathura-0.4.5>/zathura/synctex -lsynctex* ...
6. ninja & ninja install
    Now, zathura should contain synctex functions. Check again,
    nm zathura | grep synctex | wc -l
    523

Done.


TL;DR My original goal is to use Vim + vimtex plugin + a document viewer
with synctex support (https://github.com/lervag/vimtex), so I can get
instant view updates of the PDF alongside while I'm editing a tex script.
Skim (a PDF viewer on macOS) is great, fast and works out of box. However,
it is built around Apple's PDFKit which doesn't support recolor of the page
background. What I want is to change the viewer's bg color from white to
some dark color, especially the same as my Vim's(like this
<https://drive.google.com/file/d/1jWnNhRtA_6ajkRb9lA_cVcIVX0vLQAAE/view?usp=sharing>).
Zathura can make this happen, except that no pre-built package for macOS
and its source doesn't ship with synctex. That's why I need those
aforementioned hacks.

-David Ren

Karl Berry <karl at freefriends.org> 于2020年5月18日周一 上午5:37写道:

>     Subject: Is there a libsynctex package shipped as a part of MacTex?
>
> No, sorry. We don't ship any libraries as such in TeX Live or
> MacTeX. They are all compiled into the binaries. Distributing libraries
> that could be linked with would be a quantum leap in difficulty of
> distribution, and we're already pressed enough.
>
> Does any pure viewer make use of synctex? I don't know. TeXShop does,
> but it is an editor, so the "source line" concept makes more sense
> there.
>
> At any rate, about all that comes to mind is to extract the sources from
> the TL tree and work with them in your own tree. Fortunately, they
> hardly ever change nowadays, so you're not committing to a lot of
> ongoing maintenance.  Unless the cmdline tool is enough, which I've
> never used myself, but it seems unlikely :(. --happy hacking, karl.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/tex-live/attachments/20200519/97c84e08/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 502 bytes
Desc: not available
URL: <https://tug.org/pipermail/tex-live/attachments/20200519/97c84e08/attachment.obj>


More information about the tex-live mailing list.