synctex on mac

in #synctex7 years ago (edited)

Switching to a Mac from Windows was initially was a big hit on my productivity, as I had to figure out how to do the simplest things (like cut and paste), but after two years I have most things figured out. One kind of specialized task, exploiting reverse synctex support when writing latex documents, is something that I hadn't taken the time to figure out how to do on the mac.

On Windows I used to use the Sumatra pdf viewer. That viewer had synctex support, in particular reverse lookup support, so if I was compiling my latex -> pdf appropriately, then I could click on whatever was of interest in the pdf viewer and it would start a editor (vim in my case) session of the file in question, pointing me right at the line of the latex of interest.

Compiling appropriately means including a -synctex=1 option in the pdflatex command that builds the pdf. As I now use latexmk (which does dependency checking, auto-bib processing, ...), that indirect pdflatex command looks like the following for me:

max_print_line=1000 \
latexmk -pdf \
-latexoption='-file-line-error' \
-latexoption='-synctex=1' \
-latexoption='-shell-escape' \
-latexoption='--halt-on-error' \
GAelectrodynamics.tex

I really missed that feature, and have been making do with a poor-man's synctex:

grep -n pattern *.tex > o
vim -q o

However, I have finally taken the time to figure out how to do the same on the mac that I'm now using. Here's an example of what happens with shift-command-click using the Skim pdf viewer:

Screen Shot 2018-01-03 at 2.53.57 PM.png

The cursor is positioned on the line in the latex source associated with the click point, so that a correction can easily be made.

A couple steps are required to get this to work:

This script is apparently in the dmg image that comes with MacVim, but that's been long since deleted on my machine.

References:

Coin Marketplace

STEEM 0.27
TRX 0.21
JST 0.038
BTC 96276.55
ETH 3627.68
SBD 3.80